kernel-devel updates eventually use up all inodes

I ran out of inodes on / and tracked it down to the kernel source directories in /usr/src. Every time kernel-devel and kernel-default-devel are updated, a new source tree is installed (about 25k inodes) but the old directories are never removed.

Even doing an in-place upgrade to a new release keeps all the old source directories. I had directories going back to kernel 3.11

Is this normal behavior or an oversight? Are you supposed to manually remove old source dirs?

sysman@ln1:~> grep "^multiversion" /etc/zypp/zypp.conf
multiversion = provides:multiversion(kernel)
multiversion.kernels = latest,latest-1,running

The file (/etc/zypp/zypp.conf) is well documented with comments.

How do you know that you have run out of inodes? What filesystem and partition size are you using?

There is a purge-kernels service that is supposed to be automatically started. Apparently, that is not setup correctly on your system.

Try using the services manager in Yast, and enable the purge-kernels service.

There is also a “purge-kernels” command available to root. You can try running that. I’m not sure if it just lists the kernels to remove, or actually removes them.

In any case, once you have enabled the “purge-kernels” service, you can

touch /boot/do_purge_kernels

(do that as root). And then reboot. That should delete lots of old kernels, including the kernel source and kernel devel for those old kernels. As long as the service is enabled, it should clean up automatically after kernel updates.

Your first cleanup might take a while since you have many kernels, so expect the system to be busy until finished.

Thanks for the excellent relevant info. The problem was caused by purge_kernels disabled. After uninstalling kernel_devel packages and enabling purge_kernels, my 20GB ext4 / partition went from 99% inode use to 25%

df -i /
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda8 1313280 320338 992942 25% /

The original symptom was updates failing with insufficient inodes error message.

I’m glad you now have things working properly.