Repository navigation
Description
Sometimes, upon reboot, I see this timeout error. I couldn't figure out what's causing it: other than systemd printing the error and putting me into emergency mode everything looks fine. In particular, if I quit the emergency mode with Ctrl+d, boot continues and the partition in question gets mounted properly.
Content of /etc/fstab:
#
# /etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
UUID=443bd794-4b17-4bf2-8801-b0d5cf1c3432 / btrfs rw,noatime,autodefrag,compress=zstd 0 0
UUID=664cfee5-16d7-4e43-933a-ca2e1e25d72f /boot ext4 defaults,noatime 0 2
UUID=024D-8283 /boot/efi vfat defaults 0 1
# a dir we're using for development purposes
tmpfs /mnt/block_dev tmpfs rw,nosuid,nodev,noatime,size=500M 0 0
# UUID=dbb01c54-a041-4d53-8a6e-847d0e2c4570 none swap defaults 0 0
lsblk -f output after quitting "emergency mode", and getting booted:
$ lsblk -f
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
sda
├─sda1 vfat ESP 024D-8283 572M 4% /boot/efi
├─sda2 ext4 664cfee5-16d7-4e43-933a-ca2e1e25d72f 314M 20% /boot
├─sda3 swap 817bb5c9-e259-4139-b3e4-c2ae5c9232ed [SWAP]
└─sda4 btrfs 443bd794-4b17-4bf2-8801-b0d5cf1c3432 618.3G 33% /
sr0
systemd version the issue has been seen with
243.51 (and older, possibly everywhere)
Used distribution
Archlinux
Expected behaviour you didn't see
No
Timed out waiting for deviceerror
Unexpected behaviour you saw
"Timed out" error appears, and systemd stops booting and quits to emergency mode. Relevant lines from ournalctl:
окт 15 09:37:08 constantine-N61Ja systemd[1]: dev-disk-by\x2duuid-024D\x2d8283.device: Job dev-disk-by\x2duuid-024D\x2d8283.device/start timed out. окт 15 09:37:08 constantine-N61Ja systemd[1]: Timed out waiting for device /dev/disk/by-uuid/024D-8283. окт 15 09:37:08 constantine-N61Ja systemd[1]: Dependency failed for File System Check on /dev/disk/by-uuid/024D-8283. окт 15 09:37:08 constantine-N61Ja systemd[1]: Dependency failed for /boot/efi. окт 15 09:37:08 constantine-N61Ja systemd[1]: Dependency failed for Local File Systems. окт 15 09:37:08 constantine-N61Ja systemd[1]: local-fs.target: Job local-fs.target/start failed with result 'dependency'. окт 15 09:37:08 constantine-N61Ja systemd[1]: local-fs.target: Triggering OnFailure= dependencies. окт 15 09:37:08 constantine-N61Ja systemd[1]: boot-efi.mount: Job boot-efi.mount/start failed with result 'dependency'. окт 15 09:37:08 constantine-N61Ja systemd[1]: systemd-fsck@dev-disk-by\x2duuid-024D\x2d8283.service: Job systemd-fsck@dev-disk-by\x2duuid-024D\x2d8283.service/start failed with result 'dependency'. окт 15 09:37:08 constantine-N61Ja systemd[1]: dev-disk-by\x2duuid-024D\x2d8283.device: Job dev-disk-by\x2duuid-024D\x2d8283.device/start failed with result 'timeout'. окт 15 09:37:08 constantine-N61Ja systemd[1]: dev-disk-by\x2duuid-664cfee5\x2d16d7\x2d4e43\x2d933a\x2dca2e1e25d72f.device: Job dev-disk-by\x2duuid-664cfee5\x2d16d7\x2d4e43\x2d933a\x2dca2e1e25d72f.device/start timed out.
Steps to reproduce the problem
- Reboot the laptop
Activity
poettering commentedon Oct 23, 2019
So what does "udevadm info /dev/disk/by-uuid/024D-8283" say?
the question is why that device never shows up?
Do you have any weird kind of storage? lvm? raid? …
Hi-Angel commentedon Oct 23, 2019
Sorry, it's a work laptop that I'll have access to again in November. Sorry for the delay.
Hi-Angel commentedon Oct 30, 2019
Nope. As you can see in my
fstabandlsblk -foutputs, the setup is really simple.poettering commentedon Nov 3, 2019
that output is that from a boot where the device timed out, or from a boot where everyhing worked? I am only interested in the former...
Hi-Angel commentedon Nov 5, 2019
I think so, yes, but now that you ask I'm not sure. Either way, here's an output that is for sure from a boot when device timed out:
Hi-Angel commentedon Nov 5, 2019
Btw, it's interesting that I see in
journalctleven 2 "devices" timed out:Hi-Angel commentedon Feb 12, 2020
Update: I recently learned about kexec way of quick reboot, which I've used some minutes ago. And upon booting I got a freeze for about 20 seconds. I was about to use hard reset when boot continued with the similar
timed out waiting for deviceerror. Except this time it was SWAP partition, it wasn't EFI partition.Hi-Angel commentedon Feb 12, 2020
Btw, I figured there's still "needs reporter feedback" label, can please someone remove it? You can delete this comment too.
Kipparis commentedon Mar 15, 2020
I had basically same issue. The problem was in installed automount rules from here.
Once they are removed, the problem wasn't appear any more.
In sum: maybe you have something that affects mounting drives
Hi-Angel commentedon Mar 15, 2020
I don't have this package installed, nor I have been rewriting udev rules. I don't see anything similar in my situation.
Hi-Angel commentedon Apr 7, 2020
Okay, so, good news is that as of systemd 245, upon getting the error
Timed out waiting for device, systemd does not bail to emergency mode anymore. So won't scare off less knowledgeable users.64 remaining items
PlaidCat commentedon May 18, 2022
(redacted)
None of this data has what I expected in it. I'm going to have to sort this out its seems like i launched the wrong AMI's now.
The most recent builds the AMI's were incorrectly built, need to look into why that is, apologies.
I know this is less than ideal but here are the full
journalctl -o short-rpecisedumps that have both theswitchrootand dracut stuff in them from here: #13775 (comment)failing_journalctl_short-precise.txt.gz
working_journalct_short-precise.txt.gz
If these don't have the data your looking for the the diff I did to validate that the
/run/path had a subset of data in/var/log/is flawed and I am not sure what I should be looking foreffectively
diff $(journalctl -D /run/log/journal/ec2a2fd0fa29ac3e5497aa58d0df4997 | egrep -i "initrd|switching root|dracut") $(journalctl | egrep -i "initrd|switching root|dracut")PlaidCat commentedon May 20, 2022
@daandemeyer
I think we have at least found the commit that fixes the problem we've been experiencing.
75d7b59
0% failure bd144c9 (head when built the other day)
0% failure 75d7b59 (suspected fix)
5% failure f33bc87 (parent of fix)
I when I saw the above commit last week I believed it would work but I was actually not building the image correctly so my comments here are with incorrect data: #13775 (comment)
I believe this issue might be a similar but different to the original issue: #12953
I would appreciate if anyone else following this could confirm if their issues are resolved with the 75d7b59 commit.
yuwata commentedon May 20, 2022
Oh, good news. But I have no idea why the commit fixes this issue.
daandemeyer commentedon May 20, 2022
I can confirm from the latest logs provided (before the potential fix commit was introduced) that in the failing case, mount_add_device_dependencies() is never called (not in the initrd and not after switching root) whereas in the working case it is called a few times, and eventually adds the expected device dependencies.
We should probably add some trace/debug logging to device_coldplug() and device_update_found_one() to make this stuff easier to debug in the future.
PlaidCat commentedon May 20, 2022
Yeah, I can add some debugging instrumentation into to validate that we're hitting the fix you committed @yuwata
My suspicion over two weeks ago but publicly commented 14 days ago was that something started "operating" on the device then during a reload and wasn't "reset" or became "lost". #13775 (comment)
I've only just now started to understand the underlying state machine for the devices and what we're seeing was reminiscent of some the
unit_catchuppatches a colleague had to back port into one of our sustaining OS releases. If I would have known then what I know now I might have found the issue #12953 .This is why I'm not sure if this is just another observation of the same issue or I jumped into the wrong issue.
PlaidCat commentedon May 27, 2022
Hi, wanted to an update before taking some leave, I will return to this.
I've been instrumenting the call chain and here are the major differences I'm noticing but have more questions now.
I've specifically been working against the following commit because it still exhibits the issues. https://github.com/systemd/systemd/blob/f33bc87989a87475ed41bc9cd715c4cbb18ee389/src/core/device.c
device.c.diff.gz
I have been made aware of the regression with 75d7b59 and am following the upstream updates.
Effectively what I've found is that if we enter
device_catchup()ifd->enumerated_found()is not3ieDEVICE_FOUND_UDEV|DEVICE_FOUND_MOUNTwe don't get a successful (ie device is mounted)dev-nvme0n1p128.device: Changed dead -> plugged, this makes sense to me as/dev-nvme0n1p128wouldn't be in/proc/self/mountHowever what I've been seeing is that the
MANAGER_IS_USER()is constantly true and it seem that when the pid changes it has a non-zero chance of losing the previousd->foundstate. You can see in the below whensysetmd[pid]changes sometimes it keeps the d->found state so whendevice_update_found_one()runs with1689and1738it doesn't try to change the state because thed->foundis set to what the newnfound state mask is so it returns void out of that however in1808it seems to lose the d->found state but is able to find everything and we're good.In the FAILING case we never get the
DEVICE_FOUND_MOUNTfound state and it seems to lose its state every time the PID changes.I can also log into the failed host and run
sudo systemctl restart local-fs.targetand the/boot/efigets mounted as it should (journal included in the failing host at the instance level "first-boot" is from the automation)Question
Is there something I should be looking for in these MANAGER_IS_USER() pids?
I was going to continue call chain instrumentation, but I think I need to look for the
DEVICE_FOUND_MOUNTand how that gets set?Are there any thoughts on where to dig in next?
successful boot
working.tar.gz
Failing Boot
failing.tar.gz
Resources:
working.tar.gz
failing.tar.gz
device.c.diff.gz
bsmojver commentedon Jun 6, 2022
Taking device_coldplug() function from tip of stable and applying to to both 248.10 and 249.11 solved that issue for me, with no other changes.
yuwata commentedon Jun 28, 2022
OK. Still I do not know how, but luckily this is already fixed. Closing.
bsmojver commentedon Aug 10, 2022
@yuwata, could you please backport this to 250. Pull request is systemd/systemd-stable#217.
I am specifically talking about these commits:
75d7b59
4fc69e8
I did some recent testing on AL2022 AMIs and patches worked around the issue with both 250.7 and 250.8 version of systemd. I also tested with latest F36 AMIs (they come with 250.8) and they seem to be no worse with these patches. Both images with patched systemd and vanilla ones end up in about 0.1% boot failure rate, likely caused by other issues.
core: Add trace logging to mount_add_device_dependencies()