2

I'd like to change the default target launched by systemd --user.

From ArchLinux wiki:

When systemd user instance starts, it brings up the target default.target

From man 7 systemd.special:

When systemd runs as a user instance, the following special units are available, which have similar definitions as their system counterparts: exit.target, default.target, shutdown.target, sockets.target, timers.target, paths.target, bluetooth.target, printer.target, smartcard.target, sound.target.

To change the system-wide default target, you can run systemctl set-default name. To change the default user target, you call systemctl --user set-default name.

The problem is, on what target should my custom target depend so that no other user-defined targets are broken? Obviously, depending on default.target doesn't help :)

Martin Pecka
  • 387
  • 6
  • 17
  • `graphical-session.target` could work if you use a desktop-environment which implements it AND you are expecting a desktop to be available for your units. – Stewart Jul 25 '22 at 05:48

1 Answers1

1
$ cat /usr/lib/systemd/user/default.target
# ...
[Unit]
Description=Default
Documentation=man:systemd.special(7)
Requires=basic.target
After=basic.target
AllowIsolate=yes

So it seems depending on the basic.target should work. I did it and everything seems to work as it should. However, if you have any more insights, please, share them here :)

Martin Pecka
  • 387
  • 6
  • 17