How to boot into the right version of Sabayon with GRUB2?

Issues Related to Hardware (Sound, Video, Printers, Scanners, Webcams, Touchpads, Keyboards, Sensors, Drives, GRUB, etc.)

Moderator: Moderators

How to boot into the right version of Sabayon with GRUB2?

Postby vaettchen » Sun Apr 21, 2013 15:47

I have Sabayon X where there is this two stage selection process to get to the desired Sabayon kernel version, first the screen with only two choices (Boot Sabayon or Select Special, in short words. The second menu item, if selected, leads me to another screen which contains the "old" GRUB start screen with a variety of entries.

If I do nothing, that screen is skipped and a default is chosen - which, in my case, unfortunately is the wrong one. I want the third item (not the first). I have tried to find out how to make this third item the default choice but did not find a good answer. I fiddled around with /etc/default/grub but that seems to affect the first screen rather than the second and was rather dangerous.

Can somebody guide me to the right config file to edit for the default on that 2nd screen?

Thanks,
Rainer
vaettchen
Simple Hen
 
Posts: 97
Joined: Sun Jan 21, 2007 8:47


Re: How to boot into the right version of Sabayon with GRUB2

Postby vaettchen » Sun Apr 21, 2013 21:36

My /etc/default/grub looks like this

Code: Select all
GRUB_COLOR_HIGHLIGHT="magenta/black"
GRUB_COLOR_NORMAL="white/black"
GRUB_DISTRIBUTOR="Sabayon"
GRUB_TIMEOUT=5
GRUB_DISABLE_LINUX_UUID=true
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_DEFAULT=0
GRUB_GFXMODE=1024x768
GRUB_SAVEDEFAULT=true
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_HIDDEN_TIMEOUT=0
GRUB_CMDLINE_LINUX=""
GRUB_BACKGROUND="/boot/grub/default-splash.png"


I have tried changing GRUB_DEFAULT=0 to GRUB_DEFAULT=2 but this seemed to affect the first screen that has only two choices, and has confused GRUB - it did not find the root partition, I had to enter manually. Should I try simply deleting / commenting out that line? Would the GRUB_SAVEDDEFAULT=TRUE then affect the choices on the 2nd screen?

I can try out but I think I'd better ask, rather than bringing myself once more into trouble with stuff I don't really understand...
vaettchen
Simple Hen
 
Posts: 97
Joined: Sun Jan 21, 2007 8:47

Re: How to boot into the right version of Sabayon with GRUB2

Postby anomaly65 » Sun Apr 28, 2013 7:25

Hi,

Sorry, it's late here :) If you have both grub v1 and v2 installed, you'll likely need to boot from dvd/usb/etc and perform (oversimplified, check the gentoo wiki page on the subject at http://wiki.gentoo.org/wiki/GRUB2_Quick_Start

Main thing I believe is missing is grub2 is not installed on your target (primary in UEFI or BIOS) hard drive.

Let's assume for this your primary disk is in fact /dev/sda

Code: Select all
 grub2-install /dev/sda


Will install grub2 in the proper (e.g. MBR) location on your primary drive, auto detecting (with luck) any OS's you have installed.

Good luck!!
andy
--
Use handrails on stairs. A nasty fall face first changes your point of view quickly, and mine permanently :-)
anomaly65
Technological Hen
 
Posts: 300
Joined: Sat Nov 17, 2007 15:37

Re: How to boot into the right version of Sabayon with GRUB2

Postby vaettchen » Sun Apr 28, 2013 10:07

Thanks, anomaly65 - but grub was installed and was working well, except that I could not set the default choices.

In the meantime, following the link provided by Fitzcarraldo, I was able to solve my default choice problem,
Code: Select all
GRUB_DEFAULT=saved
did the trick.

Probably I should set up a separate topic but just in case there is a quick and easy answer: While messing around with the entries, I apparently have changed something that I was not aware of, and grub2 has forgotten the location of the root partition. When I start now, I get during the boot process the message
Code: Select all
Could not find the root block device in .
Please specify another value...

Entering manually /dev/sda3 here solves the problem but obviously, that is not what I want to do all the time. There should be an easy way to add the information to some config file, but the grub2 documentation is too hard to read for me (I seriously tried).

Would somebody be able to tell me how to tell grub where to look for the root block device?
vaettchen
Simple Hen
 
Posts: 97
Joined: Sun Jan 21, 2007 8:47

Re: How to boot into the right version of Sabayon with GRUB2

Postby anomaly65 » Sun Apr 28, 2013 18:25

vaettchen :)

Now I understand. Question, did you change the order of drives (hardware?) or in BIOS/UEFI?

And check the file /boot/grub/grub.cfg to see if the UUID of the /dev/sda3 is properly listed. I would do so in both the /etc/fstab and try to let grub attempt to reconfigure using the UUID rather than the older /dev/sda3

like so on my own system:
Code: Select all
#blkid /dev/sda1
/dev/sda1: UUID="2ce3f419-7573-4dbe-b1b8-9d3472c7f625" TYPE="xfs"


and the line in /boot/grub/grub.cfg for that linux boot is as such:

Code: Select all
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="${saved_entry}"

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdo
s1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  2ce3f4
19-7573-4dbe-b1b8-9d3472c7f625
else
  search --no-floppy --fs-uuid --set=root 2ce3f419-7573-4dbe-b
1b8-9d3472c7f625
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=1024x768
  load_video
  # vga= is deprecated, grub2 handles this just fine
  # making grub2 res == linux fb res
  set gfxpayload=keep
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdo
s1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  2ce3f4
19-7573-4dbe-b1b8-9d3472c7f625
else
  search --no-floppy --fs-uuid --set=root 2ce3f419-7573-4dbe-b
1b8-9d3472c7f625
fi
insmod png
background_image -m stretch /boot/grub/default-splash.png
if sleep --interruptible 0 ; then
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Sabayon GNU/Linux' --class sabayon --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-2ce3f419-7573-4dbe-b1b8-9d3472c7f625' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod xfs
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1
  2ce3f419-7573-4dbe-b1b8-9d3472c7f625
        else
          search --no-floppy --fs-uuid --set=root 2ce3f419-7573-4dbe-b1b8-9d3472c7f625
        fi
        echo    'Loading Linux x86_64-3.8.0-sabayon ...'
        linux   /boot/kernel-genkernel-x86_64-3.8.0-sabayon ro
  init=/linuxrc splash=silent,theme:sabayon video=vesafb:ywrap ,mtrr:3 vga=791 gfxpayload=1024x768x16 console=tty1 quiet dokeymap keymap=us domdadm resume=swap:UUID=4e7af029-7dfc-451f-8ac1-340e4a3a8db9 real_resume=UUID=4e7af029-7dfc-451f-8ac1-340e4a3a8db9 root=UUID=2ce3f419-7573-4dbe-b1b8-9d3472c7f625 docrypt
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initramfs-genkernel-x86_64-3.8.0-sabayon
}
submenu 'Advanced options for Sabayon GNU/Linux' $menuentry_id
_option 'gnulinux-advanced-2ce3f419-7573-4dbe-b1b8-9d3472c7f62
5' {
        menuentry 'Sabayon GNU/Linux, with Linux x86_64-3.8.0-sabayon' --class sabayon --class gnu-linux --class gnu --class
 os $menuentry_id_option 'gnulinux-x86_64-3.8.0-sabayon-advanced-2ce3f419-7573-4dbe-b1b8-9d3472c7f625' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod xfs
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; th
en
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci 0,msdos1  2ce3f419-7573-4dbe-b1b8-9d3472c7f625
                else
                  search --no-floppy --fs-uuid --set=root 2ce3f419-7573-4dbe-b1b8-9d3472c7f625
                fi
                echo    'Loading Linux x86_64-3.8.0-sabayon ...'
                linux   /boot/kernel-genkernel-x86_64-3.8.0-sabayon ro  init=/linuxrc splash=silent,theme:sabayon video=vesafb:ywrap,mtrr:3 vga=791 gfxpayload=1024x768x16 console=tty1 quiet dokeymap keymap=us domdadm resume=swap:UUID=4e7af029-7dfc-451f-8ac1-340e4a3a8db9 real_resume=UUID=4e7af029-7dfc-451f-8ac1-340e4a3a8db9 root=UUID=2ce3f419-7573-4dbe-b1b8-9d3472c7f625 docrypt
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initramfs-genkernel-x86_64-3.8.0
-sabayon
        }


Note the "hints" built in for the AHCI compatible BIOS to identify by UUID the real root partition.

Yes, complicated, but definitely check to see that your BIOS settings are AHCI capable/compatible/enabled, and that grub correctly identifies the root partition for each OS you have installed (if you see "/dev/sdXY" then there is a problem). /etc/grub/default includes options which 'backwards' grub into using older desginations (i.e. /dev/sda3) which is definitely not what you want. Worst case, "edit" the /boot/grub/grub.cfg file to use the UUID of /dev/sda3 and it should work ok :-)

Good luck!!
--
Use handrails on stairs. A nasty fall face first changes your point of view quickly, and mine permanently :-)
anomaly65
Technological Hen
 
Posts: 300
Joined: Sat Nov 17, 2007 15:37

Re: How to boot into the right version of Sabayon with GRUB2

Postby vaettchen » Sun Apr 28, 2013 22:04

Thanks a lot, anomaly65 - I have started looking into this but am a bit overwhelmed by the complexity. It will take me a few days to work on this to know how far I get...
vaettchen
Simple Hen
 
Posts: 97
Joined: Sun Jan 21, 2007 8:47

Re: How to boot into the right version of Sabayon with GRUB2

Postby Fitzcarraldo » Sun Apr 28, 2013 23:53

Either a) edit the file /boot/grub/grub.cfg directly and specify "root=/dev/sda3" in the linux boot line, similar to the suggestion by anomaly65, or b) edit the file /etc/default/sabayon-grub and specifiy/change "root=/dev/sda3" as one of the parameters in GRUB_CMDLINE_LINUX then re-run the command "grub2-mkconfig -o /boot/grub/grub.cfg" to regenerate the /boot/grub/grub.cfg file.
User avatar
Fitzcarraldo
Sagely Hen
 
Posts: 7984
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom

Re: How to boot into the right version of Sabayon with GRUB2

Postby vaettchen » Thu May 09, 2013 8:38

Hmm...

In my /etc/fstab, the swap, boot and root partitions are identified as
Code: Select all
UUID=14f78f32-fa75-45a6-98d9-96c5ea63e368 /                       ext4    defaults        1 1
UUID=277b30af-5b01-459b-b318-46fe57d2b533 /boot                   ext2    defaults        1 2
UUID=37386412-499c-4171-ae60-0fd29dffc1ce swap                    swap    defaults        0 0


and my /etc/default/sabayon-grub says
Code: Select all
GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} init=/linuxrc splash=silent,theme:sabayon video=vesafb:ywrap,mtrr:3 vga=791 gfxpayload=1024x768x16 console=tty1 quiet dokeymap keymap=de domdadadm resume=swap:UUID=37386412-499c-4171-ae60-0fd29dffc1ce real_resume=UUID=37386412-499c-4171-ae60-0fd29dffc1ce root=UUID=14f78f32-fa75-45a6-98d9-96c5ea63e368 docrypt"


Before I start editing stuff - doesn't that look quite normal? I have never touched these files directly (and did not change any BIOS or other settings). I never (knowingly) asked for encryption - is this "docrypt" possibly the source of the problem?

Or shall I simply go ahead and rplace the UUID with /dev/sda3?
vaettchen
Simple Hen
 
Posts: 97
Joined: Sun Jan 21, 2007 8:47



Return to Hardware

Who is online

Users browsing this forum: No registered users and 1 guest