Blacklisting Unwanted Kernel Modules Like Watchdogs

Here you will find information that will save you time and frustration.

Moderator: Founder

Blacklisting Unwanted Kernel Modules Like Watchdogs

PostPosted by natemaia » Sat Jun 10, 2017 6:56 pm

This is gonna be a long one so feel free to back out if you're not interested :lol:
I've tested this on 4 different computers 2 of which are laptops with no issues. With that said You should always exercise caution when changing system files and have a backup
This is not specific to AL but other arch installs as well

I am running AL on reasonably newer hardware (haswell cpu & kepler gpu) and under UEFI. When i reboot on a fully updated fresh install i get two lines stating (a different variation at boot)
kernel: watchdog watchdog0: watchdog did not stop!

then it reboots whether this is a recent change in arch or whether it has always been this way I am not sure. If you use ssd this is less of an issue but on a hdd it can be like 10s.
So I did some research and i found thishttps://wiki.archlinux.org/index.php/Improving_performance#Watchdogs andhttps://wiki.archlinux.org/index.php/Kernel_modules#Blacklisting
I believe its dependant on what hardware you have but the short story of it is
Watchdogs:
Many users need this feature due to their system's mission-critical role (i.e. servers), or because of the lack of power reset (i.e. embedded devices). Thus, this feature is required for a good operation in some situations. On the other hand, normal users (i.e. desktop and laptop) do not need this feature and can disable it.

Blacklisting:
In the context of kernel modules, is a mechanism to prevent the kernel module from loading. This could be useful if, for example, the associated hardware is not needed, or if loading that module causes problems: for instance there may be two kernel modules that try to control the same piece of hardware, and loading them together would result in a conflict.

This is helpful in a number of ways, it allows us to stop kernel modules from loading if not needed. The module may be loaded if another non-blacklisted module depends on it or if it is loaded manually.
You can check the watchdog configuration with
Code: Select all
sudo cat /proc/sys/kernel/watchdog
or
sudo wdctl
If you get "0" or "/dev/watchdog: No such file or directory" you don't have watchdogs enabled.
wdctl should get you something like this
Code: Select all
Device:        /dev/watchdog
Identity:      iTCO_wdt [version 0]
Timeout:       30 seconds
Timeleft:       2 seconds
FLAG           DESCRIPTION               STATUS BOOT-STATUS
KEEPALIVEPING  Keep alive ping reply          0           0
MAGICCLOSE     Supports magic close char      0           0
SETTIMEOUT     Set timeout (in seconds)       0           0

the important part is the Identity: iTCO_wdt that is the module name we need to blacklist
We will also disable the pcspkr module, who needs that these days :lol:

1. Kernel boot parameters
Code: Select all
sudo nano /etc/default/grub
Code: Select all
GRUB_CMDLINE_LINUX_DEFAULT="quiet nowatchdog"

2. Blacklist folder and config file
Code: Select all
sudo mkdir /etc/modprobe.d
Code: Select all
sudo nano /etc/modprobe.d/modprobe.conf
Copy Paste (this may vary depending on what the Identity of the module listed from wdctl)
Code: Select all
# Do not load the 'pcspkr' module on boot.
blacklist pcspkr

# Do not load the 'watchdog' module on boot
blacklist iTCO_wdt

3. Link to config file in mkinitcpio.conf
Code: Select all
sudo nano /etc/mkinitcpio.conf
Change the FILES section
Code: Select all
# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way.  This is useful for config files.
FILES="/etc/modprobe.d/modprobe.conf"

4. Rebuild the initramfs (I re - install the current kernel so this part will vary)
Code: Select all
sudo pacman -S linux linux-headers
or
sudo pacman -S linux-lts linux-lts-headers

5. Rebuild grub
Code: Select all
sudo grub-mkconfig -o /boot/grub/grub.cfg

Reboot, You will have a normal first boot after installing a new kernel.
Now if you run
Code: Select all
sudo cat /proc/sys/kernel/watchdog
or
sudo wdctl

You should get
wdctl: cannot open /dev/watchdog: No such file or directory
and
$ cat /proc/sys/kernel/watchdog

0

Done, You should have a shorter boot/reboot time & shouldnt see any more messages regarding watchdogs.
User avatar
natemaia
ArchLabs Guru
ArchLabs Guru
 
Posts: 75
Joined: Thu Mar 16, 2017 10:14 pm
Location: Canada - British Columbia
Running Release: 5.0

Re: Blacklisting Unwanted Kernel Modules Like Watchdogs

PostPosted by womp » Mon Aug 21, 2017 3:19 am

Hi and thanks for this great knowledgeable suggestion!
I have a question though.
"sudo cat /proc/sys/kernel/watchdog" gives "1" but wdctl gives "/dev/watchdog: No such file or directory"!
Strange huh?

Every tweak is needed on my old pc-station!

Womp
womp
 
Posts: 4
Joined: Thu Jul 27, 2017 10:51 am
Location: Sweden near Halmstad
Running Release: 5.0.0

Re: Blacklisting Unwanted Kernel Modules Like Watchdogs

PostPosted by Brandini » Mon Aug 21, 2017 5:44 am

I get the same as womp
All that I am or seem is but a dream within a dream.
Brandini
 
Posts: 18
Joined: Thu Apr 13, 2017 1:36 am
Location: Preston -UK


Return to Tips and Tricks

Who is online

Users browsing this forum: No registered users and 0 guests

cron