Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 462892 - sys-boot/grub-2.00-r2: grub2-reboot & grub2-set-default don't work
Summary: sys-boot/grub-2.00-r2: grub2-reboot & grub2-set-default don't work
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Mike Gilbert
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-24 00:13 UTC by Doug Goldstein (RETIRED)
Modified: 2013-03-28 16:05 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
grub.cfg (grub.cfg,5.96 KB, text/plain)
2013-03-24 03:18 UTC, Doug Goldstein (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Doug Goldstein (RETIRED) gentoo-dev 2013-03-24 00:13:31 UTC
I've tried a number of ways to make this work but it always boots the first kernel defined.

/etc/default/grub:
GRUB_DISTRIBUTOR="Gentoo"

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10

GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

# grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub.cfg ...
Found linux image: /boot/kernel-3.6.11-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-3.6.11-gentoo
Found linux image: /boot/kernel-3.4.9-gentoo
Found initrd image: /boot/initramfs-genkernel-x86_64-3.4.9-gentoo
done

# grep menuentry /boot/grub2/grub.cfg
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-a625d7e7-a0d9-4625-9c7b-a5fd2516db71' {
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-a625d7e7-a0d9-4625-9c7b-a5fd2516db71' {
	menuentry 'Gentoo GNU/Linux, with Linux 3.6.11-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.6.11-gentoo-advanced-a625d7e7-a0d9-4625-9c7b-a5fd2516db71' {
	menuentry 'Gentoo GNU/Linux, with Linux 3.6.11-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.6.11-gentoo-recovery-a625d7e7-a0d9-4625-9c7b-a5fd2516db71' {
	menuentry 'Gentoo GNU/Linux, with Linux 3.4.9-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.4.9-gentoo-advanced-a625d7e7-a0d9-4625-9c7b-a5fd2516db71' {
	menuentry 'Gentoo GNU/Linux, with Linux 3.4.9-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.4.9-gentoo-recovery-a625d7e7-a0d9-4625-9c7b-a5fd2516db71' {

# grub2-set-default 'Gentoo GNU/Linux, with Linux 3.4.9-gentoo'
# reboot
...
# uname -r
3.6.11-gentoo

# grub2-set-default 'gnulinux-3.4.9-gentoo-advanced-a625d7e7-a0d9-4625-9c7b-a5fd2516db71'
# reboot
...
# uname -r
3.6.11-gentoo

# grub2-set-default 3
# reboot
...
# uname -r
3.6.11-gentoo

# grub2-reboot 'Gentoo GNU/Linux, with Linux 3.4.9-gentoo'
# reboot
...
# uname -r
3.6.11-gentoo

# grub2-reboot 'gnulinux-3.4.9-gentoo-advanced-a625d7e7-a0d9-4625-9c7b-a5fd2516db71'
# reboot
...
# uname -r
3.6.11-gentoo

# grub2-reboot 3
# reboot
...
# uname -r
3.6.11-gentoo
Comment 1 Mike Gilbert gentoo-dev 2013-03-24 01:11:27 UTC
Sorry, I saw your email but forgot about it.

I'm able to get this working in a qemu instance with an ext2 /boot partition.

On what type of filesystem does your /boot/grub2 directory reside?

The boot saving stuff works by reading/writing a variable in /boot/grub2/grubenv.

Can I take a look at the following files? 

/boot/grub2/grubenv
/boot/grub2/grub.cfg
Comment 2 Doug Goldstein (RETIRED) gentoo-dev 2013-03-24 03:17:35 UTC
(In reply to comment #1)
> Sorry, I saw your email but forgot about it.
> 
> I'm able to get this working in a qemu instance with an ext2 /boot partition.
> 
> On what type of filesystem does your /boot/grub2 directory reside?

Its ext3.

> 
> The boot saving stuff works by reading/writing a variable in
> /boot/grub2/grubenv.
> 
> Can I take a look at the following files? 
> 
> /boot/grub2/grubenv

# GRUB Environment Block
saved_entry=Gentoo GNU/Linux, with Linux 3.4.9-gentoo
#################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################

> /boot/grub2/grub.cfg
Comment 3 Doug Goldstein (RETIRED) gentoo-dev 2013-03-24 03:18:01 UTC
Created attachment 343060 [details]
grub.cfg
Comment 4 Mike Gilbert gentoo-dev 2013-03-24 16:24:20 UTC
Ok, so I loaded your config in my qemu image.

I then selected "Advanced options...". "Gentoo GNU/Linux, with Linux 3.4.9-gentoo" from the boot menu.

After booting failed (I don't have your kernels), I then rebooted the VM. Upon reboot, the menu entry I had selected was still selected.

The grubenv file now contains this:

saved_entry=gnulinux-advanced-a625d7e7-a0d9-4625-9c7b-a5fd2516db71>gnulinux-3.4.9-gentoo-advanced-a625d7e7-a0d9-4625-9c7b-a5fd2516db71

Try passing that string to grub2-set-default.

Also, if you want a copy of the qemu disk image to play with, let me know.