# [SOLVED]Block device /dev/sda3 is not a valid root device...

## jody

I built kernel 5.4.60 with genkernel.

At the end, there were these lines:

```

* Kernel compiled successfully

*

* --no-bootloader set: Skipping bootloader update ...

*

* Required kernel parameter:

*

*        root=/dev/$ROOT

*

* Where $ROOT is the device node for your root partition as the

* one specified in /etc/fstab

```

I added the line

```
 GRUB_CMDLINE_LINUX="root=/dev/sda3" 
```

 to /etc/default/grub and then did

```
grub-mkconfig -o /boot/grub/grub.cfg
```

When i rebooted the computer, kernel 5.4.60 was not set as the default - when i selected it from the menu there was a problem during the boot:

```
...

[    2.079676] Run /init as init process

>> Genkernel 4.1.2 (2020-10-20 06:51.21 UTC). Linux kernel 5.4.60-gentoo-x86_64

>> Acticvating udev ...

** REAL_RESUME (/dev/sda3) device not found; Skipping resume ...

>> Determining root device (trying UUID=e4a9b1b8-8a90-494f-b89c-eb7838c9435d) ...

>> Root device detected as /dev/sda3!

>> Mounting /dev/sda3 as root ...

>> Using mount -t auto -o ro /dev/sda3 /newroot

mount: mounting /dev/sda3 on /newroot failed: No such file or directory

!! Could not mount specified $ROOT

!! Block device /dev/sda3 is not a valid root device ...

!! Could not find the root block device in /dev/sda3.

!! Please specify another value or:

!! - press Enter for the same

!! - type "shell" for a shell

!! - type q to skip ...

root block device(/dev/sda3) ::
```

(i selected to press Enter)

It then went on normally:

```
root block device(/dev/sda3) ::

>> Determining root device (trying /dev/sda3) ...

>> Root device detected as /dev/sda3!

>> Mounting /dev/sda3 as root ...

>> Using mount -t ext4 -o ro /dev/sda3 /newroot

>> Switching to real root: switch_root /newroot /sbin/init

INIT: version 2.93 booting

...
```

So the first time it tries with the UUID (which *is* the one of /dev/sda3), mounts with -t auto and fails, whereas the second time it tries with /dev/sda3, mounts with -t ext4 and succeeds.

Is there a way to prevent this interruption of the boot process?

(and is there a way: to make the newest kernel the default one in the grub menu?)Last edited by jody on Wed Oct 28, 2020 2:20 pm; edited 1 time in total

----------

## NeddySeagoon

jody,

What media is /dev/sda ?

I suspect you have a race for some reason and the kernel tries to mount root before the device is ready.

Add rootwait to your kernel command line in grub.cfg

If root never becomes available, the kernel will wait forever.

----------

## jody

hi neddy

/dev/sda is a solid state disk.

The problem i described did not occur with older kernels.

But i will try your suggestion.

----------

## NeddySeagoon

jody,

A few things.

1. I have a couple of SSDs that don't come ready until they have completed trimming, if trimming was triggered just before power off.

One of them can take 10 minutes or so. It was a bit of a fright the first time. :)

2. Its possible that the new kernel actually starts faster than the old kernels and it really is ready to mount root before your SSD is ready.

rootwait will fix that. This will be a race condition.

It may be worth a bug at bugs.gentoo.org.

In the bug, describe how you make your kernel and attach the non working kernel config file to the bug.

----------

## jody

Unfortunately, rootwait did not change the behaviour.

With "kernel config file" to attach to the bug report,  you mean /boot/grub/grub.cfg?

----------

## NeddySeagoon

jody,

The kernel .config file is at /usr/src/linux/.config

/boot/grub/grub.cfg is your grub config.

Both would be worth seeing. 

Use wgetpaste to put them onto a pastebin site and post links here.

Also put the output of 

```
lspci -nnk
```

into your post.

How did you add rootwait to the kernel command line?

----------

## Whissi

```
Using mount -t auto -o ro /dev/sda3 /newroot
```

This indicates that initramfs was unable to determine filesystem. Please tell us which filesystem you are using for root.

If /dev/sda3 is really present in rescue shell in this moment, try add 

```
rootfstype=<used filesystem>
```

 to kernel command-line to trigger module loading.

If nothing works, please create gksosreport.

----------

## jody

I am using /dev/sda3 for root. 

After the interruption, when i press Enter it can successfully mount /dev/sda3 (as is the case with older gentoo kernels - without interruption).

But adding 'rootfstype=/dev/sda3' changed nothing: i still get the prompt during boot, and when i press Return, it happily continues booting (successfully mounting /dev/sda3).

In the rescue shell (the one started after i type 'shell' at the interruption of the boot process), /dev/sda3 is listed when i do 'ls /dev'

The gksosreport.txt was created automatically in /run/initramfs, and it was still there when i exited the rescue shell and it finished booting.

Its size is 104K, so i hesitate to insert the entire file contents to this post.

But here are some parts of gksosreport.txt that deal with /dev/sda

```
genkernel SOS report from 2020-10-27 10:45:35:

+ cat /lib/dracut/dracut-gk-version.info

Genkernel 4.1.2 (2020-10-20 11:55:43 UTC)

+ cat /lib/dracut/build-parameter.txt

--boot-font=none --keymap --compress-initramfs --no-microcode-initramfs --ramdisk-modules --busybox --no-bcache --no-b2sum --no-btrfs --no-iscsi --no-multipath --no-dmraid --no-mdadm

 --no-lvm --no-unionfs --no-zfs --no-splash --no-strace --no-gpg --no-luks --no-firmware --firmware-dir=/lib/firmware --no-ssh --no-e2fsprogs --no-xfsprogs

+ cat /proc/cmdline

+ sed -e 's/\(ftp:\/\/.*\):.*@/\1:*******@/g;s/\(cifs:\/\/.*\):.*@/\1:*******@/g;s/cifspass=[^ ]*/cifspass=*******/g;s/iscsi:.*@/iscsi:******@/g;s/rd.iscsi.password=[^ ]*/rd.iscsi.pa

ssword=******/g;s/rd.iscsi.in.password=[^ ]*/rd.iscsi.in.password=******/g'

BOOT_IMAGE=/boot/vmlinuz-5.4.60-gentoo-x86_64 root=UUID=e4a9b1b8-8a90-494f-b89c-eb7838c9435d ro root=/dev/sda3 rootwait rootfstype=/dev/sda3 resume=/dev/sda3 rootwait rootfstype=/dev

/sda3

+ '[' -f /etc/cmdline ]

+ lspci -k

16:0e.2 Class 0880: 8086:208e

03:00.0 Class 0604: 1a03:1150

---(snip)---

+ blkid

/dev/sda1: UUID="7713-76EE" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="uefi" PARTUUID="2e39208a-09f5-476d-9e22-54b8d61c200d"

/dev/sda2: UUID="32f1ded2-e850-4a6b-9ff6-04d3f072fb36" TYPE="swap" PARTLABEL="swap" PARTUUID="8d05f859-c48f-4f2e-bfcb-32fdf5a07749"

/dev/sda3: UUID="e4a9b1b8-8a90-494f-b89c-eb7838c9435d" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="rootfs" PARTUUID="e28625c1-0356-4a4f-a2c9-c3aa3ab03ec2"

/dev/sdb1: UUID="924ce722-fd7e-435b-b998-fe6caf3a3ed9" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="3573cd9e-a5d7-1b41-a856-091ca593b90e"

---(snip)---

+ ls -l /dev/disk/by-id /dev/disk/by-partlabel /dev/disk/by-partuuid /dev/disk/by-uuid

/dev/disk/by-id:

lrwxrwxrwx    1 root     root             9 Oct 27 10:45 ata-INTEL_SSDSC2KB960G7_PHYS751104L9960CGN -> ../../sda

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 ata-INTEL_SSDSC2KB960G7_PHYS751104L9960CGN-part1 -> ../../sda1

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 ata-INTEL_SSDSC2KB960G7_PHYS751104L9960CGN-part2 -> ../../sda2

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 ata-INTEL_SSDSC2KB960G7_PHYS751104L9960CGN-part3 -> ../../sda3

lrwxrwxrwx    1 root     root             9 Oct 27 10:45 ata-ST4000DM004-2CV104_WFN1NVD1 -> ../../sdb

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 ata-ST4000DM004-2CV104_WFN1NVD1-part1 -> ../../sdb1

lrwxrwxrwx    1 root     root             9 Oct 27 10:45 wwn-0x5000c500c023051f -> ../../sdb

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 wwn-0x5000c500c023051f-part1 -> ../../sdb1

lrwxrwxrwx    1 root     root             9 Oct 27 10:45 wwn-0x55cd2e414f085ec0 -> ../../sda

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 wwn-0x55cd2e414f085ec0-part1 -> ../../sda1

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 wwn-0x55cd2e414f085ec0-part2 -> ../../sda2

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 wwn-0x55cd2e414f085ec0-part3 -> ../../sda3

/dev/disk/by-partlabel:

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 rootfs -> ../../sda3

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 swap -> ../../sda2

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 uefi -> ../../sda1

/dev/disk/by-partuuid:

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 2e39208a-09f5-476d-9e22-54b8d61c200d -> ../../sda1

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 3573cd9e-a5d7-1b41-a856-091ca593b90e -> ../../sdb1

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 8d05f859-c48f-4f2e-bfcb-32fdf5a07749 -> ../../sda2

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 e28625c1-0356-4a4f-a2c9-c3aa3ab03ec2 -> ../../sda3

/dev/disk/by-uuid:

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 32f1ded2-e850-4a6b-9ff6-04d3f072fb36 -> ../../sda2

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 7713-76EE -> ../../sda1

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 924ce722-fd7e-435b-b998-fe6caf3a3ed9 -> ../../sdb1

lrwxrwxrwx    1 root     root            10 Oct 27 10:45 e4a9b1b8-8a90-494f-b89c-eb7838c9435d -> ../../sda3

---(snip)---

+ sed -e 's/\(ftp:\/\/.*\):.*@/\1:*******@/g;s/\(cifs:\/\/.*\):.*@/\1:*******@/g;s/cifspass=[^ ]*/cifspass=*******/g;s/iscsi:.*@/iscsi:******@/g;s/rd.iscsi.password=[^ ]*/rd.iscsi.password=******/g;s/rd.iscsi.in.password=[^ ]*/rd.iscsi.in.password=******/g'

[    0.000000] Linux version 5.4.60-gentoo-x86_64 (root@aim-frog) (gcc version 9.3.0 (Gentoo 9.3.0-r1 p3)) #1 SMP Tue Oct 20 13:38:34 CEST 2020

[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.4.60-gentoo-x86_64 root=UUID=e4a9b1b8-8a90-494f-b89c-eb7838c9435d ro root=/dev/sda3 rootwait rootfstype=/dev/sda3 resume=/dev/sda3 rootwait rootfstype=/dev/sda3

[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'

---(snip)---

[    0.247952] Policy zone: Normal

[    0.247953] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.4.60-gentoo-x86_64 root=UUID=e4a9b1b8-8a90-494f-b89c-eb7838c9435d ro root=/dev/sda3 rootwait rootfstype=/dev/sda3 resume=/dev/sda3 rootwait rootfstype=/dev/sda3

[    0.248027] printk: log_buf_len individual max cpu contribution: 32768 bytes

[    0.248027] printk: log_buf_len total cpu_extra contributions: 1146880 bytes

---(snip)---

[    3.389028] ata4: SATA link down (SStatus 4 SControl 300)

[    3.389129] ata6: SATA link down (SStatus 4 SControl 300)

[    3.389163] ata3: SATA link down (SStatus 4 SControl 300)

[    3.389193] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)

[    3.389286] ata5: SATA link down (SStatus 4 SControl 300)

[    3.389335] ata1.00: ATA-10: INTEL SSDSC2KB960G7, SCV10142, max UDMA/133

[    3.389339] ata1.00: 1875385008 sectors, multi 1: LBA48 NCQ (depth 32)

[    3.389365] ata2: SATA link up 6.0 Gbps (SStatus 133 SControl 300)

[    3.389458] ata1.00: configured for UDMA/133

[    3.389891] scsi 0:0:0:0: Direct-Access     ATA      INTEL SSDSC2KB96 0142 PQ: 0 ANSI: 5

[    3.396097] ata1.00: Enabling discard_zeroes_data

[    3.396305] sd 0:0:0:0: [sda] 1875385008 512-byte logical blocks: (960 GB/894 GiB)

[    3.396309] sd 0:0:0:0: [sda] 4096-byte physical blocks

[    3.396337] sd 0:0:0:0: [sda] Write Protect is off

[    3.396341] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00

[    3.396384] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

[    3.411397] ata1.00: Enabling discard_zeroes_data

[    3.413377]  sda: sda1 sda2 sda3

[    3.414415] ata1.00: Enabling discard_zeroes_data

[    3.414679] sd 0:0:0:0: [sda] Attached SCSI disk

[    3.427162] ata2.00: ATA-10: ST4000DM004-2CV104, 0001, max UDMA/133

[    3.427165] ata2.00: 7814037168 sectors, multi 16: LBA48 NCQ (depth 32), AA

---(snip)---

[    6.239544] device-mapper: ioctl: 4.41.0-ioctl (2019-09-16) initialised: dm-devel@redhat.com

+ '[' -f /run/initramfs/init.log ]

+ cat /run/initramfs/init.log

+ sed -e 's/\(ftp:\/\/.*\):.*@/\1:*******@/g;s/\(cifs:\/\/.*\):.*@/\1:*******@/g;s/cifspass=[^ ]*/cifspass=*******/g;s/iscsi:.*@/iscsi:******@/g;s/rd.iscsi.password=[^ ]*/rd.iscsi.password=******/g;s/rd.iscsi.in.password=[^ ]*/rd.iscsi.in.password=******/g'

[ 2020-10-27 10:45:31.580887 ] Executed: 'busybox --install -s'

[ 2020-10-27 10:45:31.584806 ] Executed: 'rm /linuxrc'

[ 2020-10-27 10:45:31.587236 ] Executed: 'mkdir -p /etc/cmdline /etc/modprobe.d'

[ 2020-10-27 10:45:31.588669 ] [OK] Genkernel 4.1.2 (2020-10-20 11:55:43 UTC). Linux kernel 5.4.60-gentoo-x86_64

[ 2020-10-27 10:45:32.268602 ] Executed: 'mount -t devtmpfs -o exec,nosuid,mode=0755,size=10M udev /dev'

[ 2020-10-27 10:45:32.272345 ] Executed: 'mkdir -m 0755 /dev/pts'

[ 2020-10-27 10:45:32.275246 ] Executed: 'mount -t devpts -o gid=5,mode=0620 devpts /dev/pts'

[ 2020-10-27 10:45:32.277618 ] Executed: 'mkdir -m 1777 /dev/shm'

[ 2020-10-27 10:45:32.280339 ] Executed: 'mount -t tmpfs -o mode=1777,nosuid,nodev,strictatime tmpfs /dev/shm'

[ 2020-10-27 10:45:32.282984 ] Executed: 'mount -t sysfs sysfs /sys -o noexec,nosuid,nodev'

[ 2020-10-27 10:45:32.284629 ] [OK] Activating udev ...

[ 2020-10-27 10:45:32.293230 ] Executed: 'udevd --resolve-names=never --daemon'

[ 2020-10-27 10:45:32.330969 ] Executed: 'udevadm trigger --action=add'

[ 2020-10-27 10:45:32.545853 ] Executed: 'udevadm settle --timeout=120'

[ 2020-10-27 10:45:32.561187 ] Executed: 'udevadm settle --timeout=120'

[ 2020-10-27 10:45:32.564462 ] [**] REAL_RESUME (/dev/sda3) device not found; Skipping resume ...

[ 2020-10-27 10:45:32.568794 ] Executed: 'mkdir -p /newroot'

[ 2020-10-27 10:45:32.572029 ] [OK] Determining root device (trying /dev/sda3) ...

[ 2020-10-27 10:45:32.886883 ] [OK] Root device detected as /dev/sda3!

[ 2020-10-27 10:45:32.891500 ] [OK] Mounting /dev/sda3 as root ...

[ 2020-10-27 10:45:32.898566 ] [OK] Using mount -t /dev/sda3 -o ro /dev/sda3 /newroot

[ 2020-10-27 10:45:32.908510 ] Failed (255): 'mount -t /dev/sda3 -o ro /dev/sda3 /newroot'

[ 2020-10-27 10:45:32.909874 ] [!!] Could not mount specified ROOT!

[ 2020-10-27 10:45:32.914379 ] [!!] Block device /dev/sda3 is not a valid root device ...

[ 2020-10-27 10:45:32.918083 ] [!!] Could not find the root block device in /dev/sda3.

[ 2020-10-27 10:45:32.921596 ] [!!] Please specify another value or:

[ 2020-10-27 10:45:32.925110 ] [!!] - press Enter for the same

[ 2020-10-27 10:45:32.928617 ] [!!] - type "shell" for a shell

[ 2020-10-27 10:45:32.931907 ] [!!] - type "q" to skip ...

[ 2020-10-27 10:45:35.587870 ] [**] To leave and try again just press <Ctrl>+D

```

How can i best provide the entire gksosreport.txt?

----------

## Anon-E-moose

 *jody wrote:*   

> But adding 'rootfstype=/dev/sda3' changed nothing: i still get the prompt during boot, and when i press Return, it happily continues booting (successfully mounting /dev/sda3).

 

You're right it won't do anything because /dev/sda3 IS NOT a fs type   :Rolling Eyes: 

Edit to add: fstype would be ramfs, ext[234], btrfs, etc,

ETA2: looking back at the posts in this thread sda3 is ext4 so rootfstype=ext4

But I'm wondering if you have ext4 built in or as a module, if a module then it needs to be in the initramfs.

edit to remove my stupid comment.   :Laughing: 

----------

## Whissi

Do upload to gist.github.com or services like https://0x0.st.

Like Anon-E-moose said, your rootfstype value must be ext4.

----------

## jody

 *Quote:*   

> You're right it won't do anything because /dev/sda3 IS NOT a fs type 

 

 :Embarassed:  How embarrassing!  :Embarassed: 

Now that i changed that to rootfstype=ext4 booting works without interruptions. Thanks!

I only wonder whay booting kernel 4 on the same system does not need the rootfstype....

----------

## Anon-E-moose

 *jody wrote:*   

> I only wonder whay booting kernel 4 on the same system does not need the rootfstype....

 

Is ext4 builtin or module, in both the new kernel and the old 4 kernel

Edit to add: just a guess that it might have something to do with the above question, but I don't use dracut or an initramfs so I don't know what all changed between kernel 4.* and 5.*

----------

## Whissi

 *jody wrote:*   

> I only wonder whay booting kernel 4 on the same system does not need the rootfstype....

 I can explain this: Genkernel ships a file called modules_load where we try to add all modules which can be required to get a system up and running. We called this 'hardware detection feature' but in reality it never detected anything. It was just loading every module all the time. So if you were using a generic kernel config with a lot of modules for hardware you don't even have, we still loaded these modules.

With genkernel-4 I tried to make this a little bit more intelligent: For example we stopped loading network drivers all the time - only when you used a feature requiring network in initramfs (like sshd or network boot) we loaded network stuff. In addition, processing of modules_load file, i.e. loading of every module listed in that file, were stopped once specified root became available. This improved startup time for some setups.

But in case your root was encrypted we still had to load every module because root never became available...

Now since we moved back to udev, we can rely on udev to load required stuff.

However, there's a problem when used filesystem is a module: 

```
mount -t auto
```

 will not trigger module loading whereas 

```
mount -t ext4
```

would trigger loading of ext4 filesystem. To address this we are trying to determine used file system, however this doesn't work in all scenarios. To be honest, at this point I don't understand why it is failing for you because your setup looks very simple (according to shown logs just /dev/sdaX with ext4) but in such a case you have to specify rootfstype on kernel command-line to give kernel a hint (or built-in used filesystem into kernel). There is also a kernel command-line argument 

```
gk.hw.use-modules_load=yes
```

 to trigger old behavior, i.e. load every module listed in modules_load or you could specify 

```
firstmods=mymodule1,mymodule2
```

 to force genkernel's initramfs to load a specific module(s) manually even before udev starts (this is for example actually required for specific BTRFS setups with subvolumes).

----------

