Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] GRUB won't boot after upgrade
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
saturnalia0
Apprentice
Apprentice


Joined: 13 Oct 2016
Posts: 159

PostPosted: Sat Feb 17, 2024 2:40 pm    Post subject: [SOLVED] GRUB won't boot after upgrade Reply with quote

I've just upgraded sys-kernel/gentoo-sources from 6.1 to 6.6, I don't remember the minors but I always go with what Portage gives me and I synced today. There was also an nvidia-drivers upgrade there (I was upgrading my world set).

I've installed it as usual, i.e.

Code:

cd /usr/src
cp linux/.config ~/`uname -r`.config
eselect set kernel 2
cd linux
make oldconfig
make modules_prepare
make -j4
emerge --ask @module-rebuild
make modules_install
make install
grub-mkconfig -o /boot/grub/grub.cfg
reboot


After I issued `reboot` it never booted again. There were no warning or errors during the kernel/grub install (I was looking).

I can see the GRUB splash screen saying "Welcome to GRUB!" and instantly fading (seems to reboot at that point).

I am using UEFI.

Usually I would be able to see the GRUB menu with the kernel list and would be able to select the old one if the new one broke somehow, but this time the menu doesn't seem to load (PC seems to reboot before that). I have tried pressing ESC frantically to get the menu to show, to no avail.

I eventually booted onto Windows which is on a separate SSD and has its own bootloader which is working fine, that's where I'm posting from.

Any ideas on how to debug or otherwise recover the system?

I suppose getting myself a LiveUSB and mounting /boot to inspect would be the next logical step? What should I look for, then?

PS: I mostly went with the defaults for `make oldconfig` and don't recall any significant config changes (I had CONFIG_HID=y and went with the default for HID_SUPPORT=y, and so on, shouldn't have had any changes from that upgrade).


Last edited by saturnalia0 on Sun Feb 18, 2024 1:38 pm; edited 1 time in total
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5196
Location: Bavaria

PostPosted: Sat Feb 17, 2024 2:46 pm    Post subject: Reply with quote

Please re-install grub as noted in the news: 2024-02-01-grub-upgrades
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
saturnalia0
Apprentice
Apprentice


Joined: 13 Oct 2016
Posts: 159

PostPosted: Sat Feb 17, 2024 7:34 pm    Post subject: Reply with quote

Ah... Just to make sure I don't mess things up, where should I install it to? I'm using UEFI. Output from a Debian Live USB:

Code:

$ fidsk -l

Disk /dev/sda: 111.8 GiB, 120040980480 bytes, 234455040 sectors
Disk model: SanDisk SSD PLUS
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D2C2B69E-90A1-4503-86FE-8181A6F86724

Device      Start       End   Sectors   Size Type
/dev/sda1    2048    501759    499712   244M EFI System
/dev/sda2  501760 234452991 233951232 111.6G Linux filesystem


Code:

$ mount /dev/sda1 /mnt
$ find /mnt | grep -ve Microsoft
/mnt/EFI
/mnt/EFI/gentoo
/mnt/EFI/gentoo/grubx64.efi
/mnt/EFI/Boot
/mnt/EFI/Boot/bootx64.efi


Code:

$ umount /mnt
$ mount /dev/sda2 /mnt
$ ls /mnt/boot
config-6.1.31-gentoo
config-6.1.38-gentoo
config-6.1.41-gentoo
config-6.1.41-gentoo.old
config-6.1.46-gentoo
config-6.1.53-gentoo-r1
config-6.1.57-gentoo
config-6.1.67-gentoo
config-6.6.13-gentoo
efi
grub
System.map-6.1.31-gentoo
System.map-6.1.38-gentoo
System.map-6.1.41-gentoo
System.map-6.1.41-gentoo.old
System.map-6.1.46-gentoo
System.map-6.1.53-gentoo-r1
System.map-6.1.57-gentoo
System.map-6.1.67-gentoo
System.map-6.6.13-gentoo
vmlinuz-6.1.31-gentoo
vmlinuz-6.1.38-gentoo
vmlinuz-6.1.41-gentoo
vmlinuz-6.1.41-gentoo.old
vmlinuz-6.1.46-gentoo
vmlinuz-6.1.53-gentoo-r1
vmlinuz-6.1.57-gentoo
vmlinuz-6.1.67-gentoo
vmlinuz-6.6.13-gentoo


To be honest I don't remember why I have that partitioning schema, quite possibly a mess up during install years ago.

So to re-install grub I suppose it should be something like below?

Code:

$ mount /dev/sda1 /mnt/sda1
$ mount /dev/sda2 /mnt/sda2
$ grub-install --root-directory=/mnt/sda2 --efi-directory=/mnt/sda1
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5196
Location: Bavaria

PostPosted: Sat Feb 17, 2024 8:44 pm    Post subject: Reply with quote

saturnalia0 wrote:
So to re-install grub I suppose it should be something like below?

No.

You must install the Gentoo grub; for this you must chroot into your Gentoo installation -> The same way you do when installing a new Gentoo:

Code:
- boot with Gentoo amd64-minimal CD (or what you like; it must be a UEFI capable LiveCD)
# clear
# mount /dev/sda2 /mnt/gentoo
# cd /mnt/gentoo
# mount -t proc /proc /mnt/gentoo/proc
# mount --rbind /sys /mnt/gentoo/sys
# mount --rbind /dev /mnt/gentoo/dev
# mount --bind /run /mnt/gentoo/run
# chroot /mnt/gentoo /bin/bash
# . /etc/profile
# mount /dev/sda1 /boot
# grub-install --efi-directory=/boot
# grub-mkconfig  -o /boot/grub/grub.cfg
# exit
->  umount all and reboot

_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
figueroa
Advocate
Advocate


Joined: 14 Aug 2005
Posts: 3007
Location: Edge of marsh USA

PostPosted: Sat Feb 17, 2024 9:44 pm    Post subject: Reply with quote

saturnalia0
I suggest that the word GRUB be added to the title of the top forum post in this thread.
_________________
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
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 506

PostPosted: Sun Feb 18, 2024 9:14 am    Post subject: Reply with quote

The ESP is mounted to "/boot/efi" and not to "/boot".

So mount your Gentoo system root partition to /mnt and prepare the chroot. Then chroot into your Gentoo installation and mount /dev/sda1 to /boot/efi.

Then you can install Grub again:

Code:
# the --target option is probably not necessary
grub-install --target=x86_64-efi

and recreate the grub.cfg.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 5196
Location: Bavaria

PostPosted: Sun Feb 18, 2024 11:08 am    Post subject: Reply with quote

sMueggli wrote:
The ESP is mounted to "/boot/efi" and not to "/boot".

You are right; I have overlooked it. :oops:

The default for --target is "x86_64-efi"; so it is not necessary to specify it.

But I think it is necessary to specify --efi-directory
I think this would be the correct path:
Code:
- boot with Gentoo amd64-minimal CD (or what you like; it must be a UEFI capable LiveCD)
# clear
# mount /dev/sda2 /mnt/gentoo
# cd /mnt/gentoo
# mount -t proc /proc /mnt/gentoo/proc
# mount --rbind /sys /mnt/gentoo/sys
# mount --rbind /dev /mnt/gentoo/dev
# mount --bind /run /mnt/gentoo/run
# chroot /mnt/gentoo /bin/bash
# . /etc/profile
# mount /dev/sda1 /boot/efi
# grub-install --efi-directory=/boot/efi
# grub-mkconfig  -o /boot/grub/grub.cfg
# exit
->  umount all and reboot

_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2477

PostPosted: Sun Feb 18, 2024 12:49 pm    Post subject: Reply with quote

pietinger wrote:
sMueggli wrote:
The ESP is mounted to "/boot/efi" and not to "/boot".

You are right; I have overlooked it. :oops:

The default for --target is "x86_64-efi"; so it is not necessary to specify it.

But I think it is necessary to specify --efi-directory


It's not necessary in this case as /boot/efi is the default but it wont' hurt. Just tested it yesterday and verified it indeed reinstalled grub in /boot/efi/EFI/gentoo.

One thing that annoys me is grub always sets itself as the first choice in EFI boot menu.

Best Regards,
Georgi
Back to top
View user's profile Send private message
saturnalia0
Apprentice
Apprentice


Joined: 13 Oct 2016
Posts: 159

PostPosted: Sun Feb 18, 2024 1:37 pm    Post subject: Reply with quote

Solved by re-installing GRUB from Gentoo LiveCD as per @pietinger's instructions above.

Thank you all for the guidance. I shall grub-install after upgrading in the future to avoid the issue in the first place.

OBS: Having only Windows available to flash the minimal install image to an USB I couldn't make it work using Rufus nor the other software recommended by the Gentoo wiki. I ended up using a "balena etcher". Kinda off-topic here but I'll start a discussion on the Gentoo wiki page.

PS: Rufus only works for UEFI if one selects "dd mode", otherwise GRUB gives "unknown filesystem". I've added a note on the Gentoo Wiki. Ref: https://github.com/pbatard/rufus/issues/2127


Last edited by saturnalia0 on Sun Feb 18, 2024 2:48 pm; edited 1 time in total
Back to top
View user's profile Send private message
saturnalia0
Apprentice
Apprentice


Joined: 13 Oct 2016
Posts: 159

PostPosted: Sun Feb 18, 2024 1:38 pm    Post subject: Reply with quote

figueroa wrote:
saturnalia0
I suggest that the word GRUB be added to the title of the top forum post in this thread.


char limit, but I edited it to mention grub instead of the kernel version, + SOLVED
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 506

PostPosted: Sun Feb 18, 2024 4:20 pm    Post subject: Reply with quote

logrusx wrote:
One thing that annoys me is grub always sets itself as the first choice in EFI boot menu.


You want to install with

Code:
grub-install --no-nvram
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
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