Yes, stop the X server on Ubuntu with this step-by-step guide. In this post, you’ll learn how to safely stop the graphical X server, identify your display manager, switch to a non-graphical multi-user target for maintenance, and bring the GUI back without pain. This is especially useful for server maintenance, performance tuning, or when you’re troubleshooting GUI issues on a machine that primarily runs headless services. We’ll cover the common display managers GDM3, LightDM, and SDDM, provide concrete commands, and share best practices so you stay productive even when the GUI is out of the picture.
What you’ll learn in this guide:
- How to determine which display manager is running on your Ubuntu system
- The exact commands to stop the X server for GNOME GDM3, LightDM, and SDDM
- How to verify that the X server is stopped and what to do next
- How to switch to a non-graphical target to keep services running
- How to re-enable the graphical interface when you’re done
- Tips for headless setups and persisting non-graphical boot behavior
- Common pitfalls and robust troubleshooting steps
- A quick-reference command table for fast lookups
Useful URLs and Resources text only
- Ubuntu Official Documentation – ubuntu.com/server/docs
- GNOME Display Manager GDM – gnome.org
- LightDM – wiki.freedesktop.org/wiki/LightDM
- SDDM – sddm-howto / github.com/sddm
- Wayland vs X.org – wayland.freedesktop.org
- Systemd Documentation – freedesktop.org/wiki/Software/systemd
- Ubuntu Wiki – wiki.ubuntu.com
What is the X server and why would you stop it
The X server is the component that handles graphical display on many Linux desktops. In Ubuntu, especially with GNOME, the default session in recent releases is Wayland, but X.org the traditional X server or Xwayland can still run under the hood for compatibility. There are plenty of legitimate reasons to stop the X server: you’re performing scheduled maintenance on the filesystem, updating graphics drivers, or you need to run resource-intensive tasks without the GUI consuming CPU cycles and RAM. Stopping X is a common, safe operation when done correctly, and it won’t shut down your server automatically—so long as you’re not doing something risky in the middle of critical services. Why your computer wont connect to the domain server: Quick Fixes for Domain Join, DNS, and Network Problems
Before you stop X, know these quick facts:
- Ubuntu’s default desktop environment uses GNOME with the GDM3 display manager. In Ubuntu 22.04 and later, Wayland is the default session, but you can still log into an Xorg session if needed.
- If you’re on an older Ubuntu desktop, you might be using LightDM. If you’re on KDE or other desktops, you could be running SDDM.
- You can stop the display manager the login screen and GUI session or kill the Xorg process directly. The recommended approach is to stop the display manager so the system cleanly transitions to a non-graphical state.
Determine your display manager and prepare
First, figure out which display manager is active. This matters because the stop command changes depending on which one you’re using.
- Check the status of common display managers:
- sudo systemctl status gdm3
- sudo systemctl status lightdm
- sudo systemctl status sddm
- If you’re not sure, you can observe which one is running by listing the active service:
- ps -ef | grep -E ‘gdm|lightdm|sddm|Xorg’ | grep -v grep
- You can also query the system to see which DM is installed and enabled by default:
- systemctl is-enabled graphical.target
- systemctl status display-manager
Step-by-step: Stop the X server on Ubuntu by DM
Important: Always perform these steps from a non-graphical login TTY or via SSH. If you’re physically near the machine, switch to a text console with Ctrl+Alt+F3 or F2–F6. When you’re done, you can return with Ctrl+Alt+F1 or F7 depending on your environment.
Step 1 – Access a text console
- Press Ctrl+Alt+F3 to switch to a text login.
- Log in with your user credentials the account you normally use for admin tasks.
Step 2 – Identify the display manager repeat for clarity How to configure virtual machine in windows server 2012 a comprehensive guide: A practical Hyper-V VM setup
- If you already know your DM, you can skip this; otherwise:
- If sudo systemctl status gdm3 shows active, you’re using GDM3.
- If sudo systemctl status lightdm shows active, you’re using LightDM.
- If sudo systemctl status sddm shows active, you’re using SDDM.
- If none of these show active, you can proceed by stopping the X server directly with Xorg commands.
Step 3 – Stop the display manager the safe, recommended method
Stop the appropriate DM with its systemctl command:
-
GNOME/GDM3 the most common on Ubuntu:
- sudo systemctl stop gdm3
- Optional: sudo systemctl disable gdm3 to keep GUI from starting on boot if you’re making a headless setup; you’ll re-enable later with start or by re-enabling the target
-
LightDM older Ubuntu desktops or some flavors:
- sudo systemctl stop lightdm
- Optional: sudo systemctl disable lightdm
-
SDDM KDE and some other desktops:
- sudo systemctl stop sddm
- Optional: sudo systemctl disable sddm
Note: If you’re on a system that uses Xorg directly without a DM, you can stop Xorg with a targeted kill: Why your yahoo mail keeps saying connection to server failed and how to fix it
- sudo pkill Xorg
- Or sudo killall Xorg
But stopping the DM is much safer because it cleanly shuts down the graphical session and related processes.
Step 4 – Verify X is stopped
- Check for Xorg processes:
- ps -ef | grep -E ‘Xorg|Xwayland’ | grep -v grep
- If nothing shows up, you’re not running an X session on that display. You should still see a login prompt on the terminal you’re in, or you’ll be in a non-graphical mode.
Step 5 – Do your maintenance
With the GUI gone, you now have a non-graphical environment to perform your tasks. This is ideal for disk checks, backups, kernel module work, or package upgrades that don’t require a GUI.
Step 6 – Reboot or switch back to graphical mode
When your maintenance is complete, you’ll likely want to bring the GUI back.
Option A: Quick restart of the GUI
- For GDM3: sudo systemctl start gdm3
- For LightDM: sudo systemctl start lightdm
- For SDDM: sudo systemctl start sddm
Option B: Switch back to the graphical target How to Download and Build Your Own DNS Server The Ultimate Guide: DIY DNS Setup, Self-Hosted DNS, Local Network Resolver
- To re-enter GUI mode without rebooting:
- sudo systemctl isolate graphical.target
- If you had previously disabled GUI at boot and want to re-enable it:
- sudo systemctl enable gdm3
- sudo systemctl enable lightdm
- sudo systemctl enable sddm
Then reboot or isolate graphical.target to return to GUI.
Persisting a non-graphical boot headless setups
If your goal is to run a headless server no GUI at boot, you can set the system to boot into a multi-user target by default and start the GUI manually when you need it.
- Change the default target to multi-user no GUI:
- sudo systemctl set-default multi-user.target
- To re-enable the GUI by default:
- sudo systemctl set-default graphical.target
Quick reference: common commands by scenario
- Determine if GNOME is using GDM3:
- sudo systemctl status gdm3
- Stop the display manager safe path:
- sudo systemctl stop gdm3
- sudo systemctl stop lightdm
- sudo systemctl stop sddm
- Start the display manager again:
- sudo systemctl start gdm3
- sudo systemctl start lightdm
- sudo systemctl start sddm
- Force non-graphical mode temporary, until reboot:
- sudo systemctl isolate multi-user.target
- Force graphical mode temporary, until reboot:
- sudo systemctl isolate graphical.target
- Make GUI boot optional permanent until changed:
- sudo systemctl set-default multi-user.target
- sudo systemctl set-default graphical.target
- Verify there are no Xorg processes:
- ps -ef | grep -E ‘Xorg|Xwayland’ | grep -v grep
Tables: quick reference by display manager
| Display Manager | Stop Command | Start Command | Default Boot State permanent |
|---|---|---|---|
| GDM3 GNOME | sudo systemctl stop gdm3 | sudo systemctl start gdm3 | To disable GUI at boot: sudo systemctl set-default multi-user.target; re-enable with graphical.target or start gdm3 |
| LightDM | sudo systemctl stop lightdm | sudo systemctl start lightdm | To disable GUI at boot: sudo systemctl set-default multi-user.target; re-enable with graphical.target or start lightdm |
| SDDM | sudo systemctl stop sddm | sudo systemctl start sddm | To disable GUI at boot: sudo systemctl set-default multi-user.target; re-enable with graphical.target or start sddm |
Common pitfalls and troubleshooting
- If the GUI doesn’t stop:
- Check system logs: journalctl -xe | grep -iE ‘gdm|lightdm|sddm|xorg|wayland’
- Ensure you’re not in a root console or screen session that prevents stopping the DM.
- If you can’t SSH in after stopping the GUI:
- Ensure SSHD is running: systemctl status ssh
- If SSH isn’t available, you may need to connect through a local console or fix your service state.
- If you see a black screen after stopping X:
- It could be that the session was tied to a non-standard DM. Reboot or start the DM directly: sudo systemctl start gdm3 or the appropriate DM
- If you’re on Wayland and want to use an Xorg session:
- At login, choose the Xorg session often a gear icon on the login screen. The X session will run on top of Wayland as Xwayland.
- If stopping X causes services to fail:
- Check dependent services and ensure they’re not waiting on the GUI. Use systemctl list-dependencies multi-user.target to review what’s tied to the GUI.
- If you accidentally disable GUI at boot and need to revert:
- Reboot, or run sudo systemctl set-default graphical.target and then sudo reboot. Alternatively, re-enable the DM and set the default target back.
Advanced: handling headless servers with remote maintenance Joining a discord server with a link the ultimate guide: Invite links, permissions, safety, and tips for smooth onboarding
- Always keep SSH accessible before you stop the GUI so you don’t lock yourself out.
- Consider configuring a maintenance window or a script that gracefully stops GUI, runs maintenance tasks, and re-enables GUI with proper logging.
- For automated maintenance, you can create a simple systemd service or script that toggles the GUI for a defined window, then returns to a stable state.
Performance and security considerations
- Stopping the X server reduces memory usage and background process load, which can improve performance during heavy computation or disk-intensive tasks.
- Running in non-graphical mode can improve security by reducing the surface area for GUI-based exploits.
- If your server needs to run graphical tools occasionally, keep a quick-start path start the DM rather than leaving the GUI permanently disabled.
Real-world tips and best practices
- Use a non-graphical console during maintenance whenever possible. Linux commands are extremely powerful in this mode.
- If your workflow requires frequent GUI cycles, consider a separate workstation for GUI tasks and keep your Ubuntu server headless.
- Document your steps for colleagues or for future maintenance so you don’t forget whether you stopped GDM3, LightDM, or SDDM.
Frequently Asked Questions
How do I know which display manager Ubuntu is using?
You can check the status of GDM3, LightDM, and SDDM with systemctl status gdm3, systemctl status lightdm, and systemctl status sddm. If one shows active, that’s your current display manager. You can also inspect the login screen’s behavior or check which service is enabled for graphical.target.
Is it safe to stop the X server on a production Ubuntu server?
Yes, as long as you’re deliberately moving to a non-graphical mode for maintenance or troubleshooting. Always ensure you have a resolver path via SSH or a local console and that no critical GUI-dependent tasks are in progress. Discover Who Owns the Chat On Your Discord Server: Find Channel Owners, Admin Roles, And Access Controls
How do I re-enable GUI after stopping it?
Use sudo systemctl start gdm3 or lightdm, or sddm, depending on your DM. If you disabled GUI at boot, re-enable by running sudo systemctl set-default graphical.target.
Can I stop X without stopping the DM?
You can kill the Xorg process directly with sudo pkill Xorg, but it’s less clean and can leave sessions in odd states. Stopping the DM is the recommended method.
What’s the difference between Xorg and Wayland in this context?
Wayland is the modern display server protocol used by GNOME by default in many Ubuntu releases. Xorg is the traditional X server that Xorg apps rely on. You may run Xorg under Xwayland for compatibility, or disable the GUI entirely to work in a non-graphical mode.
How can I keep services running when the GUI is stopped?
Work in a multi-user.target environment and ensure services are not dependent on the graphical session. Use systemctl to isolate multi-user.target for maintenance and then return to graphical.target afterward.
How do I make my changes persist across reboots?
Set the default target to multi-user.target to boot into non-graphical mode, or re-set the default to graphical.target when you want GUI on boot. Use systemctl set-default accordingly. Unlocking a discord ip ban the ultimate guide: Understanding Bans, Appeals, and Safe Alternatives
What if I don’t see a login prompt after stopping X?
You should still have access to a TTY via Ctrl+Alt+F3 or another F-key. If you don’t, verify that the DM stopped correctly and that SSH or local console access is available. Check system logs with journalctl to diagnose startup failures.
Can I perform GUI maintenance over SSH without breaking the session?
Yes. SSH lets you manage the machine while the GUI is stopped. Just make sure SSH is active, and avoid commands that could disrupt essential services. Use sudo carefully to avoid accidentally stopping crucial daemons.
How do I revert changes if something goes wrong during maintenance?
If you stopped the DM and things aren’t back to normal, start the DM again and isolate graphical.target to return to GUI. If you set the GUI to not start on boot and you want to revert, switch the default target back to graphical.target and reboot.
With these steps, you can confidently stop the X server on Ubuntu, perform maintenance in a safe non-graphical environment, and bring the GUI back when you’re done. This approach is a practical, reliable way to manage servers and desktops alike, ensuring you’re in control whether you’re dealing with a local machine or a remote, headless deployment. Stop x server ubuntu a step by step guide, and you’ll have a solid, repeatable workflow for any future maintenance tasks.
Sources:
Secure vpn edge How to host a tamriel online server the ultimate guide: Setup, Security, and Optimization
Vpn全球在全球范围内的VPN应用全解:如何选择、搭建与隐私保护技巧(Vpn全球 全网覆盖与使用指南)
How to create a minecraft private server without hamachi step by step guide
Testing ntp server on Windows a comprehensive guide