brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: /proc/sys/kernel/tainted tells you why your Linux kernel counts as tainted

Linux
~/tips/tip-linux-kernel-tainted-decode

cat /proc/sys/kernel/tainted

Decode the taint number to see which loaded module or event marked the kernel.

Kernel messages sometimes say Tainted: P O, and bug trackers ask whether your kernel is tainted. The answer is a number that hides a list of reasons.

cat /proc/sys/kernel/tainted

0 means not tainted. Anything else is a sum of bits, and each bit has its own reason. The kernel documentation gives a one liner that prints every bit:

for i in $(seq 0 19); do echo $i $(($(cat /proc/sys/kernel/tainted)>>$i&1)); done

Look for the lines that end in 1. The common ones on home servers are bit 0, a proprietary module such as the NVIDIA driver; bit 12, a module built outside the kernel tree, for example ZFS or a vendor driver; and bit 13, an unsigned module on a kernel that supports module signing. Bit 9 means the kernel already printed a warning since boot, which is worth a look in dmesg by itself.

Tainted does not mean broken. Plenty of machines run tainted for years without trouble. The documentation explains why it matters anyway: developers often ignore bug reports from tainted kernels, since the outside code may be the real cause.

The flag also stays set until the next reboot, even after you unload the module that caused it. So if you want to report a kernel bug, reproduce it after a clean boot without those modules loaded. I find the bit list a good first check before blaming the kernel for a crash.

Further reading: Tainted kernels

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link