I need to exit the GUI and connect to the NVIDIA drivers through a terminal. This is where I came upon this question. However, when I attempted sudo service lightdm stop (or gdm stop), I got the following message:
However, when I tried sudo service lightdm stop
(or the same with gdm
), it said this:
$ sudo service lightdm stop Failed to stop lightdm.service: Unit lightdm.service not loaded. $ sudo service gdm stop Failed to stop gdm.service: Unit gdm.service not loaded.
I’d like not deal with Grub because I just need to shut off the GUI once. So, with Kubuntu 21.10, how can I disable the GUI and utilize a terminal with no GUI at all?
3 Answers
Introduction
Kubuntu 21.10 is a popular Linux distribution that comes with a graphical user interface (GUI) by default. However, there may be situations where you need to disable the GUI and use the terminal instead. For example, you may need to install or configure NVIDIA drivers, which require you to stop the GUI. In this blog post, we will explore how to disable the GUI on Kubuntu 21.10 and use the terminal instead.
Method 1: Using systemd to stop the GUI
The first method to stop the GUI on Kubuntu 21.10 is to use systemd, which is a system and service manager for Linux. Here are the steps to follow:
1. Open a terminal by pressing Ctrl+Alt+T
or by searching for “Terminal” in the application menu.
2. Type the following command to stop the GUI using systemd:
sudo systemctl stop sddm.service
This command will stop the Simple Desktop Display Manager (SDDM), which is the default display manager for Kubuntu.
3. Once you have stopped the GUI, you can use the terminal to perform any tasks that require a non-GUI environment.
4. To start the GUI again, type the following command:
sudo systemctl start sddm.service
This command will start the SDDM service and bring back the GUI.
Method 2: Using the init system to stop the GUI
Another method to stop the GUI on Kubuntu 21.10 is to use the init system, which is a collection of scripts and programs that initialize the system during boot. Here are the steps to follow:
1. Open a terminal by pressing Ctrl+Alt+T
or by searching for “Terminal” in the application menu.
2. Type the following command to switch to runlevel 3, which is a non-GUI runlevel:
sudo init 3
This command will stop the GUI and switch to a non-GUI environment.
3. Once you have switched to runlevel 3, you can use the terminal to perform any tasks that require a non-GUI environment.
4. To switch back to runlevel 5 and start the GUI again, type the following command:
sudo init 5
This command will start the GUI and switch back to runlevel 5.
Method 3: Disabling the display manager
Another method to disable the GUI on Kubuntu 21.10 is to disable the display manager, which is the program that provides the GUI login screen. Here are the steps to follow:
1. Open a terminal by pressing Ctrl+Alt+T
or by searching for “Terminal” in the application menu.
2. Type the following command to disable the display manager:
sudo systemctl disable sddm.service
This command will disable the SDDM service and prevent it from starting during boot.
3. Once you have disabled the display manager, reboot your system by typing the following command:
sudo reboot
4. After the system has rebooted, you will be in a non-GUI environment. You can use the terminal to perform any tasks that require a non-GUI environment.
5. If you want to re-enable the display manager and start the GUI again, type the following command:
sudo systemctl enable sddm.service
This command will enable the SDDM service and allow it to start during boot.
Method 4: Killing the X server
Another method to stop the GUI on Kubuntu 21.10 is to kill the X server, which is the program that provides the graphical environment. Here are the steps to follow:
1. Open a terminal by pressing Ctrl+Alt+T
or by searching for “Terminal” in the application menu.
2. Type the following command to list all running processes:
ps -aux | grep Xorg
This command will list all processes that contain the string “Xorg”, which is the name of the X server process.
3. Identify the process ID (PID) of the X server process and type the following command to kill it:
sudo kill <PID>
Replace <PID>
with the actual PID of the X server process.
4. Once you have killed the X server, you will be in a non-GUI environment. You can use the terminal to perform any tasks that require a non-GUI environment.
5. If you want to start the GUI again, type the following command:
startx
This command will start the X server and bring back the GUI.
Method 5: Using the GRUB menu
If you prefer to use the GRUB menu to start Kubuntu 21.10 without the GUI, you can follow these steps:
1. Reboot your system and press the Shift key to enter the GRUB menu.
2. Highlight the entry for Kubuntu 21.10 and press the e key to edit the boot parameters.
3. Find the line that starts with “linux” and add the following parameter at the end of the line:
systemd.unit=multi-user.target
4. Press the Ctrl+X keys to boot Kubuntu 21.10 with the modified boot parameters.
5. Once you have booted into Kubuntu 21.10, you will be in a non-GUI environment. You can use the terminal to perform any tasks that require a non-GUI environment.
6. If you want to start the GUI again, type the following command:
sudo systemctl start sddm.service
This command will start the SDDM service and bring back the GUI.
Method 6: Using a virtual console
Finally, you can use a virtual console to stop the GUI on Kubuntu 21.10. Here are the steps to follow:
1. Press the Ctrl+Alt+F1 keys to switch to the first virtual console.
2. Log in with your username and password.
3. Type the following command to stop the GUI:
sudo systemctl stop sddm.service
4. Once you have stopped the GUI, you will be in a non-GUI environment. You can use the virtual console to perform any tasks that require a non-GUI environment.
5. If you want to start the GUI again, type the following command:
sudo systemctl start sddm.service
This command will start the SDDM service and bring back the GUI.
Conclusion
In this blog post, we have explored six methods to stop the GUI on Kubuntu 21.10 and use the terminal instead. Depending on your preference and the situation, you can choose the method that works best for you. By disabling the GUI, you can perform tasks that require a non-GUI environment, such as installing or configuring NVIDIA drivers.
To stop the graphical user interface (GUI) on Kubuntu 21.10, you can use the systemctl
command to disable the display manager service that is responsible for starting the GUI.
You can try the following command to disable the lightdm display manager:
sudo systemctl disable lightdm.service
You can also try the following command to disable the gdm display manager:
sudo systemctl disable gdm.service
After running one of these commands, you can then reboot the system to boot into a terminal without the GUI. To do this, you can use the reboot
command:
sudo reboot
Alternatively, you can use the init
command to switch to a different runlevel, which will stop the GUI and give you access to a terminal. To switch to runlevel 3 (a multi-user system with networking, but without a GUI), you can use the following command:
sudo init 3
To switch back to the GUI, you can use the init
command to switch to runlevel 5 (a multi-user system with networking and a GUI).
sudo init 5
Keep in mind that these changes are not permanent, and the display manager service will start again when you reboot the system. If you want to make the change permanent, you will need to edit the default runlevel in the /etc/inittab
file.
In summary, to stop the GUI on Kubuntu 21.10, you can use the systemctl
command to disable the display manager service that is responsible for starting the GUI. You can try disabling either the lightdm.service
or the gdm.service
, depending on which one is installed on your system. After disabling the display manager service, you can then reboot the system to boot into a terminal without the GUI. Alternatively, you can use the init
command to switch to a different runlevel, which will stop the GUI and give you access to a terminal. Keep in mind that these changes are not permanent, and the display manager service will start again when you reboot the system. If you want to make the change permanent, you will need to edit the default runlevel in the /etc/inittab
file.
Kubuntu uses sddm
as the display manager. So
sudo service sddm stop
should do it.