I have written a sample test service and it looks as below,

 Description=Test service

 ExecStart=/usr/sbin/testbin -n


Now I want this service(or unit file) to be started after the xorg.service so I added


to the unit section of my service file and rebooted the system.But it is not having an effect on my service file.So my goal here is to bring this service up after the user session(I mean after X comes up).Please let me know what am I missing here or is there any other alternative approach to delay it?

2 Answers 2


You should ensure that you actually have a unit named xorg.service. To my knowledge, no distribution is starting X this way, so, unless you have written your own xorg.service, there is simply no such unit.

Moreover, let me emphasize that simply starting your service after X server (or after the display manager) is fundamentally not enough to make it communicate with X.

To put it simple, systemd or any other init system is not meant to run user GUI applications. Though it is certainly possible through some degree of hackery, I would not recommend it -- just stick with xinitrc.


First of all, as @intelfx said, you should make sure an xorg.service exists. I think a better approach is to refer to graphical.target, which is triggered when the graphical system is up.

If the service is for a user session you should consider using:

systemctl --user enable test.service

This way the service will be triggered when the user that activated it logs in if all the other requirements are met. Mind that your initial approach may happen before any user is authenticated and therefore outside any user session.

If you want to enable the --user service for all users, you can add it on /etc/systemd/user/default.target.wants so it is activated unless the user opts-out.

You must log in to answer this question.

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