19

How can I boot Debian into text mode? My mouse and keyboard are working in GRUB, but when the login screen appears they don't, so I can't do anything.

1

6 Answers 6

9

You can also do CTRL ALT F key where F key is F1 to F6 to bring up that text login screen. Note that screen 1 is where the bootup information is.
CTRL ALT F7 will take you back to the GUI.

Going into single user mode stops many of the services which are present in the multi-user mode. This probably not what you want here.

8

At the boot prompt

If you're at a boot prompt, boot in single user mode by adding 1 (or single) at the end of the kernel command line. In that mode, you only have a minimum set of services started — filesystems are mounted, you can log in in text mode on the console, and that's about it.

Fake display manager

There's a way to specifically avoid starting a display manager on Debian. The scripts that start display managers at boot time check if they are the default display manager, to ensure that only one display manager will be run. So set a fictitious default display manager. Make sure that /etc/X11/default-display-manager exists but doesn't contain the name of a display manager (e.g. make it empty).

Through runlevels

Unless you've installed an alternative init, Debian uses System V init, with runlevels. A runlevel is, roughly speaking, a set of services to run. The 1 above means runlevel 1, with very few services. Linux SysVinit has four levels (2 to 5) that correspond to normal system operation. Under Debian, these four levels have the same effect by default; it's up to the system administrator to customize them if desired. In your situation, I guess you want to define a runlevel without X and make it the default.

  • Arrange for level 2 not to start any of the graphical login managers (xdm, gdm, kdm, …).
    • For e.g. xdm: remove the symbolic link /etc/rc2.d/S??xdm (where ?? are two digits), and replace it by /etc/rc2.d/K??xdm copied from /etc/rc0.d/. S means “start”, K means “kill”; the symbolic links in /etc/rc$N.d indicate what services to start or stop when entering runlevel $N.
    • Alternatively, install file-rc or sysv-rc-conf for easier runlevel management.
  • Make sure that the default runlevel is 2. The default runlevel is set in /etc/inittab, with the line id:2:initdefault:.
1
  • 1
    I would like everything except a GUI. Does Debian have a --no-gui or similar? I don't have a display and SSH is not available. SSH does not start early enough to get a remote shell thanks to Systemd.
    – user56041
    Jan 27, 2018 at 16:23
1

Append 'single' to kernel boot command line ('e' key in GRUB if memory serves me well).

1

From the bootable LiveCD / USB (it should work whichever way you boot as long as you can edit the kernel command line...)

  1. Press [Tab] at the prompe to show the kernel command line parameters
  2. Add systemd.unit=multi-user.target (should be space-separated with other params)
  3. Press [Enter] to boot.

NB: Also remove splash and quiet if you don't want any graphical content during boot and see the kernel messages instead.

For a regular system, you can do the same, assuming you use Grub2 you will have to press e to edit the boot config and add the same parameter at the end ot the linux line.

0

As root:

systemctl disable lightdm

Important warning: I tested this with a Debian 9 running in Virtualbox and, though it worked, the reverse didn't. The display manager didn't restart automatically at boot after I ran:

systemctl enable lightdm

Though I was able to start it again manually with

systemctl start lightdm

Maybe a problem with my setup, anyway I thought that the warning was a good idea.

1
  • I tried this, but looks like every time I have to run systemctl start lightdm from the non-UI command login. Anyone knows how to set the system to work normally (i.e., show the UI login screen) again?
    – Samik R
    Apr 12, 2019 at 5:43
0

Uninstall any display manager:

apt-get remove gdm3 ldm lightdm sddm slim wdm xdm lxdm nodm

If you still want to use X11, install xinit instead.

apt-get install xinit

And run startx to start X11.

You must log in to answer this question.