You are not logged in.

#1 2020-12-21 23:32:16

jernst
Member
From: Silicon Valley
Registered: 2014-03-04
Posts: 307

[Solved] Root partition takes too long; emergency shell

Summary:

I have my boot loader and kernel on an SD card, and the root filesystem on a (large) spinning HD which takes awhile to come up. Boot fails with "device not found" before the partition is recognized.

Relevant log:

[    6.183536] Btrfs loaded, crc32c=crc32c-generic
[    6.188901] BTRFS: device label root devid 1 transid 25 /dev/mmcblk0p2
Waiting 10 seconds for device /dev/disk/by-path/platform-xhci-hcd.2.auto-usb-0:1:1.0-scsi-0:0:0:0-part1 ...
[   15.240705] sd 0:0:0:0: [sda] Spinning up disk...
ERROR: device '/dev/disk/by-path/platform-xhci-hcd.2.auto-usb-0:1:1.0-scsi-0:0:0:0-part1' not found. Skipping fsck.
:: mounting '/dev/disk/by-path/platform-xhci-hcd.2.auto-usb-0:1:1.0-scsi-0:0:0:0-part1' on real root
mount: /new_root: special device /dev/disk/by-path/platform-xhci-hcd.2.auto-usb-0:1:1.0-scsi-0:0:0:0-part1 does not exist.
You are now being dropped into an emergency shell.
sh: can't access tty; job control turned off
[rootfs ]# [   18.274897] .
[   21.748872] ready
[   21.751649] sd 0:0:0:0: [sda] 15628053168 512-byte logical blocks: (8.00 TB/7.28 TiB)
[   21.758712] sd 0:0:0:0: [sda] 4096-byte physical blocks
[   21.764141] sd 0:0:0:0: [sda] Write Protect is off
[   21.769098] sd 0:0:0:0: [sda] Disabling FUA
[   21.772835] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[   21.782256] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a multiple of physical block size (4096 bytes)
[   22.086071]  sda: sda1 sda2
[   22.089588] sd 0:0:0:0: [sda] Attached SCSI disk
[   22.567810] BTRFS: device label root devid 1 transid 32 /dev/sda1

I can hear the speed of the drive, and it indeed sounds like it isn't all the up before time=21sec or so. /dev/disk/by-path/platform-xhci-hcd.2.auto-usb-0:1:1.0-scsi-0:0:0:0-part1 is the same as /dev/sda1.

Relevant part of the kernel command-line:

rootfstype=btrfs root=/dev/disk/by-path/platform-xhci-hcd.2.auto-usb-0:1:1.0-scsi-0:0:0:0-part1 rw rootwait init=/usr/lib/systemd/systemd mount.timeout=300s"

Neither "rootwait" nor "mount.timeout" seems to have an effect on the 10 seconds it says it wants to wait. Am I misunderstanding these options?

How do I get this to wait for longer? It works with a faster disk, and I can mount the disk from the emergency shell.

P.S. No, I don't want to move things off the SD card. This question is about how to use these kernel parameters correctly.

Last edited by jernst (2020-12-22 04:34:31)

Offline

#2 2020-12-22 03:26:14

mozurin
Member
Registered: 2020-12-13
Posts: 9

Re: [Solved] Root partition takes too long; emergency shell

The wait seems to be done by poll_device() function which mkinitcpio provides.
So the configuration you should change would be the "rootdelay" value, written in this document.

Offline

#3 2020-12-22 04:34:15

jernst
Member
From: Silicon Valley
Registered: 2014-03-04
Posts: 307

Re: [Solved] Root partition takes too long; emergency shell

Ah! I don't actually have a mkinitcpio, but the kernel takes the same argument. And it appears that the command-line documentation I found is slightly misleading. It says:

rootdelay=      [KNL] Delay (in seconds) to pause before attempting to
                        mount the root filesystem

but it should say:

rootdelay=      [KNL] Maximum delay (in seconds) to pause until giving up on
                        mounting the root filesystem

In other words, it proceeds earlier if it can, which is what I want.

Offline

Board footer

Powered by FluxBB