Hello again,

After a successful kernel upgrade, can I remove everything in /lib/modules?

/lib/modules> dir
total 20
drwxr-xr-x 3 root root 4096 Dec 30 21:15 3.1.0-1.1-desktop
drwxr-xr-x 2 root root 4096 Jan  5 16:50 3.1.0-1.2-default
drwxr-xr-x 5 root root 4096 Jan  5 16:50 3.1.0-1.2-desktop
drwxr-xr-x 2 root root 4096 Jan  5 16:50 3.1.0-1.2-xen
drwxr-xr-x 3 root root 4096 Jan  5 18:14 3.1.7-1.2-desktop

rpm -qa | grep -i kernel

 uname -r

Thank you


No, they contain loadable kernel modules which are needed in operation by the corresponding kernel. Removing them would make the corresponding kernel useless if you ever need it again. Instead of removing files willy-nilly you would be better off removing the old kernel packages, and then any files from that package will be deleted.

As someone that does kernel upgrades all of the time, I suggest you keep all kernel versions installed by YaST, as YaST can/will remove it if uninstalled in YaST and keep the very latest kernel you are using. Since I compile my own kernels, I do remove folders that represent kernel versions I no longer use, but again, keep all installed by YaST (removing only with YaST) and the most recent kernel you are using. When compiling and installing a kernel outside of YaST, the only way to get rid of it is to manually remove unused kernel versions here. As a general rule you want at least two kernel load options as well just in case you muck up the one you are trying to use, you have one you can switch to.

Thank You,

The only thing I have ever removed from there are drivers that I had put there myself. I removed the old ones after recompiling the driver for the newer kernel. And then I removed any resulting empty directories for the older kernels.

Other files there seem to be automatically removed when no longer needed.

So, if you compile and install your own kernel, outside of YaST, the lib/modules/kernel-version folders do not go away on their own and weight in at 1.7 GB each. Such a size on a large 2TB disk is nothing, but on a small 60 GB SSD partition, it gets too big real fast. I guess you know if you are compiling and installing your own kernels using an SSD and if so, you need to keep an eye on this set of folders.

Thank You,