Starting Ubuntu without the GUI

21

9

I want to boot a "Ubuntu 10.04.2 LTS" server, but I want XFCE not to be started, nor X at all, only Shell.

How do I tell my server to boot to the shell, not running XFCE at all?

I have an SSH connection to the server, but no display connected.

Since I migrated from earlier versions I use GRUB 1, where no /etc/default/grub exists.

I would like to set the target runlevel somewhere, without changing GRUB at all.

Hartmut P.

Posted 2011-07-14T18:17:35.397

Reputation: 332

When you ssh into the machine, don',t put the "X" flag. example "ssh username@localhost.edu" – None – 2011-07-14T18:33:04.487

In the meantime I found "sudo service gdm stop" and "sudo service gdm start" which goes to the right direction. But "gdm stop" should be the default. Or I install Ubuntu server. But then I cant change any more. A link was: http://ubuntuforums.org/showthread.php?t=1305659

– None – 2011-07-14T18:59:42.320

Answers

18

I see three ways to do it:

1. Changing the default runlevel

You can set it at the beginnign of /etc/init/rc-sysinit.conf replace 2 by 3 and reboot. You can enable the graphical interface with telinit 2.(More about runlevels)

2. Do not launch the graphical interface service on boot

update-rc.d -f xdm remove

Quick and easy. You can re-enable the graphical interface with service xdm start or revert your changes with update-rc.d -f xdm defaults

3. Remove packages

apt-get remove --purge x11-common && apt-get autoremove

I think it suits best for a computer considered as a server. You can re-enable the graphical interface by reinstalling the packages.

SamK

Posted 2011-07-14T18:17:35.397

Reputation: 508

1Thank you for your answer very much. Changing the default runlevel: I edited /etc/init/rc-sysinit.conf and have set the default runlevel to 3 (instead of 2). But Ubuntu 10.04.2 LTS seems to ignore this. – Hartmut P. – 2011-07-18T21:54:31.310

Have you looked if /etc/inittab exists on your system? – SamK – 2011-07-19T15:17:33.133

No that etc/inittab is missing on Ubuntu – Hartmut P. – 2011-07-19T19:51:21.110

what does the runlevelcommand say? – SamK – 2011-07-20T12:09:39.110

If the file /etc/rc3.d/S??xdm exists, then remove it. – SamK – 2011-07-20T12:21:39.447

runlevel says "N 2" and an /etc/rc3.d/S??xdm alike file does not exist. – Hartmut P. – 2011-07-25T22:31:56.193

Are your sure the /etc/init/rc-sysinit.conf is edited correctly? You should have the line env DEFAULT_RUNLEVEL=3 (with 3 instead of 2). – SamK – 2011-07-26T15:26:11.527

11

I got a simple method to disable XFCE from this blog post: How to disable X at boot time in Ubuntu 11.10.  Note: the post has a heading in some non-English language, possibly Portuguese, but the body of the post is in English.

With LightDM (lightdm) being the new graphical user login in Ubuntu, users will need to find a way to disable it to boot into text mode.  Fortunately, the people behind LightDM have made that really easy to do.

Edit /etc/default/grub with your favorite editor,

sudo nano /etc/default/grub

Find this line:

GRUB_CMDLINE_LINUX_DEFAULT="<doesn’t matter what you find here>"

Change it to:

GRUB_CMDLINE_LINUX_DEFAULT="text"

Update Grub:

sudo update-grub

No need to remove / disable LightDM upstart conf; it already does that for you.

lightdm.conf

# Check kernel command-line for inhibitors, unless we are being called manually.
for ARG in $(cat /proc/cmdline); do
        if [ "$ARG" = "text" ]; then
                plymouth quit || :
                stop
                exit 0
        fi
done

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

noname

Posted 2011-07-14T18:17:35.397

Reputation: 111

In ubuntu 16.04 you have to disable lightdm manually. see: http://askubuntu.com/a/694718/299538

– J.Serra – 2016-12-23T15:49:01.910

In ubuntu 16.04, use GRUB_CMDLINE_LINUX_DEFAULT="3". See https://superuser.com/a/1139020/391956

– John McGehee – 2018-07-17T18:17:24.610