I am running Ubuntu Server, and just installed the gnome desktop on there (I neeeded to run an application that would only work in a graphical interface). However, now the server boots to the GUI every time. I need the server to boot to the command line (runlevel 3). According to several articles that I've read, Ubuntu does not use the standard runlevels. What file do I need to modify in order to boot to runlevel 3 (or whatever the Ubuntu equivalent is)?


6 Answers 6


Theoretically, if Ubuntu were compliant with UNIX and Linux standard, adding '3' to grub's 'kernel' command in /boot/grub/menu.lst should have been sufficient, because runlevel '3' means no 'X11' according to this standard.

Unfortunately, Ubuntu has ignored the standard and that's why you'll need to change /etc/init/lightdm.conf or /etc/init/gdm.conf (or whatever DM you use) as well. This is how mine "on start" condition looks like:

start on ((filesystem
       and runlevel [!06]
       and runlevel [!03]
       and started dbus
       and plymouth-ready)
      or runlevel PREVLEVEL=S)

In Grub's menu.lst I've also added a menu item that allows me to boot to runlevel 3:

title           Ubuntu 11.10 Server No UI, kernel 3.0.0-32-generic-pae
root            (hd0,0)
kernel          /vmlinuz-3.0.0-32-generic-pae root=UUID=your-root-disk-id 3 ro
initrd          /initrd.img-3.0.0-32-generic-pae

title           Ubuntu 11.10, kernel 3.0.0-32-generic-pae
root            (hd0,0)
kernel          /vmlinuz-3.0.0-32-generic-pae root=your-root-disk-id ro
initrd          /initrd.img-3.0.0-32-generic-pae

Now I can chose between booting to runlevel 5 with X11 or to runlevel 3 without it.

  • How can you do this with grub2. Grub does not have menu.lst anymore. Commented Mar 22, 2017 at 18:43
  • Didn't do it for Grub2, but I'm sure it can be done. Menu is generated automatically in Grub2 and you would need to provide params in the sources that are used to generate it. Sorry, I don't have details, but am sure this community can provide them
    – Oleg Gryb
    Commented Mar 23, 2017 at 19:25

I think there is a good answer at How do I disable X at boot time so that the system boots in text mode?

Just to answer your question on how to change run level. Edit the file /etc/init/rc-sysinit.conf and change this line.


But changing runlevel won't stop X. Look at the start condition for ligthdm:

start on ((filesystem
       and runlevel [!06]
       and started dbus
       and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
            or stopped udev-fallback-graphics))
      or runlevel PREVLEVEL=S)

You need change the start condition in the /etc/init/XXX file to something than isn't met, e. g. a higher run level than you use. XXX is the display manager you use, e. g. lightdm.conf, gdm.conf, failsafe-x.conf.


Here is deep instrtuction for runlevels - http://sysadmin.te.ua/linux/linux-boot.html

  • 2
    Whilst this link may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Link only answers can become invalid if the linked page changes or is unavailable.
    – kiri
    Commented Jan 28, 2014 at 7:52
  • A post in russian.. very descriptive indeed.. Commented Oct 19, 2014 at 21:55

The following is for Ubuntu Server 12 LTS

First you need open a real term with CTRL+ALT F1 and login.

Stop gdm with.

$ sudo service gdm stop

Remove gdm you dont need it at all on a server.

$ sudo apt-get remove gdm

Set next boot runlevel with.

$ sudo telinit 3

Without gdm you will need to install xinit if you want to still be able to run gui based apps without the gdm window manager.

$ sudo apt-get install xinit

Reboot to runlevel 3.

$ sudo reboot

To run a GUI or desktop after reboot do.

$ startx

This will start your gnome session as normal.

When finished simply logout of your desktop to and drop you back to a level 3 term

Also you can now start individual apps without a desktop too like.

$ startx nautilus

or privileged with

$ startx sudo synaptic

it's quite simple, (I'm using 15.10 so depending on your release you might need to turn off gdm instead of lightdm)

  1. turn off the your display manager for the desired runlevel (for me 3)

    sudo update-rc.d lightdm stop 3
  2. tell grub to boot runlevel 3 by default

    sudo vim /etc/defaults/grub

    and change



  3. update your grub config

    sudo update-grub
  4. reboot the box or run

    sudo service lightdm stop
  • hello. I just lost my installation of ten years so i'm more critical to my actions. So, at least in step one you do not give a way to reverse that command to bring my ubuntu back to sanity
    – nyxee
    Commented Aug 19, 2017 at 2:39

I was trying to install NVIDIA graphic card driver and CUDA toolkit, and the installation guide says "Reboot into text mode (runlevel 3)". After searching around, I discovered that runlevel 3 is not necessary, as long as it is text mode and GUI is not running. For this purpose, the following link solved my problem:


You must log in to answer this question.

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