You are not logged in.

#1 2024-04-13 18:25:18

zf
Member
Registered: 2019-03-04
Posts: 5

[Solved] Systemd user unit fails--dbus not ready? Dependency issues

Edit: Solved--accidentally solved this by disabling the unit and enabling it again. The former removed 2 symlinks while the latter created 1 symlink. I changed the [Install] section of the unit file but the old symlinks still exist so the order of dependency hasn't changed. I naively thought a `daemon-reload` should be enough to update the changes for a unit file but `systemctl reenable` is needed to update the symlinks as dictated by `[Install]`.
----------------

I have script (syncthing-status) to simply checks if Syncthing is synced and times out after X seconds then notifies the user with notify-send. It only needs to be run on graphical session (preferably the first graphical session only on system boot, since I might restart the graphical session later but by then it should be assumed the relevant syncing has already been done). It should also run on system shutdown (and not restart), in which cause it doesn't notify-send but just allows X seconds for a quick sync. The following synchting-status.service is an attempt at this except the shutdown part (I'm first trying to get it working on graphical session end instead).

[Unit]
Description=Check and allow some time for Syncthing to sync
After=syncthing.service graphical-init.service mako.service

[Service]
Type=simple
RemainAfterExit=yes
ExecSearchPath=%h/bin:/usr/local/bin:/usr/bin
ExecStart=syncthing-status --notify --exit-timeout=15
ExecStop=syncthing-status --exit-timeout=15

[Install]
WantedBy=syncthing.service graphical-init.service

* However, journalctl log seems to suggest mako, my notification daemon on Wayland, fails because WAYLAND_DISPLAY is not yet, i.e. the session is not ready.

* The primary issue though seems to be that syncthing-status.service starts too early, before graphical session is ready. I thought "After=syncthing.service graphical-init.service mako.service" should deal with this above, where graphical-init.service runs when graphical session is reached to do some init:

[Unit]
Description=Restore desktop settings and generate application cache/database.
PartOf=graphical-session.target
After=graphical-session.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecSearchPath=/usr/local/bin:/usr/bin:%h/bin:%h/bin/system
ExecStart=sh -c 'session-set restore; lo --updatedb; fsearch --update-database; bemenu-run-cmds --UPDATE; import-gsettings'
ExecStop=session-set save

[Install]
WantedBy=graphical-session.target

Any ideas or comments is much appreciated.

Last edited by zf (2024-04-14 20:57:14)

Offline

Board footer

Powered by FluxBB