2

I'm running Linux Mint 10, although I've had this same issue with other variants of Linux. I've been told/found while researching that if the X server hangs or otherwise errors, one can drop to a root prompt, usually at another tty, and execute init 3 (to drop to single user mode) and then init 5 to return to the default, graphical session.

Needless to say, I've tried this before in multiple configurations on multiple machines to no avail. The only feedback I receive form executing those two commands is a listing of VMWare services (from a kernel module) that are stopped and then restarted.

Note: If I run startx (either before or after init 3), then I am told that the xserver is still running and that I should remove /tmp/.X0-lock. Having tried that, it removes that error message, but claims that the xserver cannot be attached as another instance is running.

How do I kill the xserver completely? Can I killall some process name?

1
  • Just to call this out for emphasis, as @jsumners said, runlevel 3 is still multi-user. May 21, 2012 at 2:25

3 Answers 3

4

Linux Mint is based on Debian. In Debian, the single user run level is 1; 3 is still a multi-user run level and as such allows X to continue execution. So, you need to switch to run level 1, init 1, to stop all processes initiated by the default run level (2). Then you can re-init to the proper run level: init 2.

See Debian run levels for more information.

1
  • +1 Good point, on Debian, runlevel 3 and runlevel 5 are the same thing. See, e.g. /etc/init/gdm.conf.
    – Mikel
    Feb 23, 2011 at 21:26
1

The easiest way to kill your X server is to press Ctrl+Alt+Backspace.

For example, on Ubuntu, the keyboard shortcut is called "DontZap", and can be re-enabled by following these instructions. It should be the same on Linux Mint.


It's best not to run startx. It is independent from init 3/init 5, and will confuse things.


These days, pkill is preferred over killall. It basically does the same thing, but it has a partner command pgrep you can use to see what it would kill before doing it.

So try pgrep X or pgrep Xorg, and then run pkill X or pkill Xorg if pgrep lists only programs you want to kill.

On my Ubuntu system, the most reliable command I can find is:

pgrep -f '^/usr/bin/X '

which means you can kill all X servers using

pkill -f '^/usr/bin/X '

(but I haven't tested it).


Finally, don't forget to have a look in /var/log/X.0.log and ~/.xsession-errors. Maybe you can figure out what is causing the X server hangs.

1
  • 1
    Ctrl + Alt + Backspace has been disabled for a reason, because there's a Magic SysRq Key, speak Alt + Print + K for it. Also, just for the record, Google is not considered helpful.
    – Bobby
    Feb 23, 2011 at 8:20
1

When I update Xorg or video drivers:

  1. Press Ctrl+Alt+F1
  2. Log in as a user
  3. Type the following commands:

    sudo /etc/init.d/lightdm stop #or slim gdm mdm etc...
    #do stuff
    sudo /etc/init.d/lightdm start #or slim gdm mdm etc...
    

(Stopping the Display Manager also stops X.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .