2

The latest Linux kernel now takes more than half of my /boot space. Next time I want to upgrade, how do I do that? Can I purge the current in-use kernel and then issue aptitude full-upgrade or do-release-upgrade? Seems dangerous and with possible side effects (loss of config?)

$ df -h /boot Filesystem Size Used Avail Use% Mounted on /dev/sda1 236M 166M 58M 75% /boot $ du -hc /boot/*5.11.0-18* 249K /boot/config-5.11.0-18-generic 117M /boot/initrd.img-5.11.0-18-generic 5.8M /boot/System.map-5.11.0-18-generic 15M /boot/vmlinuz-5.11.0-18-generic 137M total 

Or is the only solution to boot from liveCD, chroot into your system, delete the current kernel and install the new one ?

3
  • My install of impish has initrd.img-5.11.0-18-generic at 87.2MB. Where are you getting your oversize version. Includes some testing data? Commented Jun 15, 2021 at 14:34
  • 1
    You will have to extend your /boot partition because it will be painful each time you want to install a new kernel. Also, your initrd is unusally large as if it includes a lot more drivers or boot scripts than necessary. Commented Jun 15, 2021 at 14:35
  • I asked about extending /boot in another thread (unix.stackexchange.com/questions/654214/…) but it just looks too risky and complex. As for shrinking the kernel by removing unused drivers, I know how to do that manually by editing .config (I program embedded systems) but I have no idea how to do it on Ubuntu. Commented Jun 15, 2021 at 20:00

1 Answer 1

2

I managed to halve the size taken by the initrd and associated files by simply changing MODULES=most to MODULES=dep in /etc/initramfs-tools/initramfs.conf

I left the compression unchanged as it was already using lz4 which, I believe, is currently the better compression ratio.

Then run sudo update-initramfs -u -k all to have it take effect, and reboot to test.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.