Linux exit x windows

How to kill and to start the X server?

In 12.04 How do you kill the X server from the command line and from the GUI interface and how do you start it from the virtual terminal?

If you just want to kill the X server, you can enable the Ctrl+Alt+Backspace key combinations on “Options” of keyboard layout settings.

4 Answers 4

One way to restart an instance of the X server is to run (from the commandline)

sudo service lightdm restart 

For Ubuntu 15.04 and later:

sudo systemctl restart lightdm.service 

and for Kubuntu 15.04 and later:

sudo systemctl stop sddm.service 

lightdm? I thought gdm was for GNOME, kdm for KDE, xdm for XFCE and lightdm for LXDE! and to stp it from the gUI?

lightdm starts only one instance of Xorg, so restarting lightdm should close the only open Xorg instance, unless you’re doing something much more complicated.

On 12.04, you can restart the server with the shortcut keys: Right Alt + Print Screen + K .

What a strange combination!. Print. It has no logic; and what would «(Right alt) + (Print Screen) + K» be in an Apple keyboard? I have right command and no print

en.wikipedia.org/wiki/Magic_SysRq_key has more info on it if you want to understand the logic behind it. printscreen is the same key as sysrq(System Request).

@semi: «printscreen is the same key as sysrq» — not on my keyboard. sysreq is the same key as delete .

In order for this to work you need to run this command once: sudo echo kernel.sysrq=1 > /etc/sysctl.d/10-magic-sysrq.conf

Press Ctrl + Alt + F1 and then run:

sudo service lightdm stop 

… depending on your display manager.

NOTE: To recover use startx , alternatively replace the stop with start in either of the above commands.

Kill : xkill -a . -a means it will kill all display instances. For more information run man xkill .

Run : xinit . Also startx but this command is to start an instance and not the server itself. For more information run man xint and man startx .

I don’t believe it’s possible to kill Xserver from GUI, and even if it were, it would not be the right way to do it.

Wouldn’t that kill all individual windows, which is not what the user wants? For example I don’t want to kill all my firefox windows, I want to restart the visualisation.

The user said: «kill and start the X server». That seems to be exactly what he wants. It’s not about restarting gnome-shell.

Источник

How do I exit the window manager on the current X display?

Let’s say I have the window manager Blackbox running on two different X displays, e.g. :0.0 and :1.0 launched from tty1 and tty2 respectively. From a terminal (emulator), how do I exit (kill) the Blackbox process that uses the current X display? The command killall blackbox does not fit since it terminates both sessions.

Читайте также:  Таблица приложений linux windows

@richard , i’ve expanded your comment into an answer . and your ps usage seems different than mine . i want environment variables as well as commandline arguments . what flavour of unix system are you working on ?

@richard This will give me the tty (seventh column) for each Blackbox process but in the general case I don’t know which one is running on the current display.

3 Answers 3

ps e lists processes with their commandline along with ( initial ? ) environment variables . filter processes matching either a -display :0 commandline or a DISPLAY=:0 environment . i believe this find the wm in question whether started manually or by some session script . then we can simply kill it .

i hear there are different ps implementations , the above ( bsd ? ) commandline style works on my machine with debian procps-ng . refer to the manual if necessary .

based on the observation that wm is owner of the root window , this arch wiki page has a minisection with an approach of xprop -root _NET_WM_PID to find the pid , . but this don’t work for me , seemingly because it is only voluntary for x windows to provide this property , and my wm happens to not follow that fashion .

regarding other nonworking ideas , xkill can detach clients except the root window , so don’t fill our need here .

Источник

How to close X Server, to avoid errors while updating nVidia driver?

I tried to update my nVidia driver but I got an error when I ran the driver installation. See the error:

 ERROR: You appear to be running an X server; please exit X before installing. For further details, please see the section INSTALLING THE NVIDIA DRIVER in the README available on the Linux driver download page at www.nvidia.com. 

Note: I tried following a guide by typing init 3 but still nothing changed.. How to close the X server? So I can update the driver

9 Answers 9

I don’t think I’ve ever gotten that installing/updating nvidia, but here:

# To stop: sudo init 3 # To resume: sudo init 5 

Though I’m not 100% sure that’ll work on Ubuntu, IIRC they moved away from init. On Ubuntu, try this (replace gdm with kdm/slim/whatever display manager you use):

# To stop: sudo service gdm stop # To start: sudo service gdm start 

I’m pretty sure that stops the whole X session

Less cleanly, you could just kill them:

I tried your first solution and didn’t work, then I tried your second solution it says unrecognised service(I tried all of them) I also tried your last solution and it says no proccess found

@CKM you need to be on a virtual console, ctrl-alt-f1 through f6. Ctrl-alt-f7 will get you back to the gui once you start it again.

Читайте также:  Linux узнать прослушиваемые порты

Depending on your version the way of stopping the X server varies. You have to exit the graphic mode (by typing alt+ctrl+F1 , for example), login, and then type one of the following commands to stop the X server:

sudo service lightdm stop sudo service gdm stop sudo service kdm stop //this is the one that worked for mi as I use kdm and Linux mint 

Now you can install the drivers and then type

When you write sudo service press tab to see the options you have (gdm, kdm. )

As the error states, you are still running an X server. This error occurs when you try to install the Nvidia .run files while logged in.

Make sure you are logged out.

  • Hit CTRL+ALT+F1 and login using your credentials.
  • kill your current X server session by typing sudo service lightdm stop or sudo stop lightdm
  • Enter runlevel 3 (or 5) by typing sudo init 3 (or sudo init 5 ) and install your .run file.
  • You might be required to reboot when the installation finishes. If not, run sudo service lightdm start or sudo start lightdm to start your X server again.

Booting to a different runlevel

Runlevels in Linux dictate which services are started and stopped automatically when the system boots or shuts down. The runlevels typically range from 0 to 6, with runlevel 5 typically starting the X window system as part of the services (runlevel 0 is actually a system halt, and 6 is a system reboot). It is good practice to install the NVIDIA Linux Driver while X is not running, and it is a good idea to prevent X from starting on reboot in case there are problems with the installation (otherwise you may find yourself with a broken system that automatically tries to start X, but then hangs during the startup, preventing you from doing the repairs necessary to fix X). Depending on your network setup, runlevels 1, 2 or 3 should be sufficient for installing the Driver. Level 3 typically includes networking services, so if utilities used by the system during installation depend on a remote filesystem, Levels 1 and 2 will be insufficient. If your system typically boots to a console with a command prompt, you should not need to change anything. If your system typically boots to the X window system with a graphical login and desktop, you must both exit X and change your default runlevel.

On most distributions, the default runlevel is stored in the file /etc/inittab, although you may have to consult the guide for your own distribution. The line that indicates the default runlevel appears as

or similar, where n indicates the number of the runlevel. /etc/inittab must be edited as root. Please read the sections on editing files and root user if you are unfamiliar with this concept. Also, it is recommended that you create a copy of the file prior to editing it, particularly if you are new to Linux text editors, in case you accidentally corrupt the file:

# cp /etc/inittab /etc/inittab.original 

The line should be edited such that an appropriate runlevel is the default (1, 2, or 3 on most systems):

Читайте также:  Linux изменить файловую систему флешки

After saving the changes, exit X. After the Driver installation is complete, you may revert the default runlevel to its original state, either by editing the /etc/inittab again or by moving your backup copy back to its original name.

Different distributions provide different ways to exit X. On many systems, the init utility will change the current runlevel. This can be used to change to a runlevel in which X is not running.

There are other methods by which to exit X. Please consult your distribution.

List all yours processes with:

List all your runing services with:

Источник

Linux Mint Forums

[SOLVED] Exit and stop X Window and drop to terminal

Forum rules
There are no such things as «stupid» questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.

[SOLVED] Exit and stop X Window and drop to terminal

Post by zaileion » Fri Jul 10, 2015 8:30 pm

Back in the day, Linux didn’t automatically boot into a GUI. you had to log in and type startx to launch the X Window system.

I m trying to compile a list of useful commands and would like to know how to stop the X Window service and drop to a terminal. just like back in the day. I’m also trying to install drivers and i dont want X running.

I’m aware of CTRL+ALT+F2 but that doesnt stop X.

Lets use this for an example: if i burn Debian testing (not live CD) to a DVD and boot it. i can select advanced options and select recovery mode. this boots up and activates the network drrivers and askes me a few options of which i choose drop to shell and select the partition my GNU/Linux install is on. now i’m in a terminal without X Window running.

I’ve searched through google for a few hours and found some info about changing init levels and such but there has to be a simple or relatively simple command to simply exit XWIndow.

Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.

Re: Exit and stop X Window and drop to terminal

Post by xenopeek » Sat Jul 11, 2015 4:15 am

To stop X you have to stop your display manager. Switch to a virtual console (Ctrl+Alt+F1 through F6), login, run the command «sudo stop mdm». Done.

Image

Re: Exit and stop X Window and drop to terminal

Post by WharfRat » Sat Jul 11, 2015 2:45 pm

Источник

Оцените статью
Adblock
detector