SOLVED Grub boot menu only shows old kernels

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
j22
Level 1
Level 1
Posts: 11
Joined: Sat May 10, 2014 12:44 pm

SOLVED Grub boot menu only shows old kernels

Post by j22 »

I recently upgraded to Mint 20.2 Mate and am on kernel 5.4.0-81-generic x86_64 which boots good. It has been a rough upgrade with several problems. I have somehow managed to mess up the Grub boot menu. I have installed the .84 and .86 versions of the 5.4 kernels and they do show in grub.cfg along with older kernels. However the grub advanced boot menu does not list them so I'm not able to select one of them. It lists 5.4.0-81, 4.4.0-210, 4.4.0-179, and 4.4.0-171. I think these 4.4 kernels are left-overs from the pre-upgrade (?). I can't see how to remove these from the advanced grub menu and replace with the newer kernels. I have ran sudo grub-update; reinstalled grub followed by grub-update. Have found a small number of topics on this forum and online dealing with somewhat similar issues but they all are cases of double (or 3+) booting different OS's and seem to involve the need to specify a single OS as primary (or something similar) . This case is not double booting - only Mint 20.2. I don't need to immediately upgrade to the -84 or -86 kernels but will have to upgrade at some future time so I need to resolve this.

Can anyone please shed light on what I need to do? If I need to post file/log information please tell me and I will do so.
Thanks much.

Addtional - I tried the Boot-Repair package but it could not address this problem
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
Grayfox
Level 4
Level 4
Posts: 333
Joined: Sun May 21, 2017 5:10 am
Location: In a hole

Re: Grub boot menu only shows old kernels

Post by Grayfox »

If you go to Start>Menu and type in "update" you should find the "Update Manager"

Select it, enter password

Once the update manager has started.
Click on "View" and select "Linux Kernels"
Image

Here you can uninstall old kernels.
Just select the version you want to uninstall.
Image

When these are removed, the system will run a update-grub in the background.

This should remove the old entries from the "Advanced Options" submenu.

I recommend keeping at least 2 kernels
Lastest(one you're using now), older one that is known to be stable(for Fallback reasons)
PC: Intel i5 6600K @4.5Ghz, 1TB NVMe SSD, 32GiB 3000Mhz DDR4, GTX1080 running Mint 21.3
Laptop: Asus UM425UAZ running LMDE 6
j22
Level 1
Level 1
Posts: 11
Joined: Sat May 10, 2014 12:44 pm

Re: Grub boot menu only shows old kernels

Post by j22 »

Regarding the Update Manager - none of the 4.4 kernels are listed in the Update Manager Kernel list. Only 5.4, 5.8, & 5.11 kernels show in Update Manager so I can't delete them that way. Sorry, I forgot to put that info in the original post.

Regarding the EFI - neither / or /boot partitions are commented out in fstab. Couldn't recall if I had EFI after a couple of years so checked - have MSI FX mother board (can't recall model #) which is set to EFI + Legacy. Only information it provides says it (automatically?) selects based on OS. Don't know how that works but anyway it has not been changed and has been working for a couple of years now.

What next? I'm short on ideas. Thanks.
User avatar
Grayfox
Level 4
Level 4
Posts: 333
Joined: Sun May 21, 2017 5:10 am
Location: In a hole

Re: Grub boot menu only shows old kernels

Post by Grayfox »

If you go to Start menu and type in Synaptic it should bring up the Synaptic Package manager

Open it, Enter Password.

In the program click on the Status Button and then select "Installed"
It will then list all packages installed on the right plane.

Scroll down and look for "Linux-Images", "Linux-Headers"
It should show the older 4.4 Kernel, if you do see Kernel 4.4 here, DO NOT UNINSTALL IT, you could cause a no boot situation.
I would wait for someone more knowable with linux to tell you if you can remove them safely.
PC: Intel i5 6600K @4.5Ghz, 1TB NVMe SSD, 32GiB 3000Mhz DDR4, GTX1080 running Mint 21.3
Laptop: Asus UM425UAZ running LMDE 6
j22
Level 1
Level 1
Posts: 11
Joined: Sat May 10, 2014 12:44 pm

Re: Grub boot menu only shows old kernels

Post by j22 »

Good thinking - I checked Synaptic and only have the 5.4, 5.8, 5.11 images and headers showing. Nothing on 4.4 kernel files.
I also ran dpkg --list | grep linux-image to list installed images and it gave

linux-image-5.4.0-74-generic 5.4.0-74.83 amd64 Signed kernel image generic
ii linux-image-5.4.0-81-generic 5.4.0-81.91 amd64 Signed kernel image generic
ii linux-image-5.4.0-84-generic 5.4.0-84.94 amd64 Signed kernel image generic
ii linux-image-5.4.0-86-generic 5.4.0-86.97 amd64 Signed kernel image generic
ii linux-image-generic 5.4.0.86.90 amd64 Generic Linux kernel image

had not seen the -74 until now but I tried running the apt-get purge and remove command for it and it could not find -74.

Thank you Greyfox for your ideas.
User avatar
Jo-con-Ël
Level 11
Level 11
Posts: 3597
Joined: Sun Jun 20, 2021 12:41 pm
Location: donde habita el olvido

Re: Grub boot menu only shows old kernels

Post by Jo-con-Ël »

About 4.4 kernels, yes, they have been left by your previuos upgrade form LM 18,3.to LM 19. Grub look for old kernels in /boot when creating boot menu entries. if they are not listed in Synaptic Pakage Manager (they are not in Ubuntu 20.4 repository and not installed in current system). Also if you have removed old kernels (5.4.0-74) partially, leaving any of their packages installed, they are not going to be offered in GRUB menu.

Post back ls /boot/*4.4.* if need help but you can remove those files from that folder and then run sudo update-grub.
Arrieritos semos y en el camino nos encontraremos.
j22
Level 1
Level 1
Posts: 11
Joined: Sat May 10, 2014 12:44 pm

Re: Grub boot menu only shows old kernels

Post by j22 »

Here is the output
john@desktop ~ $ ls /boot/*4.4.*
/boot/config-4.4.0-171old-generic /boot/System.map-4.4.0-171-generic
/boot/config-4.4.0-179old-generic /boot/System.map-4.4.0-179-generic
/boot/config-4.4.0-210-generic /boot/System.map-4.4.0-210-generic
/boot/initrd.img-4.4.0-171-generic /boot/vmlinuz-4.4.0-171-generic
/boot/initrd.img-4.4.0-179-generic /boot/vmlinuz-4.4.0-179-generic
/boot/initrd.img-4.4.0-210-generic /boot/vmlinuz-4.4.0-210-generic


Before I remove those 4.4 files, I thought I should post the boot file; because -- I just noticed that for 5.4.0-81 which is the active kernel, in /boot there is no configuration file, no system map file, no vmlinuz file for -81. These files exist for the other kernels so I'm wondering if there's an issue with 5.4.0-81 although it boots just fine. The only file for -81 I'm showing is initrd.img-5.4.0-81-generic. I do have a initrd.img file, a initrd.img.old file, vmlinuz file and a vmlinuz.old file. I don't want to create more problems than I already have. Here's boot:
Well for some reason I can't get screenshot to work to copy and paste /boot contents. I apologize. I know it's difficult to have to read a listing of files rather than see it.

ALSO now another issue - I have continued to update other files from Update Manager including a recent firmware update but now am getting error below which lists the -86 kernel. I believe this is likely related issue but may require different topic posting. Let's try to resolve the original issue/topic first. I only point it out for information purposes.
Errors were encountered while processing:
linux-firmware
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up linux-firmware (1.187.17) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-86-generic
I: The initramfs will attempt to resume from /dev/sda5
I: (UUID=c6c71940-93aa-4a16-bdb4-0ad4e807ab96)
I: Set the RESUME variable to override this.
Error 24 : Write error : cannot write compressed block
cpio: write error: Broken pipe
E: mkinitramfs failure cpio 2 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-86-generic with 1.
dpkg: error processing package linux-firmware (--configure):
installed linux-firmware package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-firmware
User avatar
Jo-con-Ël
Level 11
Level 11
Posts: 3597
Joined: Sun Jun 20, 2021 12:41 pm
Location: donde habita el olvido

Re: Grub boot menu only shows old kernels

Post by Jo-con-Ël »

You can ensure the kernel you are booting with uname -r . Most sure you will need to purge those 5.4.0-84 and 5.4.0-86 kenels and try to reinstall again. In any case this has nothing to be with 4.4. kenels.You'd better not try to boot with them and remove ASAP.

Be sure there is no problem with free space in your root partion (post back inxi -P result) causing kernel instalation fails and also your disk is not about to fail (Menu>Accessories>Disks select your disk on the left and see health status on the right).

You can post back codes result using </> code option upside in Mint forums editor (look here detalied intructions) and also include screen shots in your post using Attachtments option downside>Add files, navigate to the image in your PC>select and clic on Open (look here for tips)
Last edited by Jo-con-Ël on Tue Oct 19, 2021 2:39 am, edited 1 time in total.
Arrieritos semos y en el camino nos encontraremos.
j22
Level 1
Level 1
Posts: 11
Joined: Sat May 10, 2014 12:44 pm

Re: Grub boot menu only shows old kernels

Post by j22 »

First my apologies to Jo-con-El, Greyfox, jacobhenry174 and others for my absence and delay in responding. Work issues demanded my full attention for many days and I just couldn't get back to this.

During this interim period, other strange behavior has continued - for example, click to open web browser and two instances open maybe every 1 out of 3 times. As mentioned above, sometimes the copy/paste function of screenshot doesn't work - other times it does. I came to the conclusion I needed to wipe and format the root partition and reinstall Mint. Before I had time to do that, my screens had some glitches so I did a reboot and some boot error dumped into the grub-rescue prompt.

Looking to resolve that issue I found http://help.ubuntu.com/community/Grub2/ ... ia_Chroot. Following those instructions and rebooting, a normal boot resulted but I found that it also resolved the topic of this thread -- the grub advanced menu no longer lists old kernels; the grub.cfg file no longer lists old kernels. I now have the .86 kernel active and the .84 kernel installed. Both show in the grub advanced menu. The .81 kernel does show in synaptic but not in the menu and not in grub.cfg. I had previously reinstalled grub without success but this reinstall made a difference for unknown reasons.

OH - one other thing, the grub boot menu now lists ubuntu 20.2 (? It's 20.x - not sure if it's '2') rather than Mint 20.2. So for a day now the system has been rock solid with no glitches. (Why?) For now I will mark this thread as SOLVED. Thanks to all who offer help.
Locked

Return to “Installation & Boot”