migmedia.net

lost+found

Race condition while booting systemd with zfs-root

2020-01-24
Tags: zfs, systemd

I solved a long annoying boot-problem happened in the systemd-async-boot-process.

Adding a sleeptime in /lib/systemd/system/systemd-udev-settle.service by adding ExecStartPre=/usr/bin/sleep 5 to the [Service]-Section, gives the system 5 sec. more time to load the zfs-module and import the pool before it tries to remount root to the real directory on disk.

[Unit]
Description=udev Wait for Complete Device Initialization
Documentation=man:systemd-udev-settle.service(8)
DefaultDependencies=no
Wants=systemd-udevd.service
After=systemd-udev-trigger.service
Before=sysinit.target
ConditionPathIsReadWrite=/sys

[Service]
Type=oneshot
TimeoutSec=180
RemainAfterExit=yes
ExecStartPre=/usr/bin/sleep 5
ExecStart=/bin/udevadm settle

I found this solution at the github.com/zfsonlinux bugtracker: ZOL 0.8 Not Loading Modules or ZPools on Boot #8885