Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I would like to start Debian without the GUI and then just type commands in to launch the desired programs (which are located on my local machine), eg

$ chromium-browser &

I already do a similar thing when sshing in to other machines on the LAN - it is handy if I need to visualise csv data for example in soffice. i currently have gnome desktop and Debian 7 installed.

I have found some instructions for disabling the GUI on startup with Debian, however I am reluctant to try them out for fear of being locked out of using the web browser once I do this (I will need it to seek help using the browser if I get stuck).

I was wondering if I could temporarily test out the method of starting the GUI on one of the other terminals (eg ctrl+alt+f1) to see if there are any problems? Will this work? Will it be equivalent to starting the GUI when booting without a GUI?

If this is feasible, please could someone provide full instructions for:

  • enabling the GUI on terminal f1 so that i can run gui programs (without showing the full desktop interface)
  • turning off the desktop interface GUI on bootup

obviously I will need to run X11 to load GUI programs - that's fine, but I'm looking to boot up into text mode and then just execute GUI programs as needed.

doing some tests on an ubuntu 12.04 virtualbox vm (hopefully not too different to debian 7?)...

$ ps aux | grep gdm
# *blank*
$ ps aux | grep kdm
# *blank*
$ ps aux | grep lightdm
root      1225  0.0  0.0 270664  3500 ?        Ssl  12:43   0:00 lightdm
root      1234  1.9  2.2 236564 112276 tty7    Ss+  12:43   0:01 /usr/bin/X :0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch -background none
root      1382  0.0  0.0 156772  3572 ?        Sl   12:43   0:00 lightdm --session-child 12 19
$ sudo update-rc.d lightdm disable
update-rc.d: warning: /etc/init.d/lightdm missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
 Disabling system startup links for /etc/init.d/lightdm ...
 Removing any system startup links for /etc/init.d/lightdm ...
   /etc/rc0.d/K20lightdm
   /etc/rc1.d/K20lightdm
   /etc/rc2.d/K80lightdm
   /etc/rc3.d/K80lightdm
   /etc/rc4.d/K80lightdm
   /etc/rc5.d/K80lightdm
   /etc/rc6.d/K20lightdm
 Adding system startup for /etc/init.d/lightdm ...
   /etc/rc0.d/K20lightdm -> ../init.d/lightdm
   /etc/rc1.d/K20lightdm -> ../init.d/lightdm
   /etc/rc6.d/K20lightdm -> ../init.d/lightdm
   /etc/rc2.d/K80lightdm -> ../init.d/lightdm
   /etc/rc3.d/K80lightdm -> ../init.d/lightdm
   /etc/rc4.d/K80lightdm -> ../init.d/lightdm
   /etc/rc5.d/K80lightdm -> ../init.d/lightdm
$ sudo shutdown -r 0

and the gui is back up and running again after the reboot! so this clearly did not have the desird effect. however:

$ sudo /etc/init.d/lightdm stop

kills the gui. moving to tty2 (by pressing ctrl+alt+f2) and attempting to open firefox:

$ firefox &
Error: no display specified

so attempting to specify a display:

$ export DISPLAY='0.0'
$ firefox &
Error: cannot open display: 0.0

and now i'm stuck. i can still get the gui back on ctrl+alt+f7 by entering the following into tty2:

$ sudo /etc/init.d/lightdm start

but this is not what i want. i just want to be able to run firefox without showing all the other desktop things such as the clock and the menu bars, etc.

trying out some of the things in goldilocks' answer

$ sudo /etc/init.d/lightdm stop
$ echo "#!/bin/bash" > ~/.xinitrc
$ echo "exec firefox" >> ~/.xinitrc
$ xinit

this does exactly what i want :)

share|improve this question
    
When you SSH into another machine and launch an X client process on that machine, you probably have SSH X11 forwarding turned on so it uses the X server on your local machine to display what is running on the remote machine. You can easily keep X11 from starting on boot (I think you'd just remove 'gdm' from boot startup) and do startx after logging in, but you still need X running to be able to do anything useful with programs relying on an X display being available. This may or may not be what you want so please clarify. Maybe simply switching to a lightweight WM will do what you want? –  Michael Kjörling Sep 25 '13 at 13:49
    
yeah i do use x11 forwarding over ssh. i'm fine with the method of running x locally. i'd rather not install new wm unless its absolutely necessary for this. my thinking was that i would be able to alter some config settings but not have to install anything new as i already have the gnome desktop gui running. –  mulllhausen Sep 25 '13 at 14:02
    
As Michael K. pointed out, you cannot run X programs without an X server. Instead, I suggest you to work with an terminal emulator in Gnome (or in any other window manager you prefer) and avoid the dumb terminals. –  jofel Sep 25 '13 at 14:05
    
To (temporary) switch off the X server, run service gdm3 stop as root. A normal user can start X with "startx". –  jofel Sep 25 '13 at 14:13
    
if i do that then i'm guessing i will not be able to run a web browser to seek help if i get stuck? at least not without restarting? –  mulllhausen Sep 25 '13 at 14:16

2 Answers 2

up vote 4 down vote accepted

The instructions to disable xdm/kdm/gdm/whichever-dm-you-have is correct. If you don't do this, you boot to a graphical login (that's the dm = display manager), and then whenever you quit X (which should be as easy as ctrl-alt-backspace -- try it, but close your apps first), the DM will respawn another graphical login, making it impossible to escape the GUI.

Another possibility with debian is to check in /etc/rc[N].d for a runlevel which does not start the dm, and make that the initdefault in /etc/inittab. I don't have an unmodified debian system at hand, so I can't say which if any that will be -- possibly 2. Do not choose 0, 1, or 6.

Once the dm is disabled, you boot to a login console. From there you can start X with the command startx. This includes a default DE and if you've been using gnome that will probably be it. You can also create an ~/.xinitrc, which is a shell script which will be run in place of the default. Generally they can be pretty minimal, eg:

#!/bin/sh

exec gnome-session

Should start gnome (I believe -- I don't have a gnome system at hand either).

Note that you can't run a GUI application without X; it's not clear from your post you understand that. GUI programs are actually clients that need the Xorg server to work. You can start a bare X with no DE or WM and a specific application by replacing the exec gnome-session line with the name of the application, but beware you'll then have no way to start anything else and when you close that application, you'll be looking at a blank screen with a cursor floating in it.

There's nothing dangerous in all this and it is easy to re-enable the DM if you want.

share|improve this answer

for turn off gui at startup:

update-rc.d gdm3 disable # if you using gdm3
update-rc.d kdm disable  #if you using kdm

However, if you have both, please run both commands.

For disabling graphical mode at startup in ubuntu OS:

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

Because ubuntu uses Upsatrt and invoked lightdm as a upstart service.

In UNIX world graphical environment have 3 layers:

  1. X #support keyboard , mouse and some of driver
  2. Window Manager # handle decorator, win title, and so on
  3. Display Manager # create communication between windows.

When you run gdm3 or kdm , you caused to run 3layers.

If you want to run a graphical program on network, You just need layer 1: X. you should set :

export DISPLAY=YOUR_DEST_IP:0.0

Then run your program.

share|improve this answer
    
all good advice, thanks. do you know if it is possible to run a gui on the f1 terminal? –  mulllhausen Sep 25 '13 at 14:04
    
if your means is CTRL+ALT+FNUM, It is related to ttyNumber such as tty1, tty2 , ttyN, It doesn't work under network.If you want to use graphical mode localy, you should have 3 layers,So forget ...! –  Mohsen Pahlevanzadeh Sep 25 '13 at 14:24
    
i tried update-rc.d gdm3 disable but everything still looks normal when i reboot - gui is still visible, etc –  mulllhausen Sep 26 '13 at 2:29
    
Did you try with kdm? What's your graphical display manager? gdm? kdm? or etc? –  Mohsen Pahlevanzadeh Sep 26 '13 at 2:54
    
i'm trying it out at work on a virtualbox vm at the moment running ubuntu 12.04, but my aim is to get it working on debian 7 at home. ps aux | grep lightdm had results, but not gdm or kdm –  mulllhausen Sep 26 '13 at 3:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.