How does one exit the X server?
Solution 1
GDM was switched out for LightDM, so:
sudo stop lightdm
Or in your service parlance:
sudo service lightdm stop
For future reference, all these upstart services (that can be run with initctl's service command and shortcuts) are .conf
files in /etc/init/
Solution 2
The reason that doesn't work is because Ubuntu 11.10 has switched from GDM to LightDM.
Try this command instead:
sudo service lightdm stop
Solution 3
You can also use the keyboard shortcut:
Alt + PrtScn/SysReq + K
A bit of a long winded keyboard shortcut, maybe too many people were pressing Ctrl+Alt+Backspace so they changed it to this.
I can confirm this as working from 10.04 through to 11.10.
Solution 4
@Oli pretty much nailed it, but I wanted to note that this probably won't help you out much if you need to do something from the command line without X.
For that, you should press Ctrl+Alt+F1, then log in from the console. Afterwards, you can kill and restart the lightdm
service as needed.
Solution 5
Technically speaking gdm or lightdm are managing desktop session requests they are not X servers. (an X server is serving events to X application, xorg is an X server :) .
Edit
To stop the X server killall X
or sudo killall X
if you are not owner of the process.
Of course you must have a terminal to do that.
One way if you cannot open a gnome terminal or an xterm is to start a text console; press simultaneously Ctrl + Alt + F1 keys, then login at the prompt (your password will not be shown, not even as asterisks). (F1 to F5 are ok)
Related videos on Youtube
nilsonneto
Nickname - danger mouse, Ubuntu fanatic since v7. I am the project lead for Ubuntu Budgie and a Debian Maintainer of several packages. I work for a very large corporate technology firm as a systems developer. I am a rhythmbox plugin developer and author of the popular Rhythmbox Plugin PPA: https://launchpad.net/~fossfreedom/+archive/rhythmbox-plugins I just love GitHub for all of my opensource development: https://github.com/fossfreedom Would love to take this further into the FOSS world - just looking for the opportunity! I'm a ♦ on Ask Ubuntu Follow me on Twitter: fossfreedom
Updated on September 18, 2022Comments
-
nilsonneto over 1 year
The command
sudo service gdm stop
would successfully disable the X server in Ubuntu 11.04 temporarily.However, this same command no longer works in Ubuntu 11.10, because "gdm" is an "unrecognized service" according to Terminal. How, then, do I disable the X server in Ubuntu 11.10?
-
Admin over 12 yearsif you just want to restart x server just log in and out, otherwise ctr+alt+backspace normally does it to... perhaps that shortcut needs to be enabled under keyboard preferences
-
Admin over 12 yearspossible duplicate of How to stop the login server?
-
Admin over 10 yearsThe question should be "how to stop the session manager" but as many people thinks that gdm is an "X server" this should stay like this.
-
-
Tele over 10 yearsYup, exactly. And the question was how to shut "X server" down? I have no gdm or lightdm installed, I have nothing to do with them. We started server: "X &" as root. How can we stop it ?
-
Emmanuel over 10 years@Tele Just made an edit
-
Tele over 10 yearsYes I know about killall, but isn't there something more delicate, regular and official. I don't like brutality. Do we have to wipe the process out like a frozen one?
-
Ahmed about 9 yearsThe question is about exiting X server, but I believe lightdm is X server client ? No ? and the command in your answer will only stop the client and not the server ?
-
Oli about 9 years@Ahmed the lightdm startup script is what starts X.
-
Justin Liang over 7 years@Ahmed "DM" - desktop manager; yes gdm and lightdm are X clients, but they assume special responsibilities - managing other client window decorations, stacking order, drag-n-drop, cut-n-paste, etc.
-
RichieHH over 3 yearslightdm isnt the Xserver,,
-
RichieHH over 3 yearsThis has nothing to do with halting the Xserver.
-
RichieHH over 3 yearslightdm is NOT the xserver. Google is picking up on wrong answers from people not reading the Q properly.
-
Tcll over 3 years@RichieHH the X server can be disabled through lightdm, which used to be gdm back then (as the original question noted), and using the display manager (lightdm, gdm, lxdm, etc.) is the recommended approach to safely disable the X server.
-
RichieHH over 3 yearslightdm was never gdm. lightdm replaced gdm in Ubuntu. The title of the Q it is to do with EXITING the Xserver. There is a difference between exiting the display manager which your reply does and exiting theX server. Dont confuse X Server with Display Manager, or disable for exit.
-
Wlad over 3 yearsFor my future me: on Deepin 20.1 / DeepinOS 20 press:
Ctrl
+Alt
+F2