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.

4
  • 9
    Have you tried appending a 3 to the boot options (adding 3 to quiet splash)?
    – muru
    Dec 12, 2016 at 2:26
  • I'll try that, so basically just change quiet splash to quiet splash 3 is that correct?
    – wisemonkey
    Dec 12, 2016 at 5: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, 2016 at 6:02
  • 1
    The most correct answer is here: superuser.com/a/1139020/403009
    – Eric
    Mar 29, 2018 at 19:15

4 Answers 4

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 
10
  • 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, 2016 at 1:24
  • Did you try the grub method described in the answer? Dec 12, 2016 at 2:17
  • 2
    @wisemonkey I have updated the answer with manual updating of grub from Live DVD/USB. Dec 12, 2016 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, 2017 at 14:41
  • 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, 2019 at 13:05
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.

7
  • (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, 2016 at 1:26
  • I replied to your comment by editing my answer.
    – karel
    Dec 12, 2016 at 2: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, 2016 at 5: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, 2018 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, 2018 at 12:48
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.

2
  • 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, 2016 at 1: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? Mar 29, 2020 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.

You must log in to answer this question.

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