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.


Solution 1:

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.

Solution 2:

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

Hope this helps :)

Solution 3:

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 Install bum.

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

Uncheck Gnome Display Manager alt text

Solution 4:

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/

Solution 5:

You could use Ubuntu Server edition.