2

Is it possible to kill the GUI and end up with a CLI since the GUI runs on the top of the shell?

I have check the question below How to kill and to start the X server?

Magic keys restarted the GUI and I ended up with the login menu but not a CLI I am using Ubuntu 12.04 , I dont want to use virtual terminal I just want to prove to myself that the GUI runs on top of the shell and I can always exit the GUI to the shell

Thanks

Hinklo
  • 626

2 Answers2

3

To shut down your X session type in the command line:

sudo service lightdm stop

So you will end up in the virtual terminal #7. You then can hit Ctrl+Alt+F1 - Ctrl+Alt+F6 to get a login prompt. For terminal #7 (Ctrl+Alt+F7) there is no tty started because it's meant for the x server.

Edit:

If you want to end of in a shell, then create a file called /etc/init/tty7.conf with content:

# tty7 - getty
#
# This service maintains a getty on tty7 from the point the system is
# started until it is shut down again.

start on runlevel [23] and not-container

stop on runlevel [!23]

respawn
exec /sbin/getty -8 38400 tty7

After creating this file reboot the system, and then when you perform sudo service lightdm stop you will end up in a login shell.

chaos
  • 27,506
  • 12
  • 74
  • 77
  • does this mean the x server does not run on the top of a shell? – Hinklo Nov 08 '13 at 12:42
  • It does run on top of a virtual terminal (also virtual console), but not on top of a shell (bash, sh, csh, tcsh, ...). But you can start a shell in a virtual terminal, like in #1 - #6. When you stop the X session there is nothing to enter commands unless there is a shell started, like in #1 - #6. – chaos Nov 08 '13 at 12:48
  • @user1298069 see my edit – chaos Nov 08 '13 at 13:08
  • thanks but how do they do it in BackTrack then? you login with your user name and password into bash then you start X server and GUI with "startx". btw you are a great help, thanks – Hinklo Nov 08 '13 at 13:13
  • Np, you can do the same in ubuntu, when you login in the shell then you can type startx and your desktop will appear. startx is like lightdm a display manager, but non-graphical. – chaos Nov 08 '13 at 13:18
0

That solution brings your "GUI" back because you have the lightdm service running. Run sudo stop lightdm. That command will stop your lightdm service, kill X server and bring the console.

Once in the console, if you want to start your X11 session again, run sudo start lightdm.

Jesse
  • 719
  • I've tried this but then like chaos explained in his answer I have to log into an other virtual terminal to start lightdm. How do I achieve something like the case of BackTrack, you start the GUI with "startx". I want to exit the GUI to the shell, thats all – Hinklo Nov 08 '13 at 12:44