3

I was doing apt upgrade on my server, that usually goes quick and doesn't break anything. Not this time. Here's what I got on console:

Setting up linux-firmware (1.173.20) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-140-generic
update-initramfs: Generating /boot/initrd.img-4.15.0-139-generic
update-initramfs: Generating /boot/initrd.img-4.15.0-122-generic
update-initramfs: Generating /boot/initrd.img-4.13.0-45-generic
update-initramfs: Generating /boot/initrd.img-4.13.0-43-generic
update-initramfs: Generating /boot/initrd.img-4.13.0-41-generic
update-initramfs: Generating /boot/initrd.img-4.13.0-39-generic
update-initramfs: Generating /boot/initrd.img-4.13.0-38-generic
update-initramfs: Generating /boot/initrd.img-4.13.0-37-generic

This went very, very slow and choked my server for like 5 minutes. Very, very bad. Is all that necessary? It looks like those files are generated for many different versions. Why? Do I need multiple versions? I don't want them. I want one. The latest. And I definitely don't want the server to hang for 5 minutes on update.

So - what can I do to make things faster and get one "generating..." instead of 9 or more?

UPDATE: I'm after apt autoremove and purge-old-kernels, anyway...

apt-mark showmanual | grep linux

console-setup-linux
libselinux1
linux-base
linux-cloud-tools-4.13.0-37
linux-cloud-tools-4.13.0-37-generic
linux-cloud-tools-4.13.0-38
linux-cloud-tools-4.13.0-38-generic
linux-cloud-tools-4.13.0-39
linux-cloud-tools-4.13.0-39-generic
linux-cloud-tools-4.13.0-41
linux-cloud-tools-4.13.0-41-generic
linux-cloud-tools-4.13.0-43
linux-cloud-tools-4.13.0-43-generic
linux-cloud-tools-4.13.0-45
linux-cloud-tools-4.13.0-45-generic
linux-cloud-tools-virtual
linux-generic
linux-image-extra-4.13.0-37-generic
linux-image-extra-4.13.0-38-generic
linux-image-extra-4.13.0-39-generic
linux-image-extra-4.13.0-41-generic
linux-image-extra-4.13.0-43-generic
linux-image-extra-4.13.0-45-generic
linux-virtual
util-linux
walinuxagent
4
  • 1
    Is sudo apt autoremove - - purge working?
    – nobody
    Mar 29, 2021 at 18:26
  • @nobody IDK. It shows "following packages will be removed" and all are listed. Then it shows "Removing" only for 2 of them. So I'm not sure if all were removed, or only some of them.
    – Harry
    Mar 29, 2021 at 18:33
  • I am on mobile apt-mark showmanual | grep Iinux please show us.
    – nobody
    Mar 29, 2021 at 18:53
  • Added to post. Looks like despite all there's still some old stuff there.
    – Harry
    Mar 30, 2021 at 10:47

1 Answer 1

3

There is special script named purge-old-kernels.

To use it you need to install single package and run the script:

sudo apt-get install byobu
sudo purge-old-kernels

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .