Two kernels installed: 5.16 and 5.17

After a sudo apt update && sudo apt upgrade this morning, I have now two kernels installed and below /boot:

$ apt list --installed 2>/dev/null | grep '^linux-image-.*-librem5'
linux-image-5.16.0-1-librem5/now 5.16.19pureos1 arm64 [installed,local]
linux-image-5.17.0-1-librem5/byzantium,now 5.17.3pureos1 arm64 [installed,automatic]

$ ls -C1 /boot
boot.scr
boot.scr.bak
config-5.16.0-1-librem5
config-5.17.0-1-librem5
dtb
dtb-5.16.0-1-librem5
dtb-5.17.0-1-librem5
dtbs
grub
initrd.img-5.16.0-1-librem5
initrd.img-5.17.0-1-librem5
lost+found
System.map-5.16.0-1-librem5
System.map-5.17.0-1-librem5
vmlinuz-5.16.0-1-librem5
vmlinuz-5.17.0-1-librem5

Is this by intention? What should I do to get away the 5.16 one?

2 Likes

I have the same two kernels. After some Internet searching, I wonder if the following command might remove the old kernel (assuming it’s safe to remove):
sudo apt purge linux-image-5.16.0-1-librem5

I think I want confirmation from a Purism person before I run that, however.

1 Like

Have you run sudo apt autoremove after rebooting into the new kernel?

2 Likes

Yes. This didn’t removed anything.

2 Likes

Its not a bad idea to keep an old kernel in case a new updated one screws something up.

4 Likes

PureOS typically keeps 3 kernels installed at a time. That’s a precaution for when the new kernel fails, although recovery is still rather not user-friendly.

5 Likes

I never have had 3 kernels installed in /boot and this partition is rather to small for such luxury. We’re talking here about the L5 and not the L14.

This related command would (should) work with, I think:
sudo dpkg -l | grep linux-image | grep ^rc
sudo dpkg -l | grep ^rc | awk '{print $2}' −− for all other obsolete packages.

Yet it cannot be “successful” while both current Linux kernels are in ii stage:
sudo dpkg -l | grep linux-image | grep ^ii

Anyway, below one would give result which one to delete manually, if preferred:

sudo dpkg -l | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p'

But still and before linux-image-5.16.0-1-librem5 purged, this test might be useful if some other packages related/depend on it:

sudo dpkg --purge --simulate linux-image-5.16.0-1-librem5 $(dpkg -l | grep ^rc | awk '{print $2}')

Perhaps this was changed because of initramfs size. It used to be smaller, and I still have 3 at a time, if not more.

@guru: No worries you are a Guru, I still not : (

As far as I know (we don’t do anything different than Debian does here) it keeps:

  • the currently running kernel
  • the last installed kernel
  • the latest kernel
  • the second-latest kernel

Typically, some of these are overlapping, so usually you’d end it with either two or three installed kernels.

3 Likes

@dos, there was an older thread in February of this year and one of my posts there, this one: /boot/initrd.img , does not show two kernels below /boot (only an old .bak file, but not two or three complete kernels). Something changed since then.

If you only have one kernel installed (for instance, after a reflash or after manual removal), you’ll only have one kernel there - at least until a second one gets installed :stuck_out_tongue:

1 Like