How do I change the runlevel?
systemd has the concept of targets which is a more flexible replacement for runlevels in sysvinit.
Run level 3 is emulated by multi-user.target. Run level 5 is emulated by graphical.target. runlevel3.target is a symbolic link to multi-user.target and runlevel5.target is a symbolic link to graphical.target.
You can switch to ‘runlevel 3’ by running
- systemctl isolate multi-user.target (or) systemctl isolate runlevel3.target
You can switch to ‘runlevel 5’ by running
- systemctl isolate graphical.target (or) systemctl isolate runlevel5.target
How do I change the default runlevel?
systemd uses symlinks to point to the default runlevel. You have to delete the existing symlink first before creating a new one
rm /etc/systemd/system/default.target
Switch to runlevel 3 by default
ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
Switch to runlevel 5 by default
ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
systemd does not use /etc/inittab file.
How do I know the current run level?
runlevel command still works with systemd. You can continue using that however runlevels is a legacy concept in systemd and is emulated via ‘targets’ and multiple targets can be active at the same time. So the equivalent in systemd terms is
systemctl list-units --type=target
How to power off the machine ?
You can use
poweroff
Some more possibilities are: halt -p
, init 0
, shutdown -P now
Note that halt
used to work the same as poweroff
in previous Fedora releases, but systemd distinguishes between the two, so halt
without parameters now does exactly what it says – it merely stops the system without turning it off.