1

I have a Debian system on /dev/sda1 (/) and /dev/sda2 (extended, /dev/sda5 is /home, /dev/sda6 is swap). I want to install Gentoo in parallel, so I shrinked sda2 and created /dev/sda3, in which I installed Gentoo, and /dev/sda4, to serve as Gentoo's /home:

Disk /dev/sda: 931.5 GiB, 1000204885504 bytes, 1953525167 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xeb362e8f

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sda1  *          2048   29296639   29294592    14G 83 Linux
/dev/sda2         29298686 1673951231 1644652546 784.2G  5 Extended
/dev/sda3       1673951232 1735391231   61440000  29.3G 83 Linux
/dev/sda4       1735391232 1953523711  218132480   104G 83 Linux
/dev/sda5         29298688   35547135    6248448     3G 82 Linux swap / Solaris
/dev/sda6         35549184 1673949183 1638400000 781.3G 83 Linux

Partition table entries are not in disk order.

I skipped the "bootloader" section of Gentoo's Handbook as I wanted to use my current grub2 install on /dev/sda1, so after finishing the installation I booted to Debian and ran update-grub, which successfully added Gentoo to the menu. However, when booting to it I get a kernel panic and a message about it not being able to open root device:

picture of the kernel panic message

fstab for Debian and fstab for Gentoo. I tried editing Gentoo's fstab to use UUIDs like Debian, to no avail. I also tried editing boot options for Gentoo in grub. Original:

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Gentoo Base System release 2.2 (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-1c46e4aa-e486-48ba-8f61-1484ed899e1e' {
        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-ieee1275='ieee1275//sas/disk@0,msdos3' --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3  1c46e4aa-e486-48ba-8f61-1484ed899e1e
        else
          search --no-floppy --fs-uuid --set=root 1c46e4aa-e486-48ba-8f61-1484ed899e1e
        fi
        linux /boot/vmlinuz-4.1.12-gentoo root=/dev/sda3
}
submenu 'Advanced options for Gentoo Base System release 2.2 (on /dev/sda3)' $menuentry_id_option 'osprober-gnulinux-advanced-1c46e4aa-e486-48ba-8f61-1484ed899e1e' {
        menuentry 'Gentoo Base System release 2.2 (on /dev/sda3)' --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.1.12-gentoo--1c46e4aa-e486-48ba-8f61-1484ed899e1e' {
                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-ieee1275='ieee1275//sas/disk@0,msdos3' --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3  1c46e4aa-e486-48ba-8f61-1484ed899e1e
                else
                  search --no-floppy --fs-uuid --set=root 1c46e4aa-e486-48ba-8f61-1484ed899e1e
                fi
                linux /boot/vmlinuz-4.1.12-gentoo root=/dev/sda3
        }
}

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

I tried using set root="/dev/sda3" and set root="sda3" but honestly I have no idea what that means, it just seemed related to the panic message. So what's going on here and how should I proceed? It's worth mentioning I'm booting from an external hard drive (/dev/sda) plugged in via USB (my internal one went kaput). Gentoo install went without any errors/warnings, and I don't think I forgot to compile anything into the kernel but I guess it's possible... ext4, SCSI and USB support I'm pretty sure was included (not as module).

4 Answers 4

1

It looks like you don't have your SATA drivers compiled into your Gentoo kernel (or compiled as a module). The line that concerns me is about half way down the screen shot you attached where it reads:

Please append a correct "root=" option; here are the available partitions:

but lists no available partitions. To me that screams of Gentoo not being able to communicate with the physical disk at all. If you don't know what kind of SATA controller you find out by running lshw in Debian. That will tell you not only what the card is but also what kernel driver (look for the "configuration: driver=" line under the SATA section) it's using so you can go add it to your Gentoo kernel.

3
  • Well I grepped the kernel config for the names after the relevant "configuration" lines but some didn't even match, though a search for a more generic term (such as storage as opposed to usb-storage) yielded results such as CONFIG_USB_STORAGE=y and # CONFIG_USB_STORAGE_X is not set. Not sure what this is telling me but it seems like everything is there. lshw and /boot/config-4.1.12-gentoo.
    – Alex
    Commented Dec 30, 2015 at 19:01
  • Are you booting off of a USB hard drive?
    – David King
    Commented Dec 31, 2015 at 1:46
  • Are you booting off of a USB hard drive? Yes.
    – Alex
    Commented Dec 31, 2015 at 10:46
1

As David King suggests, the culprit is most likely a missing kernel driver. Here is a list of kernel options needed to make usb mass storage work. Try to chroot into the gentoo system from a gentoo livecd (as you probably know this is described in detail in the Gentoo Handbook). There you can reconfigure and recompile the kernel (again described very well in the Gentoo handbook). If you created an initramfs, don't forget to recreate it because otherwise the newly compiled kernel and drivers won't be available at boot time.

1

Looking over your kernel config, it looks like you enabled everything a modern system would need to boot without an initrd but you're using an older computer; I noticed in your lshw output you have an ISA bridge and a Pentium M 1.4 CPU.

My guess is you're missing a PATA option like CONFIG_PATA_MPIIX or ATA_GENERIC or PATA_LEGACY, but instead of playing the guessing game here's what I'd do:

boot your debian system with your USB drive plugged in.
lsmod
See what you still need to add to your kernel config (=y) to get it running, or post the output and maybe we can give you some hints.

Alternately use this site, http://kmuto.jp/debian/hcl/, and paste the results of:
lspci -n

Here's how I normally configure kernels in Gentoo:

  1. boot an ArchLinux USB and lsmod
  2. copy the latest kernel config from Slackware, such as http://mirrors4.kernel.org/slackware/slackware64-current/source/k/config-x86_64/config-generic-4.1.15.x64

    Slackware is similar to Gentoo in that neither uses systemd (Gentoo doesn't by default), they use long term release kernel versions, and I've had good luck with their configs. Generic is the one that builds everything they think you'll need as =y and optional stuff as =m, huge builds everything as =y (which is almost guaranteed to work but gives you a very bloated kernel).
  3. make oldconfig
  4. Set EXT4=y and any other filesystem modules (for some reason Slackware doesn't always enable it).
  5. Ensure that you have the modules set to =y in the Gentoo Kernel Configuration Guide
  6. Set any modules from lsmod =y except ALSA and Wifi modules.
  7. Select the correct processor type in Processor type and Features->Processor Family
  8. Finish the installation.

If it still doesn't work, my guess is the drive is grabbing /dev/sda in Debian but something else (/dev/sdb maybe) in Gentoo. The easiest way to fix this is use UUID= in /etc/fstab and PARTUUID= in the bootloader args you're passing to the kernel. You can find PARTUUID from blkid output.

2
  • I took a look at lsmod and at the kernel config and everything seems to be there. I'll give the alternatives a try and report back. It's worth mentioning the PATA stuff concerns the internal hard drive (which is broken and not used), the USB one isn't PATA.
    – Alex
    Commented Jan 8, 2016 at 18:09
  • I just looked at the comment above by etherfish, and I have another idea: try passing the rootwait parameter to your kernel. It may be that the USB drive isn't initialized yet. See kernel.org/doc/Documentation/kernel-parameters.txt for more detail.
    – vik
    Commented Jan 8, 2016 at 18:42
1

USB device discovery has been an asynchronous process for a few years now. While you may have all the drivers compiled in and your screenshot does show your USB storage device being enumerated, I suspect the kernel is trying to mount the root filesystem before the USB mass storage driver has finished initializing.

Your grub config doesn't appear to specify loading an initramfs.

While I cannot advise you on gentoo specifics, I hope that the Debian system I use may be similar enough to help you find the right answer. In Debian, the initramfs scripts will stall the boot process until the necessary block device is available to be mounted.

To the best of my knowldege, in Debian, one of the core initramfs scripts, /scripts/local has the logic necessary to start udev and wait for the root device to be enumerated. Specifically, I mean the local_device_setup() function; see here.

I imagine gentoo has some analogous system?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .