71

I want to know if there is a way to switch to console mode from the boot menu. I have an NVIDIA 1070 and every time there is an update, the GUI stops working. All I need to do is re-install the drivers; however, to do that I need to be in console mode.

EDIT: I should have added more information to this question but I'll comment on all answers. In short: I've tried text instead of quiet splash I do see booting activity in text mode; however, I don't get a login screen and ctrl + Alt + F1 doesn't help because GDM keeps trying to restart. Previously I managed to kill GDM through multiple tries but is not working since the latest update.

EDIT: After searching for runlevel, I've found How do I change the runlevel on systemd? but I think it required me to have a running system to make changes -- please correct me if I'm wrong.

Pablo Bianchi
  • 15,657
wisemonkey
  • 3,393
  • 9
    Have you tried appending a 3 to the boot options (adding 3 to quiet splash)? – muru Dec 12 '16 at 02:26
  • I'll try that, so basically just change quiet splash to quiet splash 3 is that correct? – wisemonkey Dec 12 '16 at 05:47
  • Amazing thanks a lot, this is what I was looking for. I would like to know if I can somehow make NVidia (proprietary) drivers configure properly with every kernel update. But even if not this should help me. You can add it as an answer and I'll accept it. – wisemonkey Dec 12 '16 at 06:02
  • 1
    The most correct answer is here: https://superuser.com/a/1139020/403009 – Eric Mar 29 '18 at 19:15

4 Answers4

66

Yes you can. As described here (ubuntuhandbook.org - Boot into text console ubuntu) you need to edit /etc/default/grub to have the next boot end up in text mode. In summary you will set these parameters:

GRUB_CMDLINE_LINUX_DEFAULT="text"
GRUB_TERMINAL=console

After saving changes you need to run:

sudo update-grub
sudo systemctl enable multi-user.target --force
sudo systemctl set-default multi-user.target

Undoing text-mode

To undo sudo systemctl set-default multi-user.target simply type

sudo systemctl enable graphical.target --force
sudo systemctl set-default graphical.target 
  • 1
    Is there any way to show login to terminal by default (like init 3 in old times), problem with ctrl+alt+f1 is that GDM keeps retrying to start and I don't get console. – wisemonkey Dec 12 '16 at 01:24
  • Did you try the grub method described in the answer? – WinEunuuchs2Unix Dec 12 '16 at 02:17
  • I can't login to system to edit /etc/default/grub though. – wisemonkey Dec 12 '16 at 05:53
  • 2
    @wisemonkey I have updated the answer with manual updating of grub from Live DVD/USB. – WinEunuuchs2Unix Dec 12 '16 at 11:08
  • 8
    This does not seem to work on Ubuntu 15.04 and up (I tried 16.04 LTS). A crucial step after you fixed the grub file and run update-grub is to execute: sudo systemctl set-default multi-user.target - only then it started booting straight into console for me. Solution from @yury in the comments of the link you gave. – f055 Sep 20 '17 at 14:41
  • Thanks @f055 that worked for me too on 16.04 that was in some kind of twist after I tried gnome and unity, after using xfce for a while. – Juha Untinen Feb 16 '18 at 09:27
  • Wait… and how do I undo this? – HerpDerpington Aug 14 '18 at 17:46
  • 2
    The undo part is not working on Ubuntu 18.04 and I'd also love to know how to revert this change properly so I don't have to type startx on every boot. Thanks in advance! – hullunist Sep 18 '19 at 13:05
  • Try this which I'll update into answer when I get on a computer: https://unix.stackexchange.com/questions/520045/startx-not-automatically-running-on-reboot: – WinEunuuchs2Unix Sep 18 '19 at 15:17
  • @hullunist I've updated the answer – WinEunuuchs2Unix Sep 18 '19 at 22:41
45

Boot into recovery mode

Immediately after the motherboard / computer manufacturer logo splash screen appears when the computer is booting, with BIOS, quickly press and hold the Shift key, which will bring up a GNU GRUB menu screen. With UEFI press (perhaps several times) the Esc key to get to the GNU GRUB menu screen. Sometimes the manufacturer's splash screen is a part of the Windows bootloader, so when you power up the machine it goes straight to the GNU GRUB menu screen, and then pressing Shift is unnecessary.

The timing when to press the left Shift key can be tricky, so sometimes if you miss it you need to try it again. If that doesn't work try the answers to I can't get the GRUB menu to show up during boot.

You will see a GNU GRUB menu screen that looks like this. Select Advanced options for Ubuntu and press Enter.

enter image description here

A new purple screen will appear showing a list of kernels, which includes options of booting the kernels normally or in recovery mode.

enter image description here

Press the down arrow key until you select the 2nd entry from the top (the one with the recovery mode in the description) and then press Enter twice.

Now you should see this recovery menu:

recovery menu

Using the arrow keys scroll down to network (the third entry from the bottom in the Recovery Menu) and then press Enter.

Using the arrow keys scroll down to root (the second entry from the bottom in the Recovery Menu) and then press Enter.

You should now see a root prompt and you can run commands from it.

lightdm is called lightdm because it is a lightweight application compared to GDM which is heavy and takes longer to load. If you still have lightdm installed you can switch back to using lightdm as the default login display manager with the command: dpkg-reconfigure gdm3. This will open up a new window allowing you to select either gdm3 or lightdm as the default login display manager.

Reboot the computer with the command reboot

After that the keyboard shortcutCtrl+Alt+F3 may start to work properly, and allow you to start Ubuntu from the console.

Start Ubuntu from a virtual console

  1. Open a text-only virtual console by using the keyboard shortcut Ctrl+Alt+F3.

  2. At the login: prompt type your username and press Enter.

  3. At the Password: prompt type your user password and press Enter.

  4. Now you are logged in to a text-only console, and you can run terminal commands from the console. To reboot the system run the command: sudo reboot. Press the keyboard shortcut Ctrl+Alt+F7 to exit the virtual console. In Ubuntu 17.10 and later press the keyboard shortcut Ctrl+Alt+F2 to exit from the virtual console.

    After you have logged in in the terminal type sudo systemctl start graphical.target and press Enter to bring up your default login screen, and then login to your Ubuntu desktop environment as usual.

karel
  • 114,770
  • (Just copying previous comment):

    Is there any way to show login to terminal by default (like init 3 in old times), problem with ctrl+alt+f1 is that GDM keeps retrying to start and I don't get console.

    – wisemonkey Dec 12 '16 at 01:26
  • I replied to your comment by editing my answer. – karel Dec 12 '16 at 02:07
  • Thanks Karel, but this assumes I can get system running somehow. Is that correct? Is there a way to issue sudo dpkg-reconfigure gdm without logging in? – wisemonkey Dec 12 '16 at 05:49
  • This does not waor anymore sudo dpkg-reconfigure gdm-> package gdm is not installed(ubuntu 16.04). And sudo dpkg-reconfigure lightdm does not do anything. – Robert Mar 30 '18 at 12:44
  • @Robert You are partially right. The reason why I referred to gdm is that gdm is mentioned in the question, therefore I was required to address it in my answer. However if you run the command apt policy gdm in Ubuntu 16.04 you will see that gdm is indeed a package in the default Ubuntu 16.04 repositories. – karel Mar 30 '18 at 12:48
  • @karel Sorry, but if gdm exists or not is currently out of scope for me. I just trying to stop my x11 process running amok (starting & crashing again and again thousand times) making Ubuntu unusable. Any suggestions how to disable x11 at boot? – Robert Mar 30 '18 at 12:53
8

Press CTRL+ALT+F1 or any other function (F) key up to F7, which takes you back to your "GUI" terminal. These should drop you into a text-mode terminal for each different function key.

Otherwise you can boot into recovery mode if you need:

https://wiki.ubuntu.com/RecoveryMode

Basically hold down SHIFT as you boot up to get the Grub menu.

Fabich
  • 137
  • 3
    (copying previous comment):

    Is there any way to show login to terminal by default (like init 3 in old times), problem with ctrl+alt+f1 is that GDM keeps retrying to start and I don't get console. And for recovery mode its same results if I say clean start. I'll read up on other recovery modes and see if they are helpful

    – wisemonkey Dec 12 '16 at 01:26
  • This is what I always used to do, but it doesn't work anymore in Ubuntu 19.10. Ctrl+Alt+F2-6 just take you to a black screen now, and Ctrl+Alt+F1 is now actually the login manager. Any ideas what to do on new versions? – Joseph Garvin Mar 29 '20 at 19:37
0

Editing /etc/default/grub gave me the boot menu that I needed to boot in recovery mode.

These were my steps:

  1. Edit /etc/default/grub and set GRUB_TIMEOUT to -1 (the documentation also mentions that you need to comment out any setting of GRUB_HIDDEN_TIMEOUT). This will allow the boot menu to pop up and stay there until you take action.
  2. Run sudo update-grub for changes to take effect.
  3. Reboot and select the Recovery Mode option in the Grub menu.
Zanna
  • 70,465
jverce
  • 1