systemctl get-default differs from default.target link

The default target returned by systemctl

[user@host system]$ systemctl get-default
multi-user.target

differs from the value of the /usr/lib/systemd/system/default.target link:

[user@host system]$ ls -l /usr/lib/systemd/system/default.target
lrwxrwxrwx. 1 root root 16 Mar 10 21:20 /usr/lib/systemd/system/default.target -> graphical.target

My understanding was that these were one and the same. If systemd doesn’t store the default value as the default.target symlink, where is the real value of the default target stored by systemd?

Asked By: petehern

||

This is most likely because /etc/systemd/system/default.target exists and points to multi-user.target

If you change the default.target with systemctl set-default [unit], the new default.target link is created in /etc/systemd/system/. The existing /usr/lib/systemd/system/default.target is not changed when using the set-default command. Like with all systemd units, the ones in /etc take precedence over /usr.

Answered By: Munir

systemd FAQ on “How do I change the default runlevel to boot into?“:

The symlink /etc/systemd/system/default.target controls where we boot into by default.

When default target isn’t configured, the default one in /usr/lib/systemd/system/default.target is used.

Answered By: sebasth
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.