Virtualmin on AWS Lightsail - removing a buggy package / kernel before reboot

Operating system: Debian
OS version: 9

I need help with removing a buggy package / kernel.

I have, unfortunately, already applied the package linux-image-4.9.0-14-amd64 version: 4.9.240-1 and if I reboot the server, it will not come up again due to this bug: https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1771358.html

This is how things are at the moment: buggy kernel has been applied and server asking to be rebooted

I want to remove the buggy package linux-image-4.9.0-14-amd64 version: 4.9.240-1 so that the server can be booted safely. Can anyone help me and tell me how to remove a kernel which is about to be installed?

When I sudo apt-get purge linux-image-4.9.0-14-amd64 I get:

Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
  linux-image-4.9.0-11-amd64 linux-image-4.9.0-12-amd64
  linux-image-4.9.0-8-amd64
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  linux-image-4.9.0-14-amd64* linux-image-amd64*
0 upgraded, 0 newly installed, 2 to remove and 3 not upgraded.
After this operation, 194 MB disk space will be freed.
Do you want to continue? [Y/n] Abort.

…and I lose my nerve doing this on a production system.

Can anyone verify if I am on the right track or offer a safer / surer way forward. Keep in mind that AWS Lightsail is a limited access environment with none of the tools available to normal AWS instances, so we will have only one shot at getting this right.

Tia.

Hi,

Yes, purging installed linux image removes all mentions of it and regenerates grub configuration. I assume, it’s safe to do, especially in your situation and especially if you need to reboot.

Did it. This is what happened:

[root@vps08 ~]# sudo apt-get purge -y linux-image-4.9.0-14-amd64
Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
  linux-image-4.9.0-11-amd64 linux-image-4.9.0-12-amd64
  linux-image-4.9.0-8-amd64
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  linux-image-4.9.0-14-amd64* linux-image-amd64*
0 upgraded, 0 newly installed, 2 to remove and 3 not upgraded.
After this operation, 194 MB disk space will be freed.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 160629 files and directories currently installed.)
Removing linux-image-amd64 (4.9+80+deb9u12) ...
Removing linux-image-4.9.0-14-amd64 (4.9.240-2) ...
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
I: /vmlinuz.old is now a symlink to boot/vmlinuz-4.9.0-12-amd64
I: /initrd.img.old is now a symlink to boot/initrd.img-4.9.0-12-amd64
I: /vmlinuz is now a symlink to boot/vmlinuz-4.9.0-13-amd64
I: /initrd.img is now a symlink to boot/initrd.img-4.9.0-13-amd64
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.9.0-14-amd64
/etc/kernel/postrm.d/zz-update-grub:
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.9.0-13-amd64
Found initrd image: /boot/initrd.img-4.9.0-13-amd64
Found linux image: /boot/vmlinuz-4.9.0-12-amd64
Found initrd image: /boot/initrd.img-4.9.0-12-amd64
Found linux image: /boot/vmlinuz-4.9.0-11-amd64
Found initrd image: /boot/initrd.img-4.9.0-11-amd64
Found linux image: /boot/vmlinuz-4.9.0-8-amd64
Found initrd image: /boot/initrd.img-4.9.0-8-amd64
done
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 156400 files and directories currently installed.)
Purging configuration files for linux-image-4.9.0-14-amd64 (4.9.240-2) ...
[root@vps08 ~]#

And it booted normally.

Thank you! Thank you! Thank you!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.