GRUB 2 "stuck" on particular boot option

3

I just installed a system with openSUSE 13.1 using a btrfs root and made the mistake of picking Windows in the reboot dropdown in KDE. Now grub seems to load Windows automatically every time instead of only once like it should. In other words, grub does load (and shows a few quick status messages), but it skips straight to the Windows option on every boot.

Grub does mention that it's loading the config file and doesn't show any errors, so I'm fairly confident it wasn't overwritten or anything funny like that. I also keep Windows installed on a separate disk to avoid any issues with my bootloader randomly getting nuked from Windows updates.

Before I give up and reinstall the bootloader, is there any way to manually undo whatever grub2-reboot (or whichever utility the menu uses) made to my configuration? I'm still able to mount the partitions on the disk fine from a live environment, and should be able to chroot in to do any updates needed.

Edit: fixed via a chroot from a live disk by executing the following:

grub2-editenv /boot/grub2/grubenv unset next_entry

timothyb89

Posted 2013-12-31T03:51:13.697

Reputation: 71

Answers

1

After examining the source of the /usr/sbin/grub2-reboot script I found that the boot selection was handled by a "next_entry" variable in the grubenv file.

The issue could be seen by running (while chroot'd into the system) grub2-editenv list, which showed:

saved_entry=openSUSE 13.1
next_entry=Windows 8.1 (loader) ...

In this case the next_entry field didn't get cleared after a reboot like it should have (perhaps due to some btrfs incompatibility?)

I was successfully able to unset it like this (again, within the chroot):

grub2-editenv /boot/grub2/grubenv unset next_entry

After a reboot the grub menu was back to normal!

timothyb89

Posted 2013-12-31T03:51:13.697

Reputation: 71

0

If you have access to a live CD of some sort you might be able to use grub configuration commands to fix your problem. Alternatively you could manually configure the GRUB configuration files mentioned here. However, GRUB 2's configuration files, unlike GRUB, are not meant to be edited manually so be extra careful.

Ebalosus

Posted 2013-12-31T03:51:13.697

Reputation: 1

Thanks, I was able to fix it after poking around with the grub2-editenv command. – timothyb89 – 2013-12-31T05:18:47.313