[systemd-devel] Have I got circular dependencies?

Andrei Borzenkov arvidjaar at gmail.com
Sun Jan 23 19:44:20 UTC 2022


On 23.01.2022 19:42, Wols Lists wrote:
> This is probably a classic "need a clue" problem ... my system has 
> suddenly stopped booting properly, and I guess it's a problem with my 
> custom systemd service.
> 
> Basically, I've configured my raid device on top of dm-integrity, so 
> that needs to be set up before my /home becomes visible. I've tried to 
> say my integrity.service needs to run before the mdadm and lvm services.
> 
> I also seem to remember a mention of dm-integrity in recent (the 
> latest?) release notes?
> 
> The problem being I don't know what - or where - most of the system 
> systemd services and files are.
> 
> Does all this output indicate a problem with my service? Can I just 
> delete my "Before" line, bearing in mind that if the service doesn't run 
> my /home won't appear? (mdadm and lvm pick things up if I run the 
> service manually.)
> 
> And could this be why my service seems occasionally to get randomly 
> killed on boot, leading the problem I described where /home has disappeared?
> 
> Cheers,
> Wol
> 
> anthony at thewolery /etc/systemd/system $ systemctl --version
> systemd 249 (249)
> +PAM -AUDIT -SELINUX -APPARMOR +IMA +SMACK +SECCOMP +GCRYPT +GNUTLS 
> +OPENSSL +ACL +BLKID -CURL -ELFUTILS -FIDO2 +IDN2 -IDN -IPTC +KMOD 
> -LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY -P11KIT -QRENCODE -BZIP2 +LZ4 
> -XZ -ZLIB +ZSTD -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified
> anthony at thewolery /etc/systemd/system $
> 
> anthony at thewolery /etc/systemd/system $ cat integritysetup.service
> [Unit]
> Before=mdmonitor.service lvm2-lvmetad.service
> 
> [Service]
> ExecStart=/usr/local/bin/integritysetup.sh
> 
> [Install]
> WantedBy=default.target
> anthony at thewolery /etc/systemd/system $ systemctl status home.mount
> 
> 
> [    8.193416] systemd[1]: Detected architecture x86-64.
> [    8.221972] systemd[1]: Hostname set to <thewolery>.
> [    9.387275] systemd[1]: Configuration file 
> /etc/systemd/system/scarletdme.service is marked executable. Please 
> remove executable permission bits. Proceeding anyway.
> [    9.397748] systemd[1]: Configuration file 
> /etc/systemd/system/integritysetup.service is marked executable. Please 
> remove executable permission bits. Proceeding anyway.
> [    9.531750] systemd[1]: Configuration file 
> /etc/systemd/system/gentoo_root_snapshot.timer is marked executable. 
> Please remove executable permission bits. Proceeding anyway.
> [    9.563443] systemd[1]: Configuration file 
> /etc/systemd/system/gentoo_root_snapshot.service is marked executable. 
> Please remove executable permission bits. Proceeding anyway.
> [    9.610463] systemd[1]: integritysetup.service: Found ordering cycle 
> on sysinit.target/start
> [    9.610534] systemd[1]: integritysetup.service: Found dependency on 
> systemd-timesyncd.service/start
> [    9.610604] systemd[1]: integritysetup.service: Found dependency on 
> systemd-tmpfiles-setup.service/start
> [    9.610673] systemd[1]: integritysetup.service: Found dependency on 
> local-fs.target/start
> [    9.610740] systemd[1]: integritysetup.service: Found dependency on 
> home-ISO.automount/start
> [    9.610807] systemd[1]: integritysetup.service: Found dependency on 
> home.mount/start
> [    9.610872] systemd[1]: integritysetup.service: Found dependency on 
> integritysetup.service/start

Where dependency to /home comes from? It is not in your unit file.

Otherwise normal services are ordered by default after sysinit.target and
local file systems are ordered before sysinit.target so you have loop. Add
DefaultDependencies=no to your service definition.


More information about the systemd-devel mailing list