how to set/change runlevel using systemd/systemctl???

Hi Everybody!

I’m learning about systemd/systemctl and one of the first thing I was wondering is how to change or set to runlevel 3 (from runlevel 5) and then change it back???

so far what I have found are some symbolic links and files in /lib/systemd/system called
runlevel0.target -> poweroff.target
runlevel2.target -> multi-user.target
runlevel3.target -> multi-user.target
runlevel4.target -> multi-user.target
runlevel5.target -> graphical.target
runlevel6.target -> reboot.target

thanks in advance!!! :slight_smile:

The init 3 and init 5 commands still work as expected in openSUSE 12.1. To close down your desktop and end up and a terminal prompt open a terminal session and enter:

sudo /sbin/init 3

Once the desktop has closed down, I often must press the enter key to get a terminal prompt login. Once you are done loading your drivers or what ever, logout as root and login as you. Then execute the command:

sudo /sbin/init 5

And log back into the desktop as normal. Did you know you can use my fastboot program to switch to run level 3 as well? Check out my blog on how fastboot works…

FastBoot for Grub Legacy Menu using Kexec - Version 1.32 - Blogs - openSUSE Forums

Thank You,

thanks James excelent script!!! :slight_smile: the Idea of using systemd/systemctl is the same as the other post (mounting a USB memory), right now I’m cheking the links that you gave me!

You might find this cheatsheet from the Fedora project useful.

SysVinit to Systemd Cheatsheet - FedoraProject

ken_yap thanks!!! this is very very useful!!! :slight_smile:

I remember stumbling across this cheatsheet once before - now I’ve bookmarked it for future reference.

Hi metehyi

I think that solution use SysVinit in the background, in the link that ken_yap gave us says:


systemctl reboot
systemctl poweroff

to set runlevel 5 and 3 we should modify a symbolic link to point a specific target

                     Target                                         symbolic link

ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target (runlevel 5)
ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target (runlevel 3)