Background: I have a laptop running Debian testing/unstable and booting with systemd. It's got a normal laptop magnetic hard drive (not an SSD). The machine is set to auto-login when turned on, so it goes straight from system bootup, to desktop loading—which is KDE 5, not exactly lightweight.

There are a few daemons I'd like to set to only start after the desktop is fully loaded (e.g., PostgreSQL, exim, apache, …) to get a usable desktop quicker. "Desktop fully loaded" can be detected fairly easily: the disk goes idle.

Question: Is there some systemd feature for launching system daemons only once the desktop is fully up? I've looked through the docs, and there doesn't seem to be anything after graphical.target. I feel I must be missing something, with all the features systemd has.

A few things I've thought of:

  • PostgreSQL at least does not support socket activation, so that's not an option.
  • There are Type=idle services, but it sounds like that'd maybe wait until sddm is started, but not until the desktop is loaded.
  • Write a service that is wanted by graphical.target that checks every 10s for the amount of disk activity, and if there is none, uses systemctl to start a local-idle.target or similar (then exists). Trying to avoid this one.
  • maybe inotify, there'd have to be some file/directory that is written/accessed when destkop is fully loaded
    – gwillie
    Aug 19, 2015 at 3:30
  • @gwillie I presume you mean with path activation? That might work, but seems very fragile. E.g., KDE upgrade changes file access order or stops using the targeted file. Interesting idea, though.
    – derobert
    Aug 19, 2015 at 4:40

1 Answer 1


First, there is no such event as "the desktop is fully up". There is no way to detect such a condition in a generic way.

How would you formally define it? The DE's own autostart mechanisms (/etc/xdg/autostart, ~/.config/autostart etc.) are not controlled by systemd; it has no way of knowing whether the DE had finished its start-up.

Moreover, the disk may never get idle. What if you started up the system in haste and immediately started doing something?

So, you have to decide what do you understand by "the desktop going fully up" and then simply write a script which detects this condition and starts another target with all your heavy services. So it's really the third option.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .