apt autoremove updates grub?

Quick to answer questions about finding your way around Linux Mint as a new user.
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. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
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?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Moonstone Man
Level 16
Level 16
Posts: 6054
Joined: Mon Aug 27, 2012 10:17 pm

Re: apt autoremove updates grub?

Post by Moonstone 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.
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 pmapt 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?
Moonstone Man
Level 16
Level 16
Posts: 6054
Joined: Mon Aug 27, 2012 10:17 pm

Re: apt autoremove updates grub?

Post by Moonstone 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.
User avatar
all41
Level 19
Level 19
Posts: 9523
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.
Everything in life was difficult before it became easy.
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
DB [NOT Cooper]
Level 1
Level 1
Posts: 48
Joined: Thu Aug 06, 2020 8:34 pm

Re: apt autoremove updates grub?

Post by DB [NOT Cooper] »

Having just verified the last Kernel update didn't seem to break anything, I ran apt autoremove in Tricia (19.3). I can confirm it leaves the previous Kernel intact.

Moving on to post my own question....
DB
Locked

Return to “Beginner Questions”