-1

I installed ubuntu server 20.04 on a VM; Then i tried $ startx but it said X could not be found, so i installed it;

$ sudo apt install xinit

Now every time it boots, i get the GNOME Gui (gdm3);

How do I exit the Gui, and back into a plain shell?

What I tried didn't work:

$ sudo service gdm3 stop

, this does exit the GUI into a black screen, no $ prompt; (just a blinking cursor, looks hanged, so after 5 mins I just re-booted the VM)

2
  • 2
    You're looking for a tty: askubuntu.com/a/66198/1474576
    – frippe
    Oct 12, 2021 at 18:56
  • @frippe appreciate your comment, it worked ! but i accepted the other long explanation below.
    – joedotnot
    Oct 12, 2021 at 19:24

3 Answers 3

3

Ctrl-Alt-F2 should drop you in a text console. Ctrl-Alt-F1 to get back to X11.

Also sudo init 3 is the traditional way to get out of X11, I'm not entirely sure if it still works nowadays.

1

The text shell works in parallel with the GUI. Ubuntu (basically almost any Linux distro) uses 7 virtual terminals (VTs), accessible by pressing Ctrl+Alt+F1 to Ctrl+Alt+F7 (if you are on a text terminal, you can skip Ctrl and press Alt+F1 to Alt+F7 only).

Traditionally, VTs 1 to 6 were text terminals, while VT 7 was reserved for X. In new Ubuntu versions, however, this is different. GDM runs on VT 1. If you actually login to GNOME session via GDM, that session runs on VT 2. VT 7 displays some messages from system boot-up. So VT 3 to VT 6 can be used as text terminals.

So if you are on GDM or GNOME screen, pressing Ctrl+Alt+F3 to Ctrl+Alt+F6 should switch you to one of the text terminals available. Pressing Ctrl+Alt+F1 (or just Alt+F1) will bring you back to GDM screen, and pressing Ctrl+Alt+F2 (or Alt+F2) - to GNOME screen.

2
  • Thanks for the long explanation; what is the purpose of GDM (Ctrl+Alt+F1), it just shows me a locked GUI; Ctrl+Alt+F2 is more useful, it's the GNOME screen that I get after I logged on.
    – joedotnot
    Oct 12, 2021 at 19:23
  • Returning to GDM you can login to another user; it will start a new GUI on a new terminal.
    – raj
    Oct 12, 2021 at 21:52
0

As far as the fundamental question "How do I exit the Gui, and back into a plain shell?"

The 2nd part of dargaud's answer: "sudo init 3" bit is the correct answer to the question of how to quit X back to the console. Ctrl+Alt+F(whatever) are just switching to different consoles and will not shut down X. I've had to do it switching X drivers from generic to Nvidia proprietary, as I was unable to do it with X running.

And it still works fine on my up-to-date Ubuntu v20.04 LTS - Dec. 1st, 2021

You must log in to answer this question.

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