Graphical session targets

Why are SystemD “graphical-session.target” and “graphical-session-pre.target” inactive, even when having the user graphical session running?

systemctl --user status graphical*.target

Won’t this prevent grouping graphical units appart from regular units?

A target isn’t a service so doesn’t “run” in the same way. It’s more like a checkpoint or milestone which indicates which things are run at what point.

They are more than that, they group units. They allow choosing what group of units to start, or to stop all together, at any time.

So why isn’t the graphical one started?

Should it be “started” ? And for a --user target?

For example I’m writing a unit for xiccd, a daemon that runs in the user session that allows screen color calibration under any Linux desktop.

The daemon won’t work as a system target, only as an user target, as it needs to bridge between colord and the x session of that particular user.

The daemon is only useful if a desktop is running, so my guess is that it’s better started only when graphical-user.target is.

Talk about an XY Problem.

Why not just start with the actual problem you’re having?

For what it is worth, I just checked 3 different distros I have running in VMs at the moment and it isn’t active as user target in any of them. It is always a system target.

1 Like

“graphical.target” is for system units.
“graphical-session.target” and “graphical-session-pre.target” are for user units.

The problem summarises as this:
How should a unit part of the user graphical session be started?
What should go into its “WantedBy=” line?

Unfortunately no major Distribution uses graphical-session.target in the designed way. It may works in the future, but not today. So there is at the moment on most distros no way to start a service only if a graphical session is already running without checking some environment variables.

However, you can simply use the default.target and don’t enable the service. Then create a desktop file to execute systemd --user start some.service . You can add the desktop file to the normal autostart of your DE, or just put it in /etc/xdg/autostart/ .

5 Likes

I guess it’s the well known “SystemD Denial Syndrom” :disappointed_relieved:

For better or worse SystemD is the standard now.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by