[SOLVED] old linux image in /boot after upgrade to Bullseye

Kernels & Hardware, configuring network, installing services

[SOLVED] old linux image in /boot after upgrade to Bullseye

Postby ticojohn » 2021-03-12 13:17

I recently upgraded one of my installations to Bullseye (amd64). I noticed that and linux image (4.19) is still installed, although the associated header appears to not be installed.
Code: Select all
# dpkg --list | egrep -i --color 'linux-image|linux-headers'
ii  linux-headers-5.10.0-3-amd64                5.10.13-1                         amd64        Header files for Linux 5.10.0-3-amd64
ii  linux-headers-5.10.0-3-common               5.10.13-1                         all          Common header files for Linux 5.10.0-3
ii  linux-headers-5.10.0-4-amd64                5.10.19-1                         amd64        Header files for Linux 5.10.0-4-amd64
ii  linux-headers-5.10.0-4-common               5.10.19-1                         all          Common header files for Linux 5.10.0-4
ii  linux-headers-amd64                         5.10.19-1                         amd64        Header files for Linux amd64 configuration (meta-package)
ii  linux-image-4.19.0-13-amd64                 4.19.160-2                        amd64        Linux 4.19 for 64-bit PCs (signed)
ii  linux-image-5.10.0-3-amd64                  5.10.13-1                         amd64        Linux 5.10 for 64-bit PCs (signed)
ii  linux-image-5.10.0-4-amd64                  5.10.19-1                         amd64        Linux 5.10 for 64-bit PCs (signed)
ii  linux-image-amd64                           5.10.19-1                         amd64        Linux for 64-bit PCs (meta-package)

Just wondering if this is normal and if not should I do anything? Perhaps the system defaults to retaining a certain number of old images. Enlightenment would be appreciated. Thanks.
Last edited by ticojohn on 2021-03-19 22:08, edited 1 time in total.
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 918
Joined: 2009-08-29 18:10
Location: /home/heart

Re: old linux image in /boot after upgrade to Bullseye

Postby brian_p » 2021-03-12 13:43

The present and previous images are kept. Remove old images with
Code: Select all
apt --purge autoremove
--
Brian.
brian_p
 
Posts: 137
Joined: 2015-11-05 10:32

Re: old linux image in /boot after upgrade to Bullseye

Postby ticojohn » 2021-03-12 13:57

brian_p wrote:The present and previous images are kept. Remove old images with
Code: Select all
apt --purge autoremove

Thanks, but I've done that. The output I include in my post indicates that 4.19 is installed (ii). As such it is not removed. My question was more about why does the system keep that 4.19 kernel when it probably can't be used with Bullseye. I guess I won't let it cause me concern since I think that it is all determined automatically by the system. I'm not overly concerned, just wondering. Thanks for your reply.
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 918
Joined: 2009-08-29 18:10
Location: /home/heart

Re: old linux image in /boot after upgrade to Bullseye

Postby p.H » 2021-03-12 14:29

ticojohn wrote:why does the system keep that 4.19 kernel

Maybe because it is marked as manually installed, and as such won't be automatically removed.
ticojohn wrote:it probably can't be used with Bullseye

Why not ?
p.H
 
Posts: 1739
Joined: 2017-09-17 07:12

Re: old linux image in /boot after upgrade to Bullseye

Postby ticojohn » 2021-03-12 18:02

p.H wrote:
ticojohn wrote:why does the system keep that 4.19 kernel

Maybe because it is marked as manually installed, and as such won't be automatically removed.
ticojohn wrote:it probably can't be used with Bullseye

Why not ?

It was definitely NOT manually installed.
Why not use with Bullseye? I would think that there is likelihood that there have been library changes in Bullseye (kernel 5.10) that may not be compatible with kernel 4.19. But I am but an egg. That is why I ask questions - to learn and maybe grow.

UPDATE: Doing a little investigation on my question. I booted Bullseye using image 4.19 and got a boot message
cgroup2 unkown option memory_recursiveprot

While this did not keep the system from booting it does make me wonder as to the wisdom of using that kernel with Bullseye. Reference this url.
https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1790683.html
I don't know what impact that may have on usage or if it might lead to problems. However I won't, in the future, be booting into 4.19 on Bullseye.

Thanks again.
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 918
Joined: 2009-08-29 18:10
Location: /home/heart

Re: old linux image in /boot after upgrade to Bullseye

Postby Head_on_a_Stick » 2021-03-12 19:24

p.H wrote:
ticojohn wrote:why does the system keep that 4.19 kernel

Maybe because it is marked as manually installed, and as such won't be automatically removed.

No, the kernel images are marked as automatically installed because they are dependencies of the metapackage. From my bullseye system:
Code: Select all
$ aptitude search '?narrow(?automatic, linux-image)'                     
i A linux-image-4.19.0-14-amd64          - Linux 4.19 for 64-bit PCs (signed)             
i A linux-image-5.10.0-3-amd64           - Linux 5.10 for 64-bit PCs (signed)             
$

The old ABI version isn't marked for automatic removal because the metapackage which pulled it in is still installed. However it wouldn't be removed even if the kernel metapackage was removed because it is no longer a dependency of that package.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: old linux image in /boot after upgrade to Bullseye

Postby sunrat » 2021-03-12 19:28

ticojohn wrote:
p.H wrote:
ticojohn wrote:It was definitely NOT manually installed.

Packages can be marked as manually installed for several reasons including if they are dependencies of other manually installed packages.
Run this to check which packages are marked as manual:
Code: Select all
apt-mark showmanual

But that's probably not your case as Head_on_a_Stick explained.

apt will keep one previous kernel by default if you run
Code: Select all
apt full-upgrade
but it won't remove any packages if you just
Code: Select all
apt upgrade

In Testing and Unstable you should generally do
Code: Select all
apt full-upgrade
or your system will become clogged with unneeded packages. Like old kernels.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 3474
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: old linux image in /boot after upgrade to Bullseye

Postby ticojohn » 2021-03-12 19:53

sunrat wrote:In Testing and Unstable you should generally do
Code: Select all
apt full-upgrade
or your system will become clogged with unneeded packages. Like old kernels.

I absolutely did a full-upgrade when I upgraded from Buster to Bullseye. Can I, and SHOULD I, do it again?
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 918
Joined: 2009-08-29 18:10
Location: /home/heart

Re: old linux image in /boot after upgrade to Bullseye

Postby Head_on_a_Stick » 2021-03-12 20:21

The 'full-upgrade' command won't remove old kernels. You can remove old kernels manually once you've confirmed that the new version works for your hardware.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: old linux image in /boot after upgrade to Bullseye

Postby ticojohn » 2021-03-12 20:34

Head_on_a_Stick wrote:The 'full-upgrade' command won't remove old kernels. You can remove old kernels manually once you've confirmed that the new version works for your hardware.

Can I delete an old kernel if it isn't marked as "rc" ? I presume so but don't want to something that will break the system.
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 918
Joined: 2009-08-29 18:10
Location: /home/heart

Re: old linux image in /boot after upgrade to Bullseye

Postby Head_on_a_Stick » 2021-03-12 20:43

Removing old kernels should be fine. Packages are only marked "rc" if they have already been removed but their configuration file(s) remain on the system.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: old linux image in /boot after upgrade to Bullseye

Postby p.H » 2021-03-12 20:59

Head_on_a_Stick wrote:the kernel images are marked as automatically installed because they are dependencies of the metapackage

Usually, but not always.

Head_on_a_Stick wrote:The old ABI version isn't marked for automatic removal because the metapackage which pulled it in is still installed. However it wouldn't be removed even if the kernel metapackage was removed because it is no longer a dependency of that package.

With all due respect, I cannot believe you wrote this. It does not make any sense. AFAIK there is no memory of why a package was automatically installed. As soon as all dependencies are removed, the package is no longer considered needed.

The most recent kernel packages are not autoremoved because /etc/kernel/postinst.d/apt-auto-removal creates /etc/apt/apt.conf.d/01autoremove-kernels which lists them as "NeverAutoRemove".

sunrat wrote:Packages can be marked as manually installed for several reasons including if they are dependencies of other manually installed packages.

Whether a package is a dependency of other packages is irrelevant. AFAIK, a package is marked as manually installed if and only if :
- it was installed by debootstrap as part of the core system (before apt is available)
- it was manually installed
- it was marked as manually installed by the sysadmin
p.H
 
Posts: 1739
Joined: 2017-09-17 07:12

Re: old linux image in /boot after upgrade to Bullseye

Postby ticojohn » 2021-03-12 21:07

Head_on_a_Stick wrote:Removing old kernels should be fine. Packages are only marked "rc" if they have already been removed but their configuration file(s) remain on the system.

Thanks HOAS! I removed the old kernel (4.19) and then updated grub on both drives (Buster and Bullseye). Worked like a charm. Gracias amigo.
I'm not irrational, I'm just quantum probabilistic.
User avatar
ticojohn
 
Posts: 918
Joined: 2009-08-29 18:10
Location: /home/heart

Re: old linux image in /boot after upgrade to Bullseye

Postby Head_on_a_Stick » 2021-03-12 21:29

p.H wrote:The most recent kernel packages are not autoremoved because /etc/kernel/postinst.d/apt-auto-removal creates /etc/apt/apt.conf.d/01autoremove-kernels which lists them as "NeverAutoRemove".

Oh really?
Code: Select all
$ aptitude -s purge linux-image-amd64                                     
The following packages will be REMOVED: 
  linux-image-5.10.0-3-amd64{u} linux-image-amd64{p}
0 packages upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 300 MB will be freed.

Note: Using 'Simulate' mode.
Do you want to continue? [Y/n/?]
Would download/install/remove packages.
$

So removing the kernel metapackage causes autoremoval of the current linux-image package but leaves the old one still installed.

/etc/apt/apt.conf.d/01autoremove-kernels in bullseye does not list anything as "NeverAutoRemove":
Code: Select all
// DO NOT EDIT! File autogenerated by /etc/kernel/postinst.d/apt-auto-removal
APT::LastInstalledKernel "5.10.0-3-amd64";

I take it you're running buster then? :mrgreen:
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 13450
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: old linux image in /boot after upgrade to Bullseye

Postby sunrat » 2021-03-12 21:40

p.H wrote:
sunrat wrote:Packages can be marked as manually installed for several reasons including if they are dependencies of other manually installed packages.

Whether a package is a dependency of other packages is irrelevant. AFAIK, a package is marked as manually installed if and only if :
- it was installed by debootstrap as part of the core system (before apt is available)
- it was manually installed
- it was marked as manually installed by the sysadmin


How did this happen then?
Code: Select all
$ apt-mark showmanual |wc -l
1966

Code: Select all
$ apt list -i |wc -l
2999

I vaguely recall many packages being changed to manual while installing a new package. Didn't think much of it at the time. siduction system (Debian sid) installed in 2017 and regularly updated.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 3474
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Next

Return to System configuration

Who is online

Users browsing this forum: No registered users and 16 guests

fashionable