Linux exit x session

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.

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.

Читайте также:  Install smb on linux

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):

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:

Источник

How do I end an X session in Linux?

Usually the last thing . xinitrc does is to call a window manager or a session manager (e.g. twm , fvwm , gnome-session , …). This way, I can exit by using my-favorite-window-manager’s “exit” command, or by running kill $XSESSION_PID from any shell in this X session.

How do you kill an X session?

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 .

How do I exit init 3?

if you happen to go to X via a grpahical login, and run “init 3”, then the XDM service will be terminated, and any processes directly based upon it. if you’re not booting to a graphical login, just log out… indeed if for some reason you DO use an xdm login, just log out.

How do I start X11 service in Linux?

  1. Step 1: Install required X11 packages.
  2. Step 2: configure X11 forwarding.
  3. Step 3: Configure putty and Xming to perform X11 forwarding connect and verify X11 forwarding.
  4. Step 4: Configure the EC2 Linux session to forward X11 if you are switching to different user after login to run GUI-based installation / commands.
Читайте также:  Hello, Nginx!

How do I change the run level in Linux?

Linux Changing Run Levels

  1. Linux Find Out Current Run Level Command. Type the following command: $ who -r.
  2. Linux Change Run Level Command. Use the init command to change rune levels: # init 1.
  3. Runlevel And Its Usage. The Init is the parent of all processes with PID # 1.

What is the difference between init 6 and reboot?

In Linux, the init 6 command gracefully reboots the system running all the K* shutdown scripts first, before rebooting. The reboot command does a very quick reboot. It doesn’t execute any kill scripts, but just unmounts filesystems and restarts the system. The reboot command is more forceful.

What is X11 in Linux?

The X Window System (also known as X11, or simply X) is a client/server windowing system for bitmap displays. It is implemented on most UNIX-like operating systems and has been ported to many other systems.

How do you test if X11 forwarding is working?

To test to make sure X11 is working properly, run “xeyes” and a simple GUI should appear on the screen. That’s it!

What is run level in Linux?

A runlevel is an operating state on a Unix and Unix-based operating system that is preset on the Linux-based system. Runlevels are numbered from zero to six. Runlevels determine which programs can execute after the OS boots up.

How to kill all user sessions in Linux?

How does one exit the X server in Ubuntu?

Is there a way to stop the X Server?

Is there a way to keep the X session running?

Источник

Exit graphical X session and getting back to TTY

If I start a graphical session (usually Unity Desktop, sometimes XFCE, but a general approach is appreciated) from a TTY using startx , how can I exit this GUI again to get back to my TTY console without logging out? I tried pkill init which seemed to do what I want, but is this the right way to go? Is the TTY session afterwards in an equal state to before startx or are there any traces left? And preferably the solution should not force running applications to terminate, but quit them gracefully. Edit: I started a Unity Desktop session with startx $(which unity) and then ran in a terminal emulator gnome-session-quit with all possible argument combinations, but it did nothing and always failed with the error message below:

** (gnome-session-quit:3968): WARNING **: Failed to call logout: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files 

What session are you starting, specifically? some provide their own quit functions (such as gnome-session-quit )

@steeldriver I tried gnome-session-quit , but it fails with the message in the question edit and does nothing.

2 Answers 2

works ok. Not sure you’re going to find a generic way to gracefully close all possible sessions.

For some reason if I start a unity session from TTY, and then run

in a terminal, it seems to close it fairly gracefully.

I note you didn’t say why you’d want to do this? Suggest using regular logout method, if you started with startx it should go back to character mapped text display.

If you still see the graphical login, and/or if you don’t care to save changes or logout normally, or if something has crashed, sometimes I will run from the virtual tty killall -u $(whoami) which get things done rather fast. Looking forward to also trying killall xinit which sounds effective. Both are fairly brutal ways.

Читайте также:  What is red hat linux certification

You can logout of graphical while keeping a terminal running with tmux . You need to start tmux before you realise the job is long mind.

I want a long running terminal app to keep running through my logout and terminate X11, I will go ctrl-alt-f4 to login on the «black and white» screen, then su to myself (or another user if I wanna do killall user), then start a tmux session, then ctrl-alt-f1 back to the GUI and go:

I can then alt-F4 this or logout and session is still there.

Источник

How does one exit the X server?

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?

if 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

The 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.

7 Answers 7

GDM was switched out for LightDM, so:

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/

The 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 ?

@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.

The reason that doesn’t work is because Ubuntu 11.10 has switched from GDM to LightDM.

sudo service lightdm stop 

You can also use the keyboard shortcut:

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.

@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.

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)

Источник

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