apt autoremove updates grub?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
Cap
Level 2
Level 2
Posts: 97
Joined: Sat Dec 21, 2019 8:56 pm

apt autoremove updates grub?

Post by Cap »

When using apt-get remove it lists,

Code: Select all

The following packages were automatically installed and are no longer required:
  linux-headers-5.3.0-46 linux-headers-5.3.0-46-generic linux-headers-5.3.0-51
  linux-headers-5.3.0-51-generic linux-headers-5.3.0-53
  linux-headers-5.3.0-53-generic linux-headers-5.3.0-59
  linux-headers-5.3.0-59-generic linux-image-5.3.0-46-generic
  linux-image-5.3.0-51-generic linux-image-5.3.0-53-generic
  linux-image-5.3.0-59-generic linux-modules-5.3.0-46-generic
  linux-modules-5.3.0-51-generic linux-modules-5.3.0-53-generic
  linux-modules-5.3.0-59-generic linux-modules-extra-5.3.0-46-generic
  linux-modules-extra-5.3.0-51-generic linux-modules-extra-5.3.0-53-generic
  linux-modules-extra-5.3.0-59-generic
Use 'sudo apt autoremove' to remove them.
I typed sudo apt autoremove. I expect this only to remove the no longer required files however it outputs many lines such as,

Code: Select all

/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.3.0-46-generic
/etc/kernel/postrm.d/zz-update-grub:

Generating grub configuration file ...

Adding boot menu entry for EFI firmware configuration
done

File descriptor 10 (/var/lib/dpkg/triggers/linux-update-5.3.0-46-generic (deleted)) leaked on lvs invocation. Parent PID 7235: /bin/sh
Adding boot menu entry for EFI firmware configuration
Why is it changing the boot menu and grub? Is it normal?
User avatar
Kadaitcha Man
Level 11
Level 11
Posts: 3649
Joined: Mon Aug 27, 2012 10:17 pm

Re: apt autoremove updates grub?

Post by Kadaitcha Man »

Cap wrote:
Sat Jul 11, 2020 9:41 pm
Why is it changing the boot menu and grub? Is it normal?
apt autoremove removes, amongst other things, old kernels, so this obviously affects grub because grub is used to select older kernels, hence if an old kernel is removed, grub must be updated otherwise you'd have a grub that was configured for kernels that no longer exist.
Coming to a thread near you: Lots of bragging about my AMD 5950X. Currently delayed due to high demand.
It's pronounced kad-eye-cha, not kada-itcha.
Cap
Level 2
Level 2
Posts: 97
Joined: Sat Dec 21, 2019 8:56 pm

Re: apt autoremove updates grub?

Post by Cap »

Kadaitcha Man wrote:
Sat Jul 11, 2020 9:52 pm
apt autoremove removes, amongst other things, old kernels, so this obviously affects grub because grub is used to select older kernels, hence if an old kernel is removed, grub must be updated otherwise you'd have a grub that was configured for kernels that no longer exist.
It was a mistake. I thought it was deleting unused temporary files left over from an update install process.

Does that mean I have removed all kernels other than the most new kernel?
User avatar
Kadaitcha Man
Level 11
Level 11
Posts: 3649
Joined: Mon Aug 27, 2012 10:17 pm

Re: apt autoremove updates grub?

Post by Kadaitcha Man »

Cap wrote:
Sat Jul 11, 2020 10:29 pm
Does that mean I have removed all kernels other than the most new kernel?
You'd have to check the output of ls on your boot directory. I can't recall for certain if it keeps one older kernel or keeps only the most recent kernel. I can't tell you for sure because I've just this minute finished a clean install so I have nothing to remove for testing it for you.
Coming to a thread near you: Lots of bragging about my AMD 5950X. Currently delayed due to high demand.
It's pronounced kad-eye-cha, not kada-itcha.
User avatar
all41
Level 16
Level 16
Posts: 6656
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: apt autoremove updates grub?

Post by all41 »

I believe apt doesn't remove kernels that have been manually added.

You can just add those puppies back using Update Manager--toolbar/Tools/Linux kernels.
Click on the one you want and choose install. This also will update grub automatically.
Grub will by default boot to the highest installed kernel number.
Light travels faster than sound. That's why some people appear smart until you hear what they are saying.
You will seldom see a grey-beard wearing a tinfoil hat.
Cap
Level 2
Level 2
Posts: 97
Joined: Sat Dec 21, 2019 8:56 pm

Re: apt autoremove updates grub?

Post by Cap »

Thank you
Post Reply

Return to “Newbie Questions”