Este paso aunque no es obligatorio en un entorno de Servidor, si lo considero que es altamente recomendado para optimizar recursos de sistema. Lo que vamos a hacer es deshabilitar el autoinicio del entorno gráfico instalado MATE
Lo que debemos de hacer a continuacón es adaptar el sistema a un arranque sin gestor de inicio sesiones LightDM
Para ello instalamos y configuramos la siguiente dependencia:
sudo apt-get -y install xserver-xorg-legacy
Vamos a reconfigurarla debidamente, previo backup de su configuración:
sudo mv /etc/X11/Xwrapper.config /etc/X11/Xwrapper.bak && \
sudo nano /etc/X11/Xwrapper.config
Agregamos el siguiente contenido al fichero que estamos editando:
# Xwrapper.config (Debian X Window System server wrapper configuration file)
#
# This file was generated by the post-installation script of the
# xserver-xorg-legacy package using values from the debconf database.
#
# See the Xwrapper.config(5) manual page for more information.
#
# This file is automatically updated on upgrades of the xserver-xorg-legacy
# package *only* if it has not been modified since the last upgrade of that
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command as root:
# dpkg-reconfigure xserver-xorg-legacy
needs_root_rights=yes
allowed_users=anybody
Guardamos los cambios y salimos del editor de texto. Ahora vamos a reconfigurar SystemD para el arranque en terminal:
sudo systemctl set-default multi-user.target
Llegado a este punto el sistema tras un reinicio o encendido del PC nos solicitaria el usuario: pi y su contraseña: **** para hacer login en terminal.
Podemos configurar un autologin que no lo recomiendo pero lo dejo a modo informativo.
sudo mkdir -p /etc/systemd/system/getty@tty1.service.d && \
sudo nano /etc/systemd/system/getty@tty1.service.d/override.conf
Agregamos el siguiente contenido al fichero que estamos editando:
[Service]
Type=simple
ExecStart=
ExecStart=-/sbin/agetty --autologin pi --noclear %I 38400 linux
Guardamos los cambios y salimos del editor de texto.
Si queremos devolver el tipo de inicio de TTY a gráfico.
sudo mv /etc/X11/Xwrapper.bak /etc/X11/Xwrapper.config
A continuación
sudo systemctl set-default graphical.target
Y finalmente
sudo apt-get purge xserver-xorg-legacy
Author: Vivek Gite Last updated: April 11, 2024 6 comments

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.
| Tutorial details | |
|---|---|
| Difficulty level | Easy |
| Root privileges | Yes |
| Requirements | Linux terminal |
| Category | System Management |
| Prerequisites | systemd |
| OS compatibility | AlmaLinux • Alpine • Arch • CentOS • Debian • Fedora • Linux • Mint • openSUSE • Pop!_OS • RHEL • Rocky • Stream • SUSE • Ubuntu |
| Est. reading time | 5 minutes |
The procedure is as follows to change into a text mode runlevel under systemd:

Want to revert change boot to GUI instead of console/text mode? Try:

The default target is set by /etc/systemd/system/default.target. Run the following ls command to verify it using the symbolic link:
ls -l /etc/systemd/system/default.target
Of course, we can use the systemctl command itself too:
systemctl get-default
Execute the following command:
systemctl list-units --type target
# list all loaded units in any state #
systemctl list-units --type target --all
Here is a list of all currently loaded target units on Ubuntu Linux 20.04 LTS desktop:
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'.
Let us understand older Sysv runlevels and their equivalents under systemd.
| Systemd target | Runlevel | Description | Old command | New command |
|---|---|---|---|---|
| runlevel0.target, poweroff.target | 0 | Power off the Linux box. | init 0 | systemctl isolate poweroff.target |
| runlevel1.target, rescue.target | 1 | Boot into emergency rescue mode (single user mode). | init 1 | systemctl isolate rescue.target |
| runlevel2.target, multi-user.target | 2 | Text based multi-user system that does not configure network interfaces and does not export networks services. | init 2 | systemctl isolate runlevel2.target |
| runlevel3.target, multi-user.target | 3 | Starts the system normally in multi-user text mode for the Linux server usage. | init 3 | systemctl isolate runlevel3.target |
| runlevel4.target, multi-user.target | 4 | For special purposes text mode. | init 4 | systemctl isolate runlevel4.target |
| runlevel5.target, graphical.target | 5 | Same as runlevel 3 and boot into GUI display manager. | init 5 | systemctl isolate graphical.target |
| runlevel6.target, reboot.target | 6 | Reboot the Linux desktop or laptop. | init 5 | systemctl isolate reboot.target |
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:
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
ls -l /etc/systemd/system/default.target

Learn how to change the default target by creating a symlink to the systemd target (click to enlarge)
See
how create soft link with under Linux or Unix
using the ln command for more info.
Run the following systemctl command
sudo systemctl rescue
We can change to a different systemd target unit in the current log in session using the CLI as follows:
sudo systemctl isolate multi-user.target
# OR #
sudo systemctl isolate graphical.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:
systemd --test --system --unit=graphical.target
The --test option is used to determine the initial start-up transaction, dump it, and exit without actually executing any of the determined jobs. How cool is that?
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 or help command in an emergency where the internet is not available:
man systemctl
man init
man upstart ini
man systemd
systemctl --help
systemctl --help |
-i -E 'status|show|kill'