FULL AI ANALYSIS

systemd socket-activated service times out after moving /var to separate partition

Generated Oct 3, 2026, 12:35:03 AM

Analysis summary

Socket activation can fail if systemd creates the listening socket path in /var/run before /var is mounted; systemd evaluates unit dependencies and by default may activate sockets early. The observed 'No such file or directory' indicates the directory under /var does not exist at socket activation time. Adding ordering to the socket unit or ensuring the socket path is on a filesystem available early are typical remedies. Care must be taken to not create dependency loops between mount and socket units.

Possible causes

mydaemon.socket lacks an explicit dependency on local-fs.target or the specific mount unit for /var, so socket activation occurs before /var is mounted

100%

The socket path is inside /var; when /var is a late-mounted filesystem the directory doesn't exist at activation time

95%

Incorrect fstab options (noauto or improper systemd automount settings) change mount ordering and cause race conditions

20%

Suggested fixes

1

Diagnostic step 1

Modify mydaemon.socket: add 'After=var.mount' and 'Requires=var.mount' (replace var.mount with the actual mount unit name from systemctl list-units --type=mount) so socket activation waits for the /var mount — this is reversible (systemctl daemon-reload after edits)

2

Diagnostic step 2

Alternatively move the socket path to /run (tmpfs mounted early) and create a small drop-in for mydaemon.service specifying ListenStream=/run/mydaemon.sock; after confirming, create a symlink or tmpfiles.d entry to establish the directory on boot

3

Diagnostic step 3

Test changes without reboot by manually mounting /var and restarting units; keep a rescue method (single-user mode or live USB) before making changes on remote/critical systems

4

Diagnostic step 4

If uncertain about unit names or behavior, collect 'systemctl show mydaemon.socket -p After,Requires' and 'systemctl status var.mount' and consider escalating to a systemd specialist if interaction with other services or automounts is complex