Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

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

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

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

#1 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

brian_p
Posts: 196
Joined: 2015-11-05 10:32
Has thanked: 1 time
Been thanked: 5 times

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

#2 Post by brian_p »

The present and previous images are kept. Remove old images with

Code: Select all

apt --purge autoremove
--
Brian.

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

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

#3 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

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

#4 Post by p.H »

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 ?

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

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

#5 Post by ticojohn »

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-bug ... 90683.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 am not irrational, I'm just quantum probabilistic.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

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

#6 Post by Head_on_a_Stick »

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.
deadbang

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 462 times

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

#7 Post by sunrat »

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
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

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

#8 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

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

#9 Post by Head_on_a_Stick »

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.
deadbang

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

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

#10 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

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

#11 Post by Head_on_a_Stick »

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.
deadbang

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

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

#12 Post by p.H »

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

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

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

#13 Post by ticojohn »

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 am not irrational, I'm just quantum probabilistic.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

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

#14 Post by Head_on_a_Stick »

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:
deadbang

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 462 times

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

#15 Post by sunrat »

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
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 462 times

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

#16 Post by sunrat »

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.
Oops, that's what I meant above. "full-upgrade" will overwrite and remove packages when necessary. "upgrade" won't remove packages.
autoremove will offer to remove all but the current and one kernel immediately prior to that. After upgrade has installed a new kernel. Brain wires crossed prior to morning cuppa tea. Apologies.
“ 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
zarathustra-f90
Posts: 35
Joined: 2020-10-26 14:37
Has thanked: 19 times
Been thanked: 2 times
Contact:

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

#17 Post by zarathustra-f90 »

Okay this might be a fool answer but could this be just a false entry because you need to update the grub menu with the update-grub command? It has happened to me in systems with dual boot and multiple disks :idea:

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

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

#18 Post by ticojohn »

zarathustra-f90 wrote:Okay this might be a fool answer but could this be just a false entry because you need to update the grub menu with the update-grub command? It has happened to me in systems with dual boot and multiple disks :idea:
There were multiple images in the /boot folder. I wouldn't think that update-grub would remove those old images, but maybe. In any case I followed the advice of HOAS and all is well. Will mark as [SOLVED].
I am not irrational, I'm just quantum probabilistic.

Post Reply