View previous topic :: View next topic |
Author |
Message |
Jimmy2027 n00b
Joined: 12 May 2020 Posts: 46
|
Posted: Sun Mar 31, 2024 10:23 am Post subject: Unable to make grub load a new kernel |
|
|
I installed the new distribution kernel "linux-6.8.2-gentoo-dist" and was thinking that having "sys-kernel/installkernel" installed with grub USE flag should be enough to update grub and be done with it.
While the new configuration is generated in /boot, and the gubr.cfg looks updated, when rebooting the grub menu only gives the option of an old kernel: linux-6.5.5.
My /boot after installation of the new kernel can be seen here.
Thinking that the mess in the folder might be the issue, I cleaned it up to this, but the issue persisted (grub only showing 6.5.5).
The boot log from dmesg shows me "BOOT_IMAGE=/boot/vmlinuz-6.5.5-gentoo-x86_64" which doesn't exist anymore..
This makes me think that I'm actually looking at the wrong /boot but I don't see how that is possible.
My fstab should be fine and gives me the right partition:
Quote: | /dev/nvme0n1p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
|
The output of is: Quote: | # efibootmgr
BootCurrent: 0003
Timeout: 2 seconds
BootOrder: 0003,2001,2002,2003
Boot0001* Windows Boot Manager HD(2,GPT,0c8c2351-8b0a-4d79-ae71-a53c6b3a380f,0xa00800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC
Boot0002* EFI PXE 0 for IPv4 (3C-18-A0-5A-57-CF) PciRoot(0x0)/Pci(0xd,0x0)/USB(2,0)/MAC(3c18a05a57cf,0)/IPv4(0.0.0.00.0.0.0,0,0)RC
Boot0003* gentoo HD(1,GPT,e571ca75-5b03-9048-b277-627c7ff4d8d9,0x800,0x200000)/File(\EFI\gentoo\grubx64.efi)
Boot0004* Windows Boot Manager HD(2,GPT,0c8c2351-8b0a-4d79-ae71-a53c6b3a380f,0xa00800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000011110100000010000000040000007fff0400
Boot2001* EFI USB Device RC
Boot2002* EFI DVD/CDROM RC
Boot2003* EFI Network RC
|
Does someone know what the issue could be?
[Moderator edit: broke long whitespace-free lines in quote tags to fix thread layout. -Hu] |
|
Back to top |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9815 Location: almost Mile High in the USA
|
Posted: Sun Mar 31, 2024 2:52 pm Post subject: |
|
|
I thought the grub config file is in /boot/grub/grub.cfg -- Are you checking the right location?
I also am not sure how you're installing grub, at least this is where I have my grub.cfg on my ESP which is mounted at /boot ... _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
Jimmy2027 n00b
Joined: 12 May 2020 Posts: 46
|
Posted: Sun Mar 31, 2024 2:59 pm Post subject: |
|
|
I have =sys-boot/grub-2.12-r2 installed.
My grub config file is indeed in /boot/grub/grub.cfg, I was referring to the following files that are generated in /boot:
- config-6.8.2-gentoo-dist
- initramfs-6.8.2-gentoo-dist.img
- System.map-6.8.2-gentoo-dist
- vmlinuz-6.8.2-gentoo-dist |
|
Back to top |
|
|
figueroa Advocate
Joined: 14 Aug 2005 Posts: 3005 Location: Edge of marsh USA
|
Posted: Tue Apr 02, 2024 3:49 am Post subject: |
|
|
It sounds like you may be installing the kernel and updating GRUB with the /boot partition not mounted. Use df to ensure the /boot partition is mounted and if not mount it and do it again. _________________ Andy Figueroa
hp pavilion hpe h8-1260t/2AB5; spinning rust x3
i7-2600 @ 3.40GHz; 16 gb; Radeon HD 7570
amd64/23.0/split-usr/desktop (stable), OpenRC, -systemd -pulseaudio -uefi |
|
Back to top |
|
|
Jimmy2027 n00b
Joined: 12 May 2020 Posts: 46
|
Posted: Tue Apr 02, 2024 7:04 am Post subject: |
|
|
Code: | df -h | grep --color=auto /boot |
gives me
Quote: | /dev/nvme0n1p1 1022M 80M 943M 8% /boot
|
so that should be fine |
|
Back to top |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9815 Location: almost Mile High in the USA
|
Posted: Tue Apr 02, 2024 7:09 am Post subject: |
|
|
When you run grub-mkconfig does it list your (old and) new kernels? _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
Jimmy2027 n00b
Joined: 12 May 2020 Posts: 46
|
Posted: Tue Apr 02, 2024 8:16 am Post subject: |
|
|
only the new ones:
Code: | grub-mkconfig -o /boot/grub/grub.cfg |
Quote: | Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.8.2-gentoo-dist
Found initrd image: /boot/initramfs-6.8.2-gentoo-dist.img
Found linux image: /boot/vmlinuz-6.8.2-gentoo-dist.old
Found initrd image: /boot/initramfs-6.8.2-gentoo-dist.img.old
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
|
|
|
Back to top |
|
|
Jimmy2027 n00b
Joined: 12 May 2020 Posts: 46
|
Posted: Fri Apr 05, 2024 6:03 am Post subject: |
|
|
Since apparently installing grub with the --removeable flag fixes some issue I tried to run:
Code: | grub-install --target=x86_64-efi --efi-directory=/boot/EFI --removable |
and then
Code: | grub-mkconfig -o /boot/grub/grub.cfg |
but that did no help either |
|
Back to top |
|
|
Adarion Tux's lil' helper
Joined: 22 Aug 2005 Posts: 78
|
Posted: Fri Apr 05, 2024 3:01 pm Post subject: |
|
|
=sys-boot/grub-2.12-r2 seems to be quite some trouble. I do classic (non-UEFI-style) booting here and it locked me nearly out of the system (got weird errors at boot (kernel load) and things got stuck there) until I downgraded to 2.06-r9.
As of now (today?) there seems to be a Gentoo-patched revision 2.12-r3 to be in portage. Maybe this fixes something. But GRUB breakage is very nasty. _________________ stop tcpa, swpatents, corrupt politicians and other scary stuff |
|
Back to top |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9815 Location: almost Mile High in the USA
|
Posted: Fri Apr 05, 2024 6:52 pm Post subject: |
|
|
grub 2.12 seems to work fine for efi sorta though I ran into the setup problem. When I upgraded 2.06 to 2.12 I kept getting stuck in firmware setup. However after re-grub-install on my boot disk(s) everything went back to normal.
Seems the Gentoo devs are requesting a change to grub such that if you used the 2.12 grub-mkconfig for grub 2.06 EFI binary, it won't do this anymore... we'll see... _________________ Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
Jimmy2027 n00b
Joined: 12 May 2020 Posts: 46
|
Posted: Tue May 07, 2024 7:07 am Post subject: |
|
|
I finally had some time to look into this again.
I tried to unmount /boot, and surprise surprise: I found the kernel that grub is loading under /boot.
So now I need to find out what is telling grub to load the kernel from Quote: | /dev/nvme0n1p3/boot | instead of Quote: | /dev/nvme0n1p1/boot | . |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22578
|
Posted: Tue May 07, 2024 12:15 pm Post subject: |
|
|
Grub gets the kernel from wherever the Grub configuration tells it to go. I think your next step then is to find which grub configuration is actually being read at boot, as that is the one that needs to be adjusted to update what kernel you use. Find all instances of valid grub configurations on your system, including those hidden under other mountpoints. If more than one is found, identify which one is active. |
|
Back to top |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1674 Location: South America
|
Posted: Tue May 07, 2024 12:52 pm Post subject: |
|
|
Is there also a /boot/grub subdirectory when /dev/nvme0n1p1 is unmounted? _________________
NeddySeagoon wrote: | I'm not a witch, I'm a retired electronics engineer |
Ionen wrote: | As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though |
|
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54575 Location: 56N 3W
|
Posted: Tue May 07, 2024 1:15 pm Post subject: |
|
|
Jimmy2027,
It all starts with the EFI firmware. efibootmgr will tell where grub.efi is
Code: | $ efibootmgr
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0001,0002,0003,0004
Boot0000* SYSLINUX HD(1,GPT,43ac34f1-f058-49ec-893e-151332733d0f,0x800,0x1e800)/File(\EFI\SYSLINUX\SYSLINUX.EFI)
Boot0001* UEFI OS HD(1,GPT,43ac34f1-f058-49ec-893e-151332733d0f,0x800,0x1e800)/File(\EFI\BOOT\BOOTX64.EFI)0000424f
Boot0002* UEFI:CD/DVD Drive BBS(129,,0x0)
Boot0003* UEFI:Removable Device BBS(130,,0x0)
Boot0004* UEFI:Network Device BBS(131,,0x0) |
In my case, I use syslinux, not grub, but its the same idea.
The EFI\BOOT\BOOTX64.EFI is a hard coded fallback. I have a very old EFI stub kernel there.
If you have several EFI system partitions, you can hove several grub.efi files. Don't do that it will make you head hurt.
The grub.efi knows where to load the rest of grub from. That was fixed when you installed that instance of grub.
Each grub instance will have its own grub.cfg file too.
As the kernel is not loaded, there can be no kernel filesystem tree when grub runs. Boot loaders must make their own arrangements to load the files to boot the system.
The kernel filesystem tree is used for updates only. Its the admins job to make sure that the two are aligned. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
Jimmy2027 n00b
Joined: 12 May 2020 Posts: 46
|
Posted: Tue May 07, 2024 5:18 pm Post subject: |
|
|
there is a /boot/grub directory when /dev/nvme0n1p1 is unmounted. It contains the grub.cfg that corresponds to the one I see when booting.
It also contains a grub.efi.
gives the same return with nvme0n1p1 mounted and without.
So it seems I have grub installed in two places, who chooses which one is selected?
Can I delete the one from /dev/nvme0n1p3/boot and efi+grub will find the one under /dev/nvme0n1p1/boot? |
|
Back to top |
|
|
pietinger Moderator
Joined: 17 Oct 2006 Posts: 5037 Location: Bavaria
|
Posted: Tue May 07, 2024 5:33 pm Post subject: |
|
|
Jimmy2027 wrote: | [...]Can I delete the one from /dev/nvme0n1p3/boot and efi+grub will find the one under /dev/nvme0n1p1/boot? |
Yes ... IF you do a grub-install ...
Best would be:
1. Delete both
2. Decide where you want to have grub and mount or dont mount /boot (or mount /efi; see 3.)
3. Do a "grub-install --efi-directory=/efi" OR a "grub-install --efi-directory=/boot" depending if you have an old installation or a new one.
https://forums.gentoo.org/viewtopic-t-1165115-highlight-.html explains why you will find today this in our Handbook:
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Bootloader#UEFI_systems
4. Do a "grub-mkconfig -o /boot/grub/grub.cfg"
5. Reboot
6. Check with "efibootmgr" if you have old entries (usually most (all?) UEFI deletes automatically at system start an entry pointing to a no valid/non existant binary). _________________ https://wiki.gentoo.org/wiki/User:Pietinger |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54575 Location: 56N 3W
|
Posted: Tue May 07, 2024 5:33 pm Post subject: |
|
|
Jimmy2027,
grub itself can be on only filesystem that grub understands.
Te be useful, grub.efi must be in the ./EFI directory os the EFI System Partition that must be formatted vfat.
The vfat requirement is due to it being the only filesystem that EFI firmware can read.
efibootmgr and wow grub was installed determine which install will be used.
Show usfor the two cases where /dev/nvme0n1p1 is mounted and unmounted.
The output of will be useful too. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
Jimmy2027 n00b
Joined: 12 May 2020 Posts: 46
|
Posted: Tue May 07, 2024 5:46 pm Post subject: |
|
|
This is the output with /dev/nvme0n1p1 mounted:
Code: | $ df -hT
Filesystem Type Size Used Avail Use% Mounted on
none tmpfs 16G 2.2M 16G 1% /run
udev devtmpfs 10M 0 10M 0% /dev
tmpfs tmpfs 16G 215M 16G 2% /dev/shm
/dev/nvme0n1p3 xfs 1.8T 578G 1.2T 33% /
efivarfs efivarfs 268K 107K 157K 41% /sys/firmware/efi/efivars
tmpfs tmpfs 3.2G 16K 3.2G 1% /run/user/1000
/dev/nvme0n1p1 vfat 1022M 252M 771M 25% /boot |
Here it is unmounted:
Code: | $ df -hT
Filesystem Type Size Used Avail Use% Mounted on
none tmpfs 16G 2.2M 16G 1% /run
udev devtmpfs 10M 0 10M 0% /dev
tmpfs tmpfs 16G 224M 16G 2% /dev/shm
/dev/nvme0n1p3 xfs 1.8T 578G 1.2T 33% /
efivarfs efivarfs 268K 107K 157K 41% /sys/firmware/efi/efivars
tmpfs tmpfs 3.2G 16K 3.2G 1% /run/user/1000
|
efibootmgr gives this:
Code: | $ efibootmgr
BootCurrent: 0003
Timeout: 2 seconds
BootOrder: 0003,2001,2002,2003
Boot0001* Windows Boot Manager HD(2,GPT,0c8c2351-8b0a-4d79-ae71-a53c6b3a380f,0xa00800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC
Boot0002* EFI PXE 0 for IPv4 (3C-18-A0-5A-57-CF) PciRoot(0x0)/Pci(0xd,0x0)/USB(2,0)/MAC(3c18a05a57cf,0)/IPv4(0.0.0.00.0.0.0,0,0)RC
Boot0003* gentoo HD(1,GPT,e571ca75-5b03-9048-b277-627c7ff4d8d9,0x800,0x200000)/File(\EFI\gentoo\grubx64.efi)
Boot0004* Windows Boot Manager HD(2,GPT,0c8c2351-8b0a-4d79-ae71-a53c6b3a380f,0xa00800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000011110100000010000000040000007fff0400
Boot2001* EFI USB Device RC
Boot2002* EFI DVD/CDROM RC
Boot2003* EFI Network RC
|
I think I will follow the advice of @pietinger and delete both grub installations and re-install it (probably in the legacy way first), after having run a backup over the night. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54575 Location: 56N 3W
|
Posted: Tue May 07, 2024 6:45 pm Post subject: |
|
|
Jimmy2027,
This is your EFI System Partition.
Code: | /dev/nvme0n1p1 vfat 1022M 252M 771M 25% /boot | Your EFI firmware loads things from here.
Code: | efibootmgr
BootCurrent: 0003
Timeout: 2 seconds
BootOrder: 0003,2001,2002,2003
Boot0001* Windows Boot Manager HD(2,GPT,0c8c2351-8b0a-4d79-ae71-a53c6b3a380f,0xa00800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC
Boot0002* EFI PXE 0 for IPv4 (3C-18-A0-5A-57-CF) PciRoot(0x0)/Pci(0xd,0x0)/USB(2,0)/MAC(3c18a05a57cf,0)/IPv4(0.0.0.00.0.0.0,0,0)RC
Boot0003* gentoo HD(1,GPT,e571ca75-5b03-9048-b277-627c7ff4d8d9,0x800,0x200000)/File(\EFI\gentoo\grubx64.efi) |
Windows and Gentoo are on different drives
Code: | Boot0001* Windows Boot Manager HD(2,
Boot0003* gentoo HD(1, |
That's OK but it means changing the boot order to start Windows. Grub can do that if you want, then Windows is an option in the grub boot menu.
If its not broken, don't fix it. :)
The grub.efi that is in use is loaded from Code: | /dev/nvme0n1p1/EFI/gentoo/grubx64.efi |
The rest of grub, the kernels and initrds can be installed anywhere. That location is determined when you install grub.
Traditionally the EFI System Partition would be mounted at /boot/EFI, not /boot, which is why the content of /boot is hidden when /dev/nvme0n1p1 is mounted to /boot.
However that puts grubx64.efi at Code: | /boot/EFI/EFI/gentoo/grubx64.efi | which looks untidy.
pietingers suggestion will have you reaching for your boot media if you end up with grub in a mess.
If you mount your EFI System Partition somewhere where it does not hide /boot, /EFI is the new way, you can have a look round and ensure you understand things before you delete anything. Your system sill won't boot if grub is in a mess.
You should rebuild and reinstall grub anyway. There has been some recent breaking changes, whereby its not possible to mix bits from old and new grub. As we can't be sure to avoid that, the rebuild is safe. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
Jimmy2027 n00b
Joined: 12 May 2020 Posts: 46
|
Posted: Thu May 09, 2024 3:37 pm Post subject: |
|
|
I followed the steps that pietingers described and it worked, I also re-emerged the distribution kernel after deleting both directories.
Thanks a lot for your help pietingers and NeddySeagoon!
I'm mounting the efi system partition under /efi now.
efibootmgr now gives me this:
Code: | $ efibootmgr
BootCurrent: 0000
Timeout: 2 seconds
BootOrder: 0000,2001,2002,2003
Boot0000* gentoo HD(1,GPT,e571ca75-5b03-9048-b277-627c7ff4d8d9,0x800,0x200000)/File(\EFI\gentoo\grubx64.efi)
Boot0001* Windows Boot Manager HD(2,GPT,0c8c2351-8b0a-4d79-ae71-a53c6b3a380f,0xa00800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC
Boot0002* EFI PXE 0 for IPv4 (3C-18-A0-5A-57-CF) PciRoot(0x0)/Pci(0xd,0x0)/USB(2,0)/MAC(3c18a05a57cf,0)/IPv4(0.0.0.00.0.0.0,0,0)RC
Boot0004* Windows Boot Manager HD(2,GPT,0c8c2351-8b0a-4d79-ae71-a53c6b3a380f,0xa00800,0x82000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)57494e444f5753000100000088000000780000004200430044004f0042004a004500430054003d007b00390064006500610038003600320063002d0035006300640064002d0034006500370030002d0061006300630031002d006600330032006200330034003400640034003700390035007d00000011110100000010000000040000007fff0400
Boot2001* EFI USB Device RC
Boot2002* EFI DVD/CDROM RC
Boot2003* EFI Network RC
|
I don't know where the windows entries come from, I never had windows on this machine but as you said, it works so I won't touch it for now |
|
Back to top |
|
|
pietinger Moderator
Joined: 17 Oct 2006 Posts: 5037 Location: Bavaria
|
Posted: Thu May 09, 2024 4:26 pm Post subject: |
|
|
Jimmy2027 wrote: | I followed the steps that pietingers described and it worked, I also re-emerged the distribution kernel after deleting both directories.
Thanks a lot for your help pietingers and NeddySeagoon! |
Glad to hear that ... and you are very Welcome !
Have fun with Gentoo ! _________________ https://wiki.gentoo.org/wiki/User:Pietinger |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|