systemd: change default runlevel

1

I found two ways to change the default runlevel in systemd:

https://wiki.archlinux.org/index.php/systemd#Change_default_target_to_boot_into

# systemctl enable multi-user.target

http://www.freedesktop.org/wiki/Software/systemd/FrequentlyAskedQuestions/

# ln -sf /usr/lib/systemd/system/multi-user.target /etc/systemd/system/default.target

Background: I don't want to start XDM/GDM on a server.

Which is the preferred way to change the default runlevel?

guettli

Posted 2014-04-04T08:16:54.597

Reputation: 347

Answers

2

In my opinion the best way to avoid running XDM/GDM is simply to avoid installing it. The second best way would be to disable it in systemd. There is certainly no reason to play with runlevels when you always want to boot into the very same setup.

If you still wished to do that, the way documented by upstream is generally the correct one. Archlinux wiki is unreliable in that it can contain obsolete or distribution specific information and you didn't specify whether you actually use Archlinux. In this very case if you look in the wiki again, it now says:

systemctl set-default -f multi-user.target

This command will just create/replace the link. In this exceptional case the distribution wiki now looks more up to date than the upstream FAQ.

Pavel Šimerda

Posted 2014-04-04T08:16:54.597

Reputation: 712

-1

The systemctl command does it now, the ln command sets it for next boot. For a init 3 style, you want the multi-user target (no display managers). So do the ln command for a permanent change.

Good cheatsheet here: http://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet for us SysVinit veterans converting to Systemd

Dan L

Posted 2014-04-04T08:16:54.597

Reputation: 171

systemctl enable doesn't perform any immediate action. – Pavel Šimerda – 2015-04-05T05:46:12.317