Ubuntu 16.04: Usage of startx

When using Desktop Linux distribution, startx is not used. But startx provides running X application directly without lightdm. startx is useful for dwm which is light weight desktop environment. This article will describe usage of startx.

1 Stop lightdm

Stopping lightdm is needed for creating xorg.conf and running startx.

$ sudo systemctl stop lightdm
$ sudo systemctl disable lightdm

2 Create xorg.conf

Create xorg.conf with "Xorg -configure".

$ Xorg -configure
$ sudo cp xorg.conf.new /etc/X11/xorg.conf

3 Add SUID to /usr/lib/xorg/Xorg

Running startx will cause the following error.

(EE) parse_vt_settings: Cannot open /dev/tty0 (No such file or directory)

For avoiding this error, add SUID to /usr/lib/xorg/Xorg.

$ sudo chmod u+s /usr/lib/xorg/Xorg

4 Running startx

This article will use xeyes as X application. Write xeyes to .xsession and run startx on tty1.

$ echo xeyes > ~/.xsession
$ startx


xeyes is running. For stopping xeyes, run "killall -KILL xeyes" on tty2.