Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

3/19/22, 1:03 PM How do I disable X at boot time so that the system boots in text mode?

How do I disable X at boot time so that the system boots in text mode?

[+248] [17]
Olivier Lalonde
[2010-12-06 02:42:01]
[
boot
display-manager
text-mode
]
[ https://askubuntu.com/questions/16371/how-do-i-disable-x-at-boot-time-so-that-the-system-boots-in-
text-mode ]

Is it possible to disable X at boot time? I'm setting up a server so it would be nice if it wouldn't load the
graphical interface every time I boot.

On the GDM login screen of 11.04 and earlier, I think there was an xterm session option that would just give you a command line.
Alternatively, you may be able to reach something from a recovery option in GRUB, though you probably wouldn't be able to set it as a
default that way. - Knowledge Cube
you can also watch this post askubuntu.com/questions/2093/… - hhlp
It is lightdm you want. It replaced gdm in 11.10. - Elvis Stressborg
Thank you. So, how do I stop LightDM from loading on bootup? - Jim Wilson

[+298]
[2011-11-16 01:35:56] Bruno Pereira
[ ACCEPTED]

Edit /etc/default/grub with your favourite editor, e.g. nano:

sudo nano /etc/default/grub

Find this line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Change it to:

GRUB_CMDLINE_LINUX_DEFAULT="text"

Update GRUB:

sudo update-grub

For systems that use systemd


This is an additional step for systemd releases, e.g. Ubuntu 15.04, the steps above for grub are still necessary.

You need to tell systemd to not load the graphical login manager:

sudo systemctl enable multi-user.target --force

sudo systemctl set-default multi-user.target

You will still be able to use X by typing startx after you logged in.

What's the benefit of this option instead of just inhibiting lightdm cf. askubuntu.com/a/79698/68124 ? - Stéphane Gourichon
(3) That works for lightdm, this works for any graphical login manager? This is the proper way of loading a Linux system without loading
a X server? Just seems more logical? Choose one... :) - Bruno Pereira
(1) Any graphical login manager ? This solution instead is tied to grub which it is not used (or even available) on new mobile platforms
where Ubuntu runs, while disabling the service is bootloader-independent. Proper way ? No fact mentioned. More logical ? Inhibiting a
particular service is not a logically a boot-time parameter. But you're still right somehow due to another fact: your solution not only
inhibits lightdm but also plymouth (at initrd step and others), so its semantics is not "disable X" but "disable any graphical setup" and
that needs to fiddle bootloader configuration. Thanks ! - Stéphane Gourichon
(2) Since the question is made for Ubuntu and not the mobile platform (can you even change anything in the mobile version of Ubuntu?
Why would that be a good thing? I am guessing you would be locked to a prompt that knows nothing about keyboard input and accepts
fancy finger touches and gestures :P) I am assuming we are talking about Ubuntu, the desktop Linux based operative system that I love
and can modify to my needs. :) But you are right, there is a semantics issue with the title of the post, feel free to edit it to something more
proper! Thanks for the comments. - Bruno Pereira

www.stackprinter.com/export?question=16371&service=askubuntu 1/11
3/19/22, 1:03 PM How do I disable X at boot time so that the system boots in text mode?
(1) Don't assume non-PC platforms are mobile phones or tablet only, poking fun at anyone showing that there's something outside
Plato's cave. All those anyway start as development boards without screen, keyboard or mouse but rather a serial port as first
communication channel, and keyboard support (e.g. via USB, or even USB OTG for the final product) is likely to be available before
touchscreen. wiki.ubuntu.com/ARM - Stéphane Gourichon
(1) @BrunoPereira it worked for me, but when I log in and issue startx it just shows the Ubuntu background image and I do not get any
desktop session. Do you know why? - x-man
(1) x-man , issue sudo service lightdm start - Sergiy Kolodyazhnyy
Wouldn't it just be easier to remove LightDM so running "startx" takes you straight into your desktop environment? It just seems logical
to me, like desktop managers are things that are made to be run at boot time. If you're going to type "startx" into a terminal to start your
desktop environment, wouldn't that make the desktop manager pointless, like, what would even be the point of having it? If you want to
use "startx" to start your desktop environment, it seems silly to bother with LightDM, or any desktop manager for that matter. - John
Scott
@FuzzyToothpaste That is your option, I am also fine with it. No one is saying what you can or not do, you could install a server release +
icewm and that would suffice for all graphical tasks but that is not the point of the question. the question is how to disable it, not to un-
install it or prevent installing. - Bruno Pereira
@BrunoPereira I'm using the "sudo systemctl ..." command and getting the error "The unit files have no [Install] section. They are not
meant to be neabled using systemctl." Any ideas? Update: Never mind ... I was reading hastily and didn't see that it was an additional
step, not a standalone. Sorry, let me try it again. - Joyce
@FuzzyToothpaste Uninstalling lightdm worked on 14.04. I tried it on 15.04 and then my system wouldn't boot! - Joyce
@BrunoPereira Okay, I followed all the steps and am still getting the same error. :( - Joyce
@Joyce Hai, I am installing 15.04 and testing this again (this was done a few weeks ago and could not catch up with new packages). Will
get back to you asap. - Bruno Pereira
(13) @Joyce first run systemctl get-default to find out what is the current run-level name and remember its name then use
systemctl set-default multi-user.target to change it to "multi-user.target" or run these equals commands instead and see the
changes. rm '/etc/systemd/system/default.target' then ln -s '/usr/lib/systemd/system/multi-user.target'
'/etc/systemd/system/default.target'. If the issue is still exist redo the default run-level that you remember it via systemctl
set-default RunLevelName. - αғsнιη
(1) @KasiyA Perfect, that's what was missing! Thanks for the suggestion, this worked perfectly in a test box. - Bruno Pereira
@KasiyA The "systemctl set-default multi-user.target" command did the trick for me! THANK YOU!! - Joyce
(1) In 15.04, to get back to graphical mode from your console, use @Xiao-Long's instruction below: sudo /etc/init.d/lightdm
start. - davidbak
I'm on 15.04. I did those steps and now I can't login. I get to a login screen tty1 and whatever I type I get login incorrect. I'm certain
the user and password are correct. What can I do? - Pier
are you using password less users? do not think that will work in this setup. - Bruno Pereira
@Pier askubuntu.com/questions/24006/… - Bruno Pereira
(4) on the systemctl command i get the error message: "The unit files have no [Install] section." - don bright
(1) I got the same problem but proceeded with the next step and was able to boot into console mode, but can switch to GUI any more -- it
gets stuck in a GUI login propt cycle if I start lightdm or starts to paint windows and hangs if I run startx. Anyone else have this
problem? - biggvsdiccvs
Is there any way to roll it back? askubuntu.com/questions/834832/… - al0s
(4) I am getting REALLY frustrated because A) this no longer works on bionic. B) All google searches come up with this answer. - rew
ubuntu CAN be used in mobile platforms. - Jiang YD
How do you revert this? The systemd thing, I mean. - FalcoGer
(1) I assume sudo systemctl set-default graphical.target should revert the systemd setting - Jannis Froese
(1) In UBUNTU 20, you can run sudo systemctl set-default multi-user Then you can restart and that's it.
(GRUB_CMDLINE_LINUX_DEFAULT is empty) - magallanes
1

[+33]
[2011-11-14 14:55:17] Andrew Gunnerson

Installing the GUI will probably cause it to start automatically, but it's very easy to boot to text mode in Ubuntu. Just
open /etc/default/grub as root and add text to the

GRUB_CMDLINE_LINUX_DEFAULT=

line. Then run:

sudo update-grub

Your system will then always boot to text mode.

If you want to boot to the GUI, just press e in the boot menu and remove text from the kernel line.

If you want to start the GUI after boot, just run:

sudo /etc/init.d/lightdm start

www.stackprinter.com/export?question=16371&service=askubuntu 2/11
3/19/22, 1:03 PM How do I disable X at boot time so that the system boots in text mode?

Hope this helps :)

ubuntu 11.10 doesn't use gdm as defult login manager - hhlp


also watch this -> askubuntu.com/questions/70188/how-do-i-boot-into-console-mod‌​e - hhlp
(2) @hhlp: Fixed. With the latest Lightdm update, the upstart job respects the text kernel cmdline. - Andrew Gunnerson
Is this valid for 12.04 ? - asheeshr
(1) @AshRj: Yes, it's valid for all versions of Ubuntu using upstart :) - Andrew Gunnerson
2

[+25]
[2010-12-06 02:48:45] karthick87

For 11.04 and previous versions (and perhaps later)


If you want to boot into text mode:

Edit /etc/default/grub. For example:

sudo gedit /etc/default/grub

Find this line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Add text:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash text"

Then update Grub:

sudo update-grub

Note:
Removing quiet splash (i.e. GRUB_CMDLINE_LINUX_DEFAULT="") will show text during boot but then show a
graphical login screen as usual. Replacing quiet splash with text will leave you at a login prompt; to start a GNOME
session, use sudo /etc/init.d/gdm start or startx.

To disable GDM:

Install bum
[1] Install bum
[2].

After installation it will be found under System>>Administration>>Bootup-Manager

www.stackprinter.com/export?question=16371&service=askubuntu 3/11
3/19/22, 1:03 PM How do I disable X at boot time so that the system boots in text mode?
Uncheck Gnome Display Manager

[1] http://packages.ubuntu.com/bum

[2] http://apt.ubuntu.com/p/bum

The GRUB config worked. Out of curiosity, why would I want to disable GDM? - Olivier Lalonde
(1) because doing so would accomplish the same thing. - RolandiXor
(1) Confirmed in 13.04 that GRUB_CMDLINE_LINUX_DEFAULT="" works to show details during boot while still launching graphical login. -
Jesse Glick
3

[+23]
[2011-11-16 03:02:32] achiang

If you are using lightdm as a login manager it can be prevented from loading by disabling it.

You can use an override:

sudo bash -c 'echo "manual" >> /etc/init/lightdm.override'

And to start lightdm on command:

sudo start lightdm

To restore your system so that lightdm is always started on boot:

sudo rm /etc/init/lightdm.override

For more information, the upstart cookbook is your friend:

http://upstart.ubuntu.com/cookbook/

www.stackprinter.com/export?question=16371&service=askubuntu 4/11
3/19/22, 1:03 PM How do I disable X at boot time so that the system boots in text mode?
(1) This does not work in Ubuntu 15.10. - mmdanziger
4

[+22]
[2010-12-06 02:58:27] RolandiXor

You could use Ubuntu Server edition


[1].

[1] http://www.ubuntu.com/server

[+12]
[2011-09-26 15:15:24] enzotib

It has already beed answered in several old questions, but cannot find them just now, so I sum up the various situations
here.

1. To stop an X server started by startx, simply terminate the session.

2. To stop an X server started by the Login Manager (GDM), run

sudo service gdm stop

then move to a tty, for example pressing Ctrl-Alt-F1, then login here in text mode.

3. To avoid at all the starting of the Login Manager (and X), modify

/etc/default/grub

changing the line

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to become

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash text"

then update the grub configuration file with

sudo update-grub

so that the next time you go directly to text mode, and you need startx to initiate a X session, or alternatively
sudo service gdm start.

[+8]
[2012-01-12 16:25:25] Vidyadhar

I did following

Step 1 First update your repository by running

sudo apt-get update

Step 2 There is some bug in old version of lightdm, so we need to upgrade the same. To do so run,

sudo apt-get install lightdm

Step 3 Now we have to modify grub config.


Step 3a Open /etc/default/grub with your favourite editor and change

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT="text"

Step 3b Also comment GRUB_HIDDEN_TIMEOUT=0 This line is for un-hiding the GRUB menu

www.stackprinter.com/export?question=16371&service=askubuntu 5/11
3/19/22, 1:03 PM How do I disable X at boot time so that the system boots in text mode?
Step 4 Now we will upgrade GRUB configuration

sudo update-grub

Step 5 Ubuntu 11.10 Desktop edition use lightdm for GUI. We need to disable the same

sudo update-rc.d -f lightdm remove

Step 6 Now restart your machine.

Found at Disable GUI Boot in Ubuntu 11.10


[1]

[1] http://www.techienote.com/2012/01/disable-gui-boot-in-ubuntu-11-10.html

[+6]
[2015-04-09 06:15:39] Sergiy Kolodyazhnyy

Yes, telling the system to start in console at boot time is possible through editing grub command. When you reach grub
menu, highlight Ubuntu's entry and press e.

You will see text such as in the image bellow:

Change the text quiet splash to text . Press F10 to launch.


(Source: rolling-ubuntu
[1]). I have tested this on my system,
14.04, booted into text console, no lightdm in sight. Started lightdm with sudo initctl start lightdm

To avoid doing so every time, you can add permanent grub entry with such option as suggested in this answer
[2]

An alternative suggestion, is to change default runlevel and change runlevels at which lightdm starts/stops, as suggested
by another answer
[3] on the same post

[1] http://rolling-ubuntu.blogspot.com/2012/06/ubuntu-1204-tip-booting-to-text-mode.html

[2] https://askubuntu.com/a/344490/295286

www.stackprinter.com/export?question=16371&service=askubuntu 6/11
3/19/22, 1:03 PM How do I disable X at boot time so that the system boots in text mode?

[3] https://askubuntu.com/a/228750/295286

Ubuntu 18.04 Live ISO still launches Xorg regardless of the text option. Instead, specifying the runlevel, simply 3 instead of text,
makes it work. Credit goes to this answer. - Ruslan
@Ruslan Useful info, thanks. My answer is actually for desktop specifically and was posted in 2015 while 14.04 release was current. -
Sergiy Kolodyazhnyy
I was testing this on the Live ISO of the desktop version of Ubuntu 18.04. Nothing requires server or other editions for this 3 option to
work (and for text to not work, which happened to me). - Ruslan
8

[+4]
[2013-10-06 17:49:17] B. Shea

I noticed this thread revolves around assuming you are using LightDM as the Display Manager. Though this may be the
usual DM/welcomer, that isn't part of the original question. (And he did not specify..)

In my case:

I use KDE/KDM on my server. Instead, I simply disable the upstart/service from starting under runlevel 2:

/etc/init/kdm.conf: (kdm: 4:4.8.5-0ubuntu0.3 , Upstart Version: 1.5-0ubuntu7.2)

Find:

start on ((filesystem

change

and runlevel [!06]

to

and runlevel [!026]

Assuming your default runlevel is 2 on fresh reboot, you will have a console and not KDM. Then you can run DM/DE
manually when needed = Use 'startx' /etc. To return machine to console and exit X server completely after this, just use
'log out'.

Other dm .confs scripts are similar.


(I setup my server like this.. to be able to work using a GUI occasionally - but, not
pull resources when not using/needed or simply rebooting.)

EDIT

(My current system: Upstart 1.12.1 / Ubuntu 14.04)

Due to upstart the way to resolve this lately is to simply disable your Display Manager from starting on boot:

echo "manual" | sudo tee -a /etc/init/{service}.override

For lightdm:

echo "manual" | sudo tee -a /etc/init/lightdm.override

This can be any service in /etc/init including kdm/gdm. 'startx' to run as needed following a reboot.

ref:

How to disable lightdm?


[1]

How to enable or disable services?


[2]

[1] https://askubuntu.com/questions/139014/how-to-disable-lightdm/139025#139025

[2] https://askubuntu.com/questions/19320/how-to-enable-or-disable-services

[+2]
[2012-01-12 16:30:17] Vidyadhar

I did following:

www.stackprinter.com/export?question=16371&service=askubuntu 7/11
3/19/22, 1:03 PM How do I disable X at boot time so that the system boots in text mode?

1. First update your repository by running

sudo apt-get update

2. There is some bug in old version of lightdm, so we need to upgrade


the same. To do so run,

sudo apt-get install lightdm

3. Now we have to modify grub config.

Open /etc/default/grub with your favorite editor and change

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to

GRUB_CMDLINE_LINUX_DEFAULT="text"

Also comment GRUB_HIDDEN_TIMEOUT=0 This line is for unhiding the GRUB menu

4. Now we will upgrade GRUB configuration

sudo update-grub

5. Now restart your machine.

According to lightdm.conf it is not necessary to remove lightdm. - Bruno Pereira


if you did not remove it you will get GUI after doing all this. - Vidyadhar
Sorry, just tested it in 11.10, this is not true, no need to remove lighdm, step 5 is not necessary. - Bruno Pereira
Ok I have removed the 5th step regarding lightdm - Vidyadhar
10

[+2]
[2013-11-07 19:09:41] precise

The steps are:


Customize the grub 2 configuration:

sudo nano /etc/default/grub, to open the file with root privilege,

Find the line

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”

and change it to

GRUB_CMDLINE_LINUX_DEFAULT=”text”

Save the changes (hit ctrl + o followed by ENTER) and close the file (ctrl + x).

To apply the new configuration do this

sudo update-grub

Now restart your PC

sudo reboot

There you are... A text-graphic login screen... Supply your credentials to log-in to the tty (default tty1). You can change
the tty's with crtl + alt + [F1 to F6] for tty1 to tty6. You may also start the X session (X11 session), the graphical user
interface, with sudo start lightdm (ctrl + alt + F7).

PS: In case you want to revert the changes you've made here follow the link:

www.stackprinter.com/export?question=16371&service=askubuntu 8/11
3/19/22, 1:03 PM How do I disable X at boot time so that the system boots in text mode?

How to revert back to GUI as the default interface from CLI in Ubuntu desktop?
[1]

[1] https://askubuntu.com/questions/372019/how-do-i-restore-logging-in-with-an-x-session-graphics-instaed-of-text-
only-sess

11

[+2]
[2015-04-09 17:41:18] javajazz

If using Lubuntu 15.05 with systemd managing boot processes it is possible to boot to the console and then later from the
console start the graphical environment. Follow these steps:

1. follow the previously mentioned edits to grub per Bruno:

Edit /etc/default/grub with your favorite editor, eg: nano:

sudo nano /etc/default/grub

Find out this line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Change it to:

GRUB_CMDLINE_LINUX_DEFAULT="text"

Update Grub:

sudo update-grub

2. Bruno suggested sudo systemctl enable multi-user.target --force. The use of force bothered me so I
preferred sudo systemctl set-default multi-user.target.
open a terminal and do sudo systemctl set-
default multi-user.target

3. reboot will take you into console asking for password

4. when desiring to enter graphical environment enter sudo systemctl start lightdm. You will be taken to the
lightdm login window.

5. use ctrl alt F1 key combo to get back to console you were at to exit out if so desired. (I exit out of the console mode
as I am usually done there till next boot) ctrl alt F7 to get back to lightdm login. or ctrl alt F1 through F7 per need
or desire.

12

[+2]
[2016-11-02 15:49:24] PrgWiz

You may also want to prevent the kernel from changing video modes which can be problematic, especially if you cannot
see the login prompt or it is partially off the screen. Add the setting GRUB_CMDLINE_LINUX_DEFAULT="nomodeset" to
/etc/default/grub:

#GRUB_DEFAULT=0

#GRUB_HIDDEN_TIMEOUT=0

#GRUB_HIDDEN_TIMEOUT_QUIET=true

#GRUB_TIMEOUT=5

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

#for text mode boot up... and also uncomment the "console" terminal

GRUB_CMDLINE_LINUX_DEFAULT="nomodeset"

#GRUB_CMDLINE_LINUX="text"

GRUB_TERMINAL=console

And then run the command

sudo update-grub

Tested with Ubuntu Server 16.04.1

www.stackprinter.com/export?question=16371&service=askubuntu 9/11
3/19/22, 1:03 PM How do I disable X at boot time so that the system boots in text mode?
13

[+1]
[2011-11-14 14:34:32] RolandiXor

When you install Ubuntu-desktop, it will automatically set lightdm to start with the system. You will have to disable this
(probably by editing /etc/rc.local) and use startx to run the graphical interface when you need it.

14

[+1]
[2019-09-01 18:22:53] xerostomus

Just a report on Lubuntu 18.04.3 LTS.

sudo nano /etc/default/grub

Then change the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to GRUB_CMDLINE_LINUX_DEFAULT="text"


and run

sudo update-grub

This correctly sets up text mode of booting. Very useful, I can track and spot problems without going into log files.

systemctl get-default

This outputs graphical.target and please note it for future restoring original state.

sudo systemctl set-default multi-user.target

This switched off GUI of XWindows (lightdm and startx, openbox, etc.), but I had to type 3 times my login/password to
boot into Xwindows:

A) login

B) sudo lightdm # starts xwindows with my default setting (which is good)

C) regular GUI login dialog of Lubuntu.

Three logins are annoying, but it works OK otherwise.

Restore original setting:

sudo systemctl set-default graphical.target

Hopefully this will be useful to someone. :-)

15

[0]
[2021-05-12 22:33:42] mchid

This is a slightly different method to set autologin for lightdm so you don't have to enter a password to log into the
graphical session. However, it should be noted that google chrome will ask for your password only once, the first time
after you login, to unlock your keyring.

First, edit /etc/default/grub and change:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to this:

GRUB_CMDLINE_LINUX_DEFAULT="text"

Save the file when you are finished and then run the following command to update grub:

sudo update-grub

www.stackprinter.com/export?question=16371&service=askubuntu 10/11
3/19/22, 1:03 PM How do I disable X at boot time so that the system boots in text mode?

Next, install lightdm and libpam-gnome-keyring so you only have to enter the password the first time you start google
chrome after you login:

sudo apt update

sudo apt install lightdm libpam-gnome-keyring

Then, run the following command to set autologin for your current user on lightdm:

printf "[SeatDefaults]\nautologin-user=$USER\n" | sudo tee -a /etc/lightdm/lightdm.conf

Save any unsaved work and reboot.

Finally, when you want to start a graphical session, run the following command to start lightdm:

sudo systemctl start lightdm

16

[-2]
[2015-04-08 17:26:55] Mudit Kapil

For Ubuntu 14.04 Trusty Tahr and Ubuntu 12.04 Precise Pangolin, systemd has been added to a third party PPA, so
testing it on the latest Ubuntu LTS systems is easy. All you have to do is add the ppa to your system

sudo add-apt-repository ppa:pitti/systemd

sudo apt-get update

sudo apt-get dist-upgrade

Now Open the /etc/default/grub file by using any of the text editor (I used gedit here) with sudo privilege via
Terminal to edit like follow:

sudo -H gedit /etc/default/grub

change the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to GRUB_CMDLINE_LINUX_DEFAULT =


"init=/lib/systemd/systemd"

save the file and update the Grub:

sudo update-grub

Then restart now the system will boot in to text console tty1.

To Login in to GUI again run

sudo start lightdm

Note: Do not use startx or Ctrl+Alt+F7 For Ubuntu 15.04 that uses systemd use sudo service lightdm start

How does it link to the question? - rancho


17

www.stackprinter.com/export?question=16371&service=askubuntu 11/11

You might also like