Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
grub-legacy to grub 2 Migration Issues
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
chrisk2305
Tux's lil' helper
Tux's lil' helper


Joined: 05 Sep 2007
Posts: 88

PostPosted: Sun Jan 29, 2017 1:44 pm    Post subject: grub-legacy to grub 2 Migration Issues Reply with quote

Hi Guys,

I followed the Gentoo grub migration guide and moved quite a bit forward but now I am stuck. I currently have grub2 chainloaded and when I tested it, I noticed that the kernel gets loaded but stops at one point (apparently when switching to the root partition). I am using systemd and various kernel parameters which I already added to /etc/default/grub.

I then had a look at the generated grub.cfg file and found out that the UUID which is supposed to be root is actually the UUID of the boot partiton. What is the correct way for grub2 to pick up the right UUID? Thanks!
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7127
Location: almost Mile High in the USA

PostPosted: Sun Jan 29, 2017 9:00 pm    Post subject: Reply with quote

Might want to post what you actually see in you grub.cfg.

There will be a lot of references to your boot partition UUID as it needs to pick up files from the boot partition

The search commands UUID should be your boot partition

Code:
          search --no-floppy --fs-uuid --set=root b007b007-b007-b007-b007-b007b007b007


but in your "linux" command where it has root=UUID=XXX (if you're using it) should contain your root partition uuid

Code:
        linux   /boot/kernel-4.4.27-gentoo root=UUID=10071007-1007-1007-1007-100710071007 ro root=LABEL=mikuru-root resume=LABEL=mikuru-swap rootdelay=0 video.use_bios_initial_backlight=0 realinit=/usr/lib/systemd/systemd


Using root=UUID= does not work without a initramfs that supports UUID IIRC (only PARTUUID works natively?), and by default I thought that grub2-mkconfig will actually specify a hardcoded /dev/XXXX for your root= for your linux line for all the times I've used grub2-mkconfig.

I think I have the UUID in my config file because I wrote mine in manually.

What does yours look like? Is it actually pointing to the wrong disk? IIRC it detects whatever root you're currently using and uses that as your root=X - and it would get confused if you don't specify options while installing in a chroot.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
chrisk2305
Tux's lil' helper
Tux's lil' helper


Joined: 05 Sep 2007
Posts: 88

PostPosted: Mon Jan 30, 2017 6:55 am    Post subject: Reply with quote

Code:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

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 ext2
set root='hd0,msdos3'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3 --hint='hd0,msdos3'  7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09
else
  search --no-floppy --fs-uuid --set=root 7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod ext2
        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 --hint='hd0,msdos1'  d119b252-12d0-400d-aefc-a51140367a7c
        else
          search --no-floppy --fs-uuid --set=root d119b252-12d0-400d-aefc-a51140367a7c
        fi
        echo    'Loading Linux 4.8.14-gentoo ...'
        linux   /vmlinuz-4.8.14-gentoo root=UUID=7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09 ro init=/usr/lib/systemd/systemd bonding.mode=4 bonding.miimon=100
}
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09' {
        menuentry 'Gentoo GNU/Linux, with Linux 4.8.14-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.8.14-gentoo-advanced-7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod ext2
                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 --hint='hd0,msdos1'  d119b252-12d0-400d-aefc-a51140367a7c
                else
                  search --no-floppy --fs-uuid --set=root d119b252-12d0-400d-aefc-a51140367a7c
                fi
                echo    'Loading Linux 4.8.14-gentoo ...'
                linux   /vmlinuz-4.8.14-gentoo root=UUID=7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09 ro init=/usr/lib/systemd/systemd bonding.mode=4 bonding.miimon=100
        }
        menuentry 'Gentoo GNU/Linux, with Linux 4.8.14-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.8.14-gentoo-recovery-7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod ext2
                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 --hint='hd0,msdos1'  d119b252-12d0-400d-aefc-a51140367a7c
                else
                  search --no-floppy --fs-uuid --set=root d119b252-12d0-400d-aefc-a51140367a7c
                fi
                echo    'Loading Linux 4.8.14-gentoo ...'
                linux   /vmlinuz-4.8.14-gentoo root=UUID=7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09 ro single init=/usr/lib/systemd/systemd bonding.mode=4 bonding.miimon=100
        }
        menuentry 'Gentoo GNU/Linux, with Linux 4.7.3-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.7.3-gentoo-advanced-7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod ext2
                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 --hint='hd0,msdos1'  d119b252-12d0-400d-aefc-a51140367a7c
                else
                  search --no-floppy --fs-uuid --set=root d119b252-12d0-400d-aefc-a51140367a7c
                fi
                echo    'Loading Linux 4.7.3-gentoo ...'
                linux   /kernel-4.7.3-gentoo root=/dev/sda3 ro init=/usr/lib/systemd/systemd bonding.mode=4 bonding.miimon=100
        }
        menuentry 'Gentoo GNU/Linux, with Linux 4.7.3-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.7.3-gentoo-recovery-7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod ext2
                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 --hint='hd0,msdos1'  d119b252-12d0-400d-aefc-a51140367a7c
                else
                  search --no-floppy --fs-uuid --set=root d119b252-12d0-400d-aefc-a51140367a7c
                fi
                echo    'Loading Linux 4.7.3-gentoo ...'
                linux   /kernel-4.7.3-gentoo root=/dev/sda3 ro single init=/usr/lib/systemd/systemd bonding.mode=4 bonding.miimon=100
        }
        menuentry 'Gentoo GNU/Linux, with Linux 4.6.4-gentoo' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.6.4-gentoo-advanced-7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod ext2
                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 --hint='hd0,msdos1'  d119b252-12d0-400d-aefc-a51140367a7c
                else
                  search --no-floppy --fs-uuid --set=root d119b252-12d0-400d-aefc-a51140367a7c
                fi
                echo    'Loading Linux 4.6.4-gentoo ...'
                linux   /vmlinuz-4.6.4-gentoo root=UUID=7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09 ro init=/usr/lib/systemd/systemd bonding.mode=4 bonding.miimon=100
        }
        menuentry 'Gentoo GNU/Linux, with Linux 4.6.4-gentoo (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.6.4-gentoo-recovery-7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod ext2
                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 --hint='hd0,msdos1'  d119b252-12d0-400d-aefc-a51140367a7c
                else
                  search --no-floppy --fs-uuid --set=root d119b252-12d0-400d-aefc-a51140367a7c
                fi
                echo    'Loading Linux 4.6.4-gentoo ...'
                linux   /vmlinuz-4.6.4-gentoo root=UUID=7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09 ro single init=/usr/lib/systemd/systemd bonding.mode=4 bonding.miimon=100
        }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###


Code:

blkid /dev/sda1
/dev/sda1: UUID="d119b252-12d0-400d-aefc-a51140367a7c" TYPE="ext4" PARTUUID="28eb1948-01"


Code:

blkid /dev/sda3
/dev/sda3: UUID="7ee386a1-3cb5-47f8-a236-fb6a4d7cbf09" TYPE="ext4" PARTUUID="28eb1948-03"


For some reason it is not hardcoded /dev/sda3 as root but the UUID of /dev/sda1 which is boot unfortunately.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7127
Location: almost Mile High in the USA

PostPosted: Mon Jan 30, 2017 9:27 am    Post subject: Reply with quote

There are some of the menuoptions that do have it hardcoded... weird.
It looks like that the UUIDs are pointing to the right ones? Or is it?
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
chrisk2305
Tux's lil' helper
Tux's lil' helper


Joined: 05 Sep 2007
Posts: 88

PostPosted: Mon Jan 30, 2017 4:56 pm    Post subject: Reply with quote

indeed weird. But yes you are right, my fault. The root UUID seems to be correct, nevertheless booting process stops when switching to /

here my grub legacy config:

Code:

default 0
timeout 10
#splashimage=(hd0,0)/boot/grub/splash.xpm.gz


title GRUB2 Chainload
root (hd0,0)
kernel /boot/grub/i386-pc/core.img
boot



#title Gentoo Linux 4.8.14
#root (hd0,0)
#kernel /boot/vmlinuz-4.8.14-gentoo root=/dev/sda3 init=/usr/lib/systemd/systemd bonding.mode=4 bonding.miimon=100

#title Gentoo Linux 4.7.3
#root (hd0,0)
#kernel /boot/kernel-4.7.3-gentoo root=/dev/sda3 init=/usr/lib/systemd/systemd bonding.mode=4 bonding.miimon=100

title Gentoo Linux 4.6.4
root (hd0,0)
kernel /boot/vmlinuz-4.6.4-gentoo root=/dev/sda3 init=/usr/lib/systemd/systemd bonding.mode=4 bonding.miimon=100


Don't mind the # as I am currently only booting 4.6.4 due to other issues.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7127
Location: almost Mile High in the USA

PostPosted: Mon Jan 30, 2017 6:39 pm    Post subject: Reply with quote

One thing is that I don't seem to see your initramfs. If you don't have initramfs, then UUID=XXXX won't work and you have to partuuid or hardcode it. You could use genkernel to build an initramfs and specify it via initrd.

You should be able to disable auto UUID in grub-mkconfig by editing /etc/default/grub and uncomment
Code:
#GRUB_DISABLE_LINUX_UUID=true

This will make it use hardcoded /dev/sdXX. Use grub-mkconfig again to regenerate if you haven't touched your grub.cfg by hand.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
chrisk2305
Tux's lil' helper
Tux's lil' helper


Joined: 05 Sep 2007
Posts: 88

PostPosted: Mon Jan 30, 2017 6:43 pm    Post subject: Reply with quote

Alright, I will try this as I don't have an initramfs.
Back to top
View user's profile Send private message
chrisk2305
Tux's lil' helper
Tux's lil' helper


Joined: 05 Sep 2007
Posts: 88

PostPosted: Mon Jan 30, 2017 6:54 pm    Post subject: Reply with quote

worked perfectly, thanks a lot!

Btw: how can I make another menu entry my default?
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7127
Location: almost Mile High in the USA

PostPosted: Mon Jan 30, 2017 7:40 pm    Post subject: Reply with quote

It should record the last entry that you used if you have "GRUB_DEFAULT=saved" in /etc/default/grub .
You could then use grub-set-default to set the last used. You could pass the sub menu UUID entry for this.

Else you could just edit your grub.cfg 'set default="0"' line to whatever entry you want, though I'm not sure how this works for sub menu entries.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
proteusx
Apprentice
Apprentice


Joined: 21 Jan 2008
Posts: 232

PostPosted: Sat Feb 25, 2017 9:35 pm    Post subject: Reply with quote

I found that the easiest way to migrate from grub legacy to grub2
is to boot from the old legacy config file (menu.lst).

Code:
# /boot/grub/grub.cfg

set timeout=1
menuentry "Load Legacy Configaration File" {                                                               
  search --set=root --label gentoo_64 --hint hd0,msdos1                                             
  legacy_configfile /boot/grub/menu.lst                                                             
}       
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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