36

To install the graphics driver I need to exit GUI / Gnome and go to the terminal. How can I do this in Ubuntu 18.04? Ctrl(STRG)+Alt+F1...F7 does not work, neither on the desktop, nor on the login screen...

7
  • 1
    Hm. But the keyboard otherwise works? If need be, you can boot from grub in 'recovery mode' which will give you a console. From the menu start networking and install the necessary driver packages.
    – Martin W
    May 7, 2018 at 15:48
  • 1
  • 1
    Is the keyboard layout set properly? Does` STRG` + c work to stop running commands in the terminal? May 7, 2018 at 15:52
  • Thank you for quick answer. Yes, keyboard is correct, strg+c works. I'll try the recovery mode.
    – Jonny
    May 7, 2018 at 15:55
  • 1
    Yes, try recovery mode. You will need to enable networking to be able to download the driver. If you run into any issues connecting, don't worry there are solutions for that
    – Hee Jin
    May 7, 2018 at 16:17

7 Answers 7

41

In Ubuntu 18.04, they have changed things around and you cannot get to tty1, it is always showing the display manager / login screen. If you log in, you then cannot get to tty2 because it becomes the GUI for the first logged in user. The tradition of both GUIs showing on tty7 has ended.

You can get to tty3 by pressing Ctrl+Alt+F3, tty4 by pressing Ctrl+Alt+F4, tty5 by pressing Ctrl+Alt+F5 and tty6 by pressing Ctrl+Alt+F6.

You can then switch between tty3-6 by pressing Alt with the appropriate F-key.

Finally, you can get back to the GUI with Alt+F1 for the login chooser or Alt+F2 for the logged-in user's desktop.

3
  • 1
    Nothing helps me I have tried ALT+F1 ALT+F2 CTRL+ALT+F1 CTRL+ALT+F2 CTRL+ALT+F7 ... still in terminal. The ‘who’ output that there tty2 and tty5 but not inform which of them I currently logged in
    – CodeBy
    Sep 4, 2018 at 8:37
  • 1
    Thank you for the explanation. For me, this worked exactly as described with a fresh install of 18.04 (desktop).
    – arr_sea
    Sep 10, 2018 at 17:16
  • Simply-stated: CTRL + ALT + F3- thank you! Sep 5, 2019 at 15:33
6

I'm on an 18.04 laptop.

I have to press Fn as well as Ctrl+Alt+F3.

5

Assuming you're on a Desktop or Laptop, just use:

Ctl+Alt+F2

Or, you can boot into single-user mode, although you probably don't want this as getting internet in this mode can be tricky.

My preferred way of entering recovery mode is to set

init=/bin/bash

via grub. Then, run:

mount -o remount,rw /

after you get a shell. Then, you can try using

ifconfig eth0 up

for ethernet. If you use WiFi, try this question.

5
  • 7
    STRG is the German equivalent of CTRL, so the OP already indicated that this did not work.
    – Martin W
    May 7, 2018 at 15:49
  • Oh, but perhaps the keyboard layout is not set right? May 7, 2018 at 15:51
  • 1
    Thank you for quick answer, unfortunately this does not work, keyboard is configured correctly.
    – Jonny
    May 7, 2018 at 15:55
  • seconding, ctrl+alt+f2 does nothing for me Jun 7, 2018 at 0:12
  • i lost my gui and my ubuntu suddenly got locked into command mode. after logging in i was still in command mode.. ctrl+alt+f2 helped.. although not the same issue has the op has, but my problem got solved! thanks.
    – MycrofD
    Jun 16, 2018 at 13:19
3

The "official" way to this under Ubuntu is to pass systemd.unit=multi-user.target as a kernel parameter. So in my /boot/grub/grub.cfg I have the following entry:

menuentry 'Ubuntu Console Linux 4.15.0-23-generic' {
    linux  /boot/vmlinuz-4.15.0-23-generic root=/dev/sdb1 ro rootfstype=ext4 apparmor=0 quiet systemd.unit=multi-user.target
    initrd /boot/initrd.img-4.15.0-23-generic
}

Unfortunately, the grub.cfg file is populated with all kinds of unnecessary information. I usually delete all that and have the above chunk plus a similar one without the systemd.unit=multi-user.target which starts up gdm ( The X11 GNOME display manager).

0
0

Here is how it worked for me, thanks for all the help that brought me there:

choose advanced options in Grub
choose recovery mode
in the options that show up, one can load the network driver and mount r/w
(mount r/w is part of the load network driver and dpkg options)
choose "root..." to get to the console
(use "mount -o remount,rw /" to get read and write access if not done with the options above already)

Note1: Loading the network driver didn't work for me, the pc always freezes. However I had the nvidia driver installation file locally, so could install it. After that I could not enter gnome any more, so had to reinstall Ubuntu 18.04 completely.

Note2: After installing the Nvidia driver for my graphics card different: via "sudo apt-get install nvidia-390", I always get the error in python "ModuleNotFoundError: No module named 'tkinter'", but of course tkinter is installed. So currently I can not use python... it was the same error in ubuntu 16.04 and the reason why I updated. Hoped it would work in 18.04... I opened a new post for this: After installing Nvidia driver I get "ModuleNotFoundError: No module named 'tkinter'" error in Python3

My original question here how to get to the console is answered and aside from freezing instead of loading the network driver is solved.

0

To switch to the complete terminal mode in Ubuntu 18.04 and above, simply use the command Ctrl+Alt+F3.

To switch back to the GUI (Graphical User Interface) mode, use the command Ctrl+Alt+F2.

2
  • I couldn't switch back to GUI with the command you suggested. However ALT+F1 worked
    – ka3ak
    May 7, 2020 at 6:37
  • Switch back is ALT + F2. Nov 21, 2021 at 19:04
-1

Ctrl-Alt-F3 (4,5,etc) will just switch consoles and won't stop X from running wherever it was. Going into single user mode might work, but isn't the right way to simply stop X, leaving you at the console.

As dargaud mentioned in part of their answer, and I Answered to indicate that was the correct way a few minutes ago at: How do I exit the Gui, and return to a plain command line shell?

The correct answer is to type in a terminal in X: su init 3

I do NOT know, but suspect the machine is not in the exact state when booted in single user mode, as opposed to booting normally, then simply quitting X with init 3 in a terminal, as root or with su.

I've had to do it many times, and just had a thought that maybe init x - where x is some number, for example, init 9... or whatever correct number, might start X11 back up, but try man init and see if you can figure it out without going crazy.

1
  • as written, your command does not make sense because su is the switch user command. Perhaps there is some implementation of su where you can follow it directly with the command you want to run as root (or some other user) without specifying the user in any way, but I don't think it can work like that on Ubuntu. The simplest way would be not to use su at all and just use sudo init 3. The "proper" way to switch to runlevel 3 these days is, I suppose, sudo systemctl isolate multi.user.target. It doesn't seem to work though XD
    – Zanna
    Dec 2, 2021 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.