3

   There are some trivial troubles that always obsess me.My Gentoo always complains 'Could not find the root block device in UUID=5f7c7e13-2a46-4ae4-a8c0-f77f84e80900' and stuck,once I try to boot. However, if I type the same device name /dev/sda2 in, the system goes on.I don´t know why. My Gentoo was installed in one partition /dev/sda2 and I mounted / into /dev/sda2.

   I also have found some posts on the internet. Most posts say it is caused by kernel config,and compiling the corresponding fs as built-in into the kernel ,not as module can solve it.some says rootfs should be specified in grub after the kernel command, device name after root command in grub should be substituted by the UUID. I did it all, but those didn't work.

Here is my configuration in grub.

533 menuentry 'Gentoo (on /dev/sda2)' --class gentoo --class linux-gnu --class os $menuentry_id_option 'osprober-chain-225E1F815E1F4D43' { 
534     insmod part_msdos                                                                                                   
535     insmod ext4                                                                                                         
536     set root='hd0,msdos2'                                                                                               
537     if [ x$feature_platform_search_hint = xy ]; then                                                                    
538     ¦   ¦ search --no-floppy --fs-uuid --set=root --hint-    bios=hd1,msdos2 --hint-efi=hd1,msdos2 --hint-baremetal=ahci1,msdos2      5f7c7e13-2a46-4ae4-a8c0-f77f84e80900 
539     ¦   else                                                                                                                
540     ¦   ¦ search --no-floppy --fs-uuid --set=root 5f7c7e13-2a46-4ae4-a8c0-f77f84e80900                                      
541     ¦   fi                                                                                                                  
542     ¦   ¦ echo    'Loading Linux x86_64-4.4.39-gentoo ...'                                                                    
543     ¦   ¦ linux   /boot/kernel-genkernel-x86_64-4.4.39-gentoo root=UUID=5f7c7e13-2a46-4ae4-a8c0-f77f84e80900 ro               
544     ¦ echo    'Loading initial ramdisk ...'                                                                               
545     ¦   ¦ initrd  /boot/initramfs-genkernel-x86_64-4.4.39-gentoo                                                        
546     ¦ boot                                                                                                              
547                                                                                                                         
548 }              

The Gentoo coexists with Ubuntu.

My /etc/fstab.

 1 # /etc/fstab: static file system information.                                                                           
 2 #                                                                                                                       
 3 # noatime turns off atimes for increased performance (atimes normally aren't                                            
 4 # needed); notail increases performance of ReiserFS (at the expense of storage                                          
 5 # efficiency).  It's safe to drop the noatime options if you want and to                                                
 6 # switch between notail / tail freely.                                                                                  
 7 #                                                                                                                       
 8 # The root filesystem should have a pass number of either 0 or 1.                                                       
 9 # All other filesystems should have a pass number of 0 or greater than 1.                                               
 10 #                                                                                                                       
 11 # See the manpage fstab(5) for more information.                                                                        
 12 #                                                                                                                       
 13                                                                                                                         
 14 # <fs>          <mountpoint>    <type>      <opts>      <dump/pass>                                                     
 15                                                                                                                         
 16 # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.                                              
 17 UUID=5f7c7e13-2a46-4ae4-a8c0-f77f84e80900  /      ext4  noatime  0 1                                                    
 18 UUID=B66EAE686EAE215B  /mnt/D/     ntfs      errors=remount-ro                                                          
 19                                                                     

UUID of the corresponding name

  /dev/sda2: UUID="5f7c7e13-2a46-4ae4-a8c0-f77f84e80900" TYPE="ext4" PARTUUID="000e21f3-02"

  /dev/sda4: UUID="B66EAE686EAE215B" TYPE="ntfs" PARTUUID="000e21f3-04"

Is there anyone has some ideas? thanks.

3

  Finally, I figured it out after several days have gone.It is caused by driver problem. My Gentoo is installed in my external hard-disk connected with my laptop by a USB cable.However, the USB Mass Storage Support option wasn't masked build-in when I built my kernel.Hence, it always blocked in that way.If some are in the same boat with me, and you make sure you have compiled all the referenced file system as built-in, please check if the options as follows are built-in in your kernel.

  • Device Driver-->USB Support -->USB Mass Storage Support
  • Device Driver-->USB Support -->xHCI HCD (USB 3.0) support
  • Device Driver-->USB Support --> EHCI HCD (USB 2.0) support
  • Device Driver-->USB Support --> UHCI HCD (most Intel and VIA) support

  • Device Driver-->USB Support --> Support for Host-side USB

If they don't, check it on.

1

Maybe it's the wrong hard drive in your grub.cfg

bios=hd1,msdos2 --hint-efi=hd1,msdos2 --hint-baremetal=ahci1,msdos2

hd1,msdos2, ahci1,msdos2 etc. would refer to the second disk. Usually it's the first hd0,msdos1 having the grub installed on /dev/sda

check this with grub-install --recheck /dev/sda

Your partitions would look like this. (boot on primary)

sudo parted -l

Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sda: 107GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End    Size    Type      File system     Flags
 1      1049kB  103GB  103GB   primary   ext4            boot
 2      103GB   107GB  4394MB  extended
 5      103GB   107GB  4394MB  logical   linux-swap(v1)
  • &ensp;&ensp;&ensp;First of all, thanks @Michael D . I don't know what exactly the difference between ahci and hd, can you explain it more? And I have tried grub-install --recheck /dev/sda, not any charm present. Do you mean I should replace /dev/sda2 or specified UUID to hd1,msdos2? – ResRelentelss Feb 7 '17 at 12:12
  • I think the first line (from my answer) covers all cases - whether you boot via ´bios´, ´efi´, ideor ahci. AHCI stands for advanced host controller interface and is for sata hard drives which you need to set in the bios. – Michael D. Feb 7 '17 at 12:18
  • As far as I know, you don't edit the grub.cfg manually. You install grub straight to /dev/sda (or /dev/sdb?) - no numbers. update-grub or grub-mkconfig -o /boot/grub/grub.cfg "$@" generates the file for you – Michael D. Feb 7 '17 at 12:24
  • finally - here is a tutorial how to re/install/update grub. It's for ubuntu but that might work for gentoo, too. Actually you just need to boot (if you can fix it to boot), login as root and start with the grub-install line. howtoubuntu.org/… – Michael D. Feb 7 '17 at 12:26
1

To be honest I think the easiest way to do this is to just make a generic kernel.

I simply grab Ubuntu's kernel config, issue a make oldconfig and let genkernel --no-clean --menuconfig all do the rest.

  • Emerge the kernel as Quick Install Guide tells you to.
  • Grab the generic kernel config:
    1) Find the file you want. The most recent kernel version basically: http://kernel.ubuntu.com/~kernel-ppa/configs/
    2) wget -O /usr/src/linux/.config kernelconfigurl
  • Run make oldconfig. Just hold "Enter" if you don't know how to answer these. No, nothing bad will happen, it will default to the default answer, which is what you should pick in a generic kernel anyway.
  • Run genkernel with genkernel --no-clean --menuconfig all. In the menu you can modify things if you wish, or you can just exit. And the install will commence.
  • Generate your GRUB config with grub-mkconfig -o /boot/grub/grub.cfg

This kernel will contain almost all modules and whatnot. So everything you plug in will work. Some Unix veterans frown upon generic kernels. If you ran Ubuntu, Fedora, or basically any distribution whatsoever - you used generic kernels.

Do you want to make a minimal kernel without messing up?
No problem. After you boot this kernel, simply plug in all devices you will ever need. Once done, go into /usr/src/linux and issue make localmodconfig. Great, now you have a kernel with only the stuff you will need. Use genkernel to compile the new minimalistic version and install it the same way.

Good luck.

  • First of all, thank you for your long answer. However, I used the generic kernel option to compile my kernel, but it seems that gen kernel doesn't switch on the USB Mass Storage Support kernel option by default, even though I plugged my external USB hard disk in my computer. I think this is the crux which causes this problem. – ResRelentelss Apr 14 '17 at 12:52
  • There is no generic kernel config on Gentoo, that's why I used Ubuntu's configuration. Using make localmodconfig only works once you are on the booted machine (not chroot/livecd). ** Even though the Gentoo wiki says it should work through the LiveCD it failed for me to do so. – Shiki Apr 15 '17 at 13:18
0

In my case, I boot a VMWare Fusion virtual machine with Gentoo. I had to set CONFIG_FUSION_SPI=Y.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.