4 ms·
+1 then I can kill my custom "remove oldest kernels, except the running one, and leave at least two other kernels" script.
by noja 10y ago
+1 then I can kill my custom "remove oldest kernels, except the running one, and leave at least two other kernels" script.
- jcadam 10y agoYes, I had this same problem when I was on Xubuntu. Fedora and CentOS(and I'm assuming many other distros) seem to handle kernel updates just fine without forcing me to manually clean out old images from /boot periodically (was always too lazy to write a script).
- vetinari 10y agoWhat Fedora and CentOS do is a generic yum/dnf option: installonly_limit. It allows you to keep limit on the amount of packages with the same name and different versions, kernel included.
- nyolfen 10y agowould you mind sharing this in the meantime?
- tombrossman 10y agoI've been using this for years. I believe it only keeps one old kernel version though, not two like you requested. Tested and working for weekly use since 12.04 though 16.04: echo $(dpkg --list | grep linux-image | awk '{ print $2 }' | sort | sed -n '/'`uname -r`'/q;p') $(dpkg --list | grep linux-headers | awk '{ print $2 }' | sort -n | sed -n '/'"$(uname -r | sed "s/\([0-9.-]*\)-\([^0-9]\+\)/\1/")"'/q;p') | xargs sudo apt-get -y purge
- throwaway6556 10y agoI guarantee there's a way to get that pipe to purge all packages in your system.
- noja 10y agoThis is the new way to do it: sudo purge-old-kernels --keep 3 -qy TIL