Fixing a slow boot hanging at 'a start job is running for dev-disk-by...'

“A start job is running for dev-disk-by…” means that systemd is hanging on disk setup because of a miss-configuration

Usual situation :

We need to check the UUIDs under those files (details)


Alternative situation I - Udev :

This could be caused by udev if you have a rule script under /etc/udev/rules.d/ that is not meant to run at boot time, if the script fail it will make that fstab step go on forever, just edit your script to match your needs or delete it.

Alternative situation II - Crypted Dev :

Crypted partitions can be confusing because the main partition have an UUID and the mapped Decrypted one have an other UUID different from the main one for a single partition they have to be defined in different place etc/crypttab and /etc/fstab

# lsblk -o name,uuid,mountpoint
├─sda2                         727fa348-8804-4773-ae3d-f3e176d12dac
│ └─sda2_crypt (dm-0)          P1kvJI-5iqv-s9gJ-8V2H-2EEO-q4aK-sx4aDi

Real UUID need to be specified in etc/crypttab

# cat /etc/crypttab
sda2_crypt  UUID=727fa348-8804-4773-ae3d-f3e176d12dac  none  luks

Virtual UUID need to be at /etc/fstab

# cat /etc/fstab
UUID=P1kvJI-5iqv-s9gJ-8V2H-2EEO-q4aK-sx4aDi / ext4 defaults,errors=remount-ro 0 1

Alternative situation III - Ghost Dev :

A device that is setup to be mounted at boot time but is not present in the system or detached like an usb drive.

Checkout real connected devices with lsblk -o name,uuid,mountpoint and edit /etc/fstab to keep only the connected device OR leave the unconnected device there but set them up to be ignored at boot with the option noauto and set the line like this

UUID=BLA-BLA-BLA /mount ext4 option,noauto,option 0 0

Checking the system logs

journalctl -ab 

systemd-analyze blame

systemd-analyze critical-chain

systemctl status dev-mapper-crypt_sda2.device

systemctl status systemd-udev-settle.service

Share this post on:

Related posts:

Forcing a custom disk encryption on Google's Cloud KVM
Serious backup options for linux