LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo
User Name
Password
Gentoo This forum is for the discussion of Gentoo Linux.

Notices


Reply
  Search this Thread
Old 04-28-2018, 07:03 AM   #1
micaldas
Member
 
Registered: Mar 2018
Posts: 84

Rep: Reputation: Disabled
Problems booting Gentoo


Hi,
I installed Gentoo amd-64, in a external hard drive, on a computer running arch.
At first Grub wouldn't recognize gentoo, until I found out I didin't have os-prober installed. After installation, and running "sudo grub-mkconfig -o /boot/grub/grub.cfg", grub finally recognized gentoo.
But when I tried to boot gentoo, by choosing the gentoo entry in the grub menu, it boots arch instead.
I looked at grub.cfg and noticed a couple of things:
1 - the "set root" defined goes to the boot partition of the arch disk,
2 - the UUID's on the configuration, correspond to the boot and root partition of the arch disk.
I tried changing these values manually on the grub.cfg file (although I know I shouldn't), to the ones on the gentoo disk, but it didn't change anything.

Any help or suggestions would be greatly appreciated.

Below goes my partition list and the contents of grub.cfg

NAME FSTYPE SIZE MOUNTPOINT LABEL
sda 465.8G
├─sda1 2M
├─sda2 ext2 128M /boot
├─sda3 swap 512M [SWAP]
└─sda4 ext4 465.1G /
sdc 465.8G
├─sdc1 2M
├─sdc2 ext2 128M
├─sdc3 swap 512M
└─sdc4 ext4 465.1G
sr0 1024M

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

### BEGIN /etc/grub.d/00_header ### 
insmod part_gpt 
insmod part_msdos 
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,msdos4' 
if [ x$feature_platform_search_hint = xy ]; then 
  search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos4' --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  0c169834-97a0-4dc0-9b71-28987366e636 
else 
  search --no-floppy --fs-uuid --set=root 0c169834-97a0-4dc0-9b71-28987366e636 
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_input console 
terminal_output gfxterm 
if [ x$feature_timeout_style = xy ] ; then 
  set timeout_style=menu 
  set timeout=15 
# Fallback normal timeout code in case the timeout_style feature is 
# unavailable. 
else 
  set timeout=15 
fi 
### END /etc/grub.d/00_header ### 

### BEGIN /etc/grub.d/06_grub-customizer_menu_color_helper ### 
### END /etc/grub.d/06_grub-customizer_menu_color_helper ### 

### BEGIN /etc/grub.d/10_linux ### 
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-0c169834-97a0-4dc0-9b71-28987366e636' { 
   load_video 
   set gfxpayload=keep 
   insmod gzio 
   insmod part_msdos 
   insmod ext2 
   set root='hd0,msdos2' 
   if [ x$feature_platform_search_hint = xy ]; then 
     search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  f51cc451-1576-4aba-852a-e23af142ebec 
   else 
     search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec 
   fi 
   echo   'Loading Linux linux ...' 
   linux   /vmlinuz-linux root=UUID=0c169834-97a0-4dc0-9b71-28987366e636 rw  quiet 
   echo   'Loading initial ramdisk ...' 
   initrd   /initramfs-linux.img 
} 
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-0c169834-97a0-4dc0-9b71-28987366e636' { 
   menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-0c169834-97a0-4dc0-9b71-28987366e636' { 
      load_video 
      set gfxpayload=keep 
      insmod gzio 
      insmod part_msdos 
      insmod ext2 
      set root='hd0,msdos2' 
      if [ x$feature_platform_search_hint = xy ]; then 
        search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  f51cc451-1576-4aba-852a-e23af142ebec 
      else 
        search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec 
      fi 
      echo   'Loading Linux linux ...' 
      linux   /vmlinuz-linux root=UUID=0c169834-97a0-4dc0-9b71-28987366e636 rw  quiet 
      echo   'Loading initial ramdisk ...' 
      initrd   /initramfs-linux.img 
   } 
   menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-0c169834-97a0-4dc0-9b71-28987366e636' { 
      load_video 
      set gfxpayload=keep 
      insmod gzio 
      insmod part_msdos 
      insmod ext2 
      set root='hd0,msdos2' 
      if [ x$feature_platform_search_hint = xy ]; then 
        search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  f51cc451-1576-4aba-852a-e23af142ebec 
      else 
        search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec 
      fi 
      echo   'Loading Linux linux ...' 
      linux   /vmlinuz-linux root=UUID=0c169834-97a0-4dc0-9b71-28987366e636 rw  quiet 
      echo   'Loading initial ramdisk ...' 
      initrd   /initramfs-linux-fallback.img 
   } 
} 

### 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_proxy ### 
menuentry "Gentoo/Linux (on /dev/sdc4)" --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-eacee572-c583-4995-ac17-7dcf50e1d96f' { 
   insmod part_msdos 
   insmod ext2 
   set root='hd0,msdos2' 
   if [ x$feature_platform_search_hint = xy ]; then 
     search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  f51cc451-1576-4aba-852a-e23af142ebec 
   else 
     search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec 
   fi 
   linux /vmlinuz-linux root=UUID=0c169834-97a0-4dc0-9b71-28987366e636 rw quiet 
   initrd /initramfs-linux.img 
} 




### END /etc/grub.d/30_os-prober_proxy ### 

### BEGIN /etc/grub.d/41_os-prober_proxy ### 
submenu "Advanced options for Gentoo/Linux (on /dev/sdc4)"{ 
menuentry "Arch Linux (on /dev/sdc4)" --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-linux--eacee572-c583-4995-ac17-7dcf50e1d96f' { 
      insmod part_msdos 
      insmod ext2 
      set root='hd0,msdos2' 
      if [ x$feature_platform_search_hint = xy ]; then 
        search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  f51cc451-1576-4aba-852a-e23af142ebec 
      else 
        search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec 
      fi 
      linux /vmlinuz-linux root=UUID=0c169834-97a0-4dc0-9b71-28987366e636 rw quiet 
      initrd /initramfs-linux.img 
} 
menuentry "Arch Linux, with Linux linux (on /dev/sdc4)" --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-linux--eacee572-c583-4995-ac17-7dcf50e1d96f' { 
      insmod part_msdos 
      insmod ext2 
      set root='hd0,msdos2' 
      if [ x$feature_platform_search_hint = xy ]; then 
        search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  f51cc451-1576-4aba-852a-e23af142ebec 
      else 
        search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec 
      fi 
      linux /vmlinuz-linux root=UUID=0c169834-97a0-4dc0-9b71-28987366e636 rw quiet 
      initrd /initramfs-linux.img 
} 
menuentry "Arch Linux, with Linux linux (fallback initramfs) (on /dev/sdc4)" --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/vmlinuz-linux--eacee572-c583-4995-ac17-7dcf50e1d96f' { 
      insmod part_msdos 
      insmod ext2 
      set root='hd0,msdos2' 
      if [ x$feature_platform_search_hint = xy ]; then 
        search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  f51cc451-1576-4aba-852a-e23af142ebec 
      else 
        search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec 
      fi 
      linux /vmlinuz-linux root=UUID=0c169834-97a0-4dc0-9b71-28987366e636 rw quiet 
      initrd /initramfs-linux-fallback.img 
} 
} 
### END /etc/grub.d/41_os-prober_proxy ### 

### BEGIN /etc/grub.d/42_custom_proxy ### 

# 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/42_custom_proxy ### 

### BEGIN /etc/grub.d/43_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/43_custom ###
 
Old 04-28-2018, 10:10 AM   #2
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,369

Rep: Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592
You need to change gentoo set root= line to (hd1,2)
Or possibly hd3
 
1 members found this post helpful.
Old 04-28-2018, 12:02 PM   #3
micaldas
Member
 
Registered: Mar 2018
Posts: 84

Original Poster
Rep: Reputation: Disabled
I have done that and also changed the UUID's to mirror the Gentoo's boot and root disk.
Now I get a grub error message saying it couldn't find vmlinuz-linux file and that I need to load the kernel.
I also don't know how to proceed from here.
 
Old 04-28-2018, 12:11 PM   #4
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,369

Rep: Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592
At the grub menu hit c for the grub command line then ls for list of disk/ partitions that grub sees to determine what the disk/ partition for root= needs to be
 
1 members found this post helpful.
Old 04-28-2018, 02:48 PM   #5
micaldas
Member
 
Registered: Mar 2018
Posts: 84

Original Poster
Rep: Reputation: Disabled
I've now altered the grub.cfg gentoo entry to reflect the right root partition.
When I tried to boot, it told it couldn't find "vmlinuz-linux" file. As I only have a "vmlinux" file in gentoo (located in /usr/src/linux-4.9.95-gentoo), I assumed it was equivalent and changed the entry to make grub look for "vmlinux".
As it still returned the same error message, I inserted the whole path in the entry. The error message persists, although now states it can't find "vmlinux".

My current grub.cfg for gentoo is the following;

insmod part_msdos
insmod ext2
set root='hd1,msdos4'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 f51cc451-1576-4aba-852a-e23af142ebec
else
search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec
fi
linux /run/media/miguel/eacee572-c583-4995-ac17-7dcf50e1d96f/usr/src/linux-4.9.95-gentoo/vmlinux root=UUID=eacee572-c583-4995-ac17-7dcf50e1d96f rw quiet
initrd /initramfs-linux.img
rootdelay=20
 
Old 04-28-2018, 02:57 PM   #6
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,369

Rep: Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592
What is on sdc1 and sdc2?
What is the ouput of parted -l
 
Old 04-28-2018, 03:38 PM   #7
micaldas
Member
 
Registered: Mar 2018
Posts: 84

Original Poster
Rep: Reputation: Disabled
sdc1 is a bios boot partition and sdc2 is boot.
When I input "parted -l" it tells me it's an invalid option.
 
Old 04-28-2018, 04:55 PM   #8
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,369

Rep: Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592Reputation: 1592
I reread your first post and if your grub menu at boot didn't change after editing then you most likely edited the wrong grub.cfg
 
Old 04-28-2018, 05:19 PM   #9
micaldas
Member
 
Registered: Mar 2018
Posts: 84

Original Poster
Rep: Reputation: Disabled
That is probably what it happened but, since then I changed it again and now the file changed as did its behaviour. As I said, first it booted to arch, now it tells me it can't find the kernel.
 
Old 04-29-2018, 07:10 AM   #10
micaldas
Member
 
Registered: Mar 2018
Posts: 84

Original Poster
Rep: Reputation: Disabled
I am going to close this post, as the initial problem is resolved.
 
Old 04-29-2018, 02:37 PM   #11
_roman_
Member
 
Registered: Dec 2017
Location: _Austro_Bavaria_
Distribution: gentoo / linux mint
Posts: 433

Rep: Reputation: 29
Usually you do not need swap. Assuming you have more than a certain amount of RAM.

And you can use one swap partition for any linux. Except you run tuxonice hibernating feature.

Suggestions:

I suggest using lvm2 containers. (
If not use something equivalent which is easy readable and the kernel should not have the possibility to mix up partitions. lvm2 better as UUID better as sdXY / hdXY)
the boot partition is usually on sda2. anything else can be refered with lvm2 containers.

The purpose of a boot partition is to have the boot files there. Just don'T do this: linux /run/media/miguel/eacee572-c583-4995-ac17-7dcf50e1d96f/usr/src/linux-4.9.95-gentoo/vmlinux

I suggest copy over the kernel to boot with a proper name.


the kernel itself, I assume you read the posts on forums.gentoo.org or wiki on how to build it, is located in

Assuming you use 32bit or amd64. Both refer to the same file.
Assuming you set the kernel symlink to the correct kernel source by hand with ln -s
Quote:
cp /usr/src/linux/arch/x86/boot/bzImage /boot/kernel-xy-date

I expect that you read the syntax for the grub2 bootloader. here is an example

Quote:
menuentry ' *** ' {
insmod part_gpt
set root='hd0,gpt2'
echo ' boot entry for SanDisk SSD'

linux /4.9.96-gentoo-26-04-2018 rootfstype=ext4 keymap=de init=/linuxrc ramdisk=8192 dolvm ro crypt_root=...
initrd /intel_microcode_20180312_early_ucode.cpio /initramfs-genkernel-x86_64-4.2.3-gentoo
}
I tell the grub2 bootloader, my boot partiton resides in sda2 = set root='hd0,gpt2'
Therefore "linux /4.9.96-gentoo-26-04-2018" refers to a file which is a file in sda2. Boot files, like grub.cfg / kernel / initramfs belong to the boot partition, which is usually in sda2. careful it is not /boot/4.9.96-gentoo-26-04-2018. when the system is mounted, sda2 is mounted in /boot, than it is /boot/4.9.96-gentoo-26-04-2018

In your case you usually need rootfstype (use the same when you use ext4 for root).
And than you should use real_root= parameter which is also named root=. When you are using luks you need crypt_root

the initrd line is suggested, first is the intel microcode. The instructions on hwo to setup can be found in the gentoo wiki.


typical ubuntu / linux mint grub2 garbage. Just don't use that
Quote:
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,msdos2' --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 f51cc451-1576-4aba-852a-e23af142ebec
else
search --no-floppy --fs-uuid --set=root f51cc451-1576-4aba-852a-e23af142ebec
fi
 
Old 05-07-2018, 05:50 AM   #12
micaldas
Member
 
Registered: Mar 2018
Posts: 84

Original Poster
Rep: Reputation: Disabled
Thank you _roman, your menu suggestion, and finding out that the disk was hd2, not hd1, solved my problem.
 
1 members found this post helpful.
  


Reply

Tags
boot issues



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Gentoo booting problems anon133 Linux - Distributions 11 04-24-2006 05:39 PM
Problems booting a fresh gentoo install on onboard sata stoned Linux - Distributions 3 08-29-2004 05:43 AM
Trouble booting Gentoo GŠutama Linux - Distributions 5 01-14-2004 08:46 AM
Gentoo 1.4 - problem on booting satimis Linux - Distributions 7 10-14-2003 11:23 PM
install gentoo without booting from cd? barazor Linux - Distributions 1 08-31-2002 05:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Gentoo

All times are GMT -5. The time now is 08:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration