Most modern Linux distro uses systemd as init replacement. It is a suite of basic building blocks for Linux distros such as RHEL/CentOS & co, OpenSUSE/SUSE, Fedora, Arch, Debian, Ubuntu, and more. By default, most distro boot into GUI, but you can change to text or vice versa.
The older version of the Linux distros came with SysV init or Upstart. Such init provided a set of runlevels for text, muli user, and GUI system. However, systemd uses the concept of targets instead of runlevels. This page explains procedures to implement runlevel like config when working with systemd targets. In other words, you will learn how to switch between text or GUI mode using systemd instead of init levels on modern Linux distros.
sudo systemctl reboot
How to switch boot target to GUI (graphical UI)
Want to revert change boot to GUI instead of console/text mode? Try:
Understanding boot targets under systemd
The default target is set by /etc/systemd/system/default.target. Run the following ls command to verify it using the symbolic link:
Listing all systemd targets
Execute the following command:
UNIT LOAD ACTIVE SUB DESCRIPTION basic.target loaded active active Basic System blockdev@dev-mapper-md1_crypt.target loaded active active Block Device Preparation for /dev/mapper/md1_crypt bluetooth.target loaded active active Bluetooth cryptsetup.target loaded active active Local Encrypted Volumes getty.target loaded active active Login Prompts graphical.target loaded active active Graphical Interface local-fs-pre.target loaded active active Local File Systems (Pre) local-fs.target loaded active active Local File Systems machines.target loaded active active Containers multi-user.target loaded active active Multi-User System network-online.target loaded active active Network is Online network-pre.target loaded active active Network (Pre) network.target loaded active active Network nss-user-lookup.target loaded active active User and Group Name Lookups paths.target loaded active active Paths remote-fs-pre.target loaded active active Remote File Systems (Pre) remote-fs.target loaded active active Remote File Systems slices.target loaded active active Slices sockets.target loaded active active Sockets sound.target loaded active active Sound Card swap.target loaded active active Swap sysinit.target loaded active active System Initialization time-set.target loaded active active System Time Set time-sync.target loaded active active System Time Synchronized timers.target loaded active active Timers virt-guest-shutdown.target loaded active active Libvirt guests shutdown LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. 26 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'.
Sysv runleves vs systemd targets
Let us understand older Sysv runlevels and their equivalents under systemd.
How to change the default systemd target using symbolic link
Earlier I explained how to use the systemctl command. But one can use other commands. Therefore, use the ln command as follows to switch to the GUI mode:
Patreon supporters only guides 🤓
Join Patreon ➔
sudo ln -s -f -v /lib/systemd/system/graphical.target /etc/systemd/system/default.target
Want to go back to the text mode:
sudo ln -s -f -v /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
Verify it using the ls command
See how create soft link with under Linux or Unix using the ln command for more info.
How to boot in to rescue mode
Run the following systemctl command
What would get started if I booted into a specific target?
The systemd can calculate the “initial” transaction it would execute on boot, try something like this to see what services and stuff loaded in the graphical.target:
You learned about systemd targets and older runlevels used by SysV init system. Further, I explained how to use the systemctl command to switch between text and GUI mode from the CLI. There is more than one way to achieve results in Linux. Hence, this page also described how to modify the default target using the symbolic link method too. Debian Linux project maintains a good systemd specific page and strongly endorses you to visit the wiki page. However, you can read documentation locally using the man command in an emergency where the internet is not available: