Saturday, January 22, 2022

Ubuntu – Increase number of old kernels to keep on autoremove

So I looked into the script a little bit and some minor changes was enough to get what you want.

First create a backup of: /etc/kernel/postinst.d/apt-auto-removal:

sudo cp /etc/kernel/postinst.d/apt-auto-removal{,.bk}

Then find this line:

previous_version="$(echo "$debverlist" | sed -n 2p)"

and change it to:

previous_version="$(echo "$debverlist" | sed -n 2,4p)"
  • Now it should keep 3 old kernel + Running + Newly installed one
  • Of course you have to run it once manually or install a new kernel to make it take effect.

No comments:

Post a Comment

What's the quickest way to find duplicated files?

find . ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD fdupes -r / linux_czkawka_gui.AppImage