Start X at Boot

From ArchWiki

(Redirected from Start X at boot)
Jump to: navigation, search
Summary
Covers the various methods one can use to start an X server during the boot process.
Related articles
Automatic login to virtual console
Display Manager
Xinitrc

The majority of users wishing to start an X server during the boot process will want to install a display manager, and see Display Manager for details.

This article will outline methods that do not involve a login manager.

~/.bash_profile

An alternative to a login manager is to add the following to the bottom of your ~/.bash_profile (if ~/.bash_profile does not yet exist, you can copy a skeleton version from /etc/skel/.bash_profile):

File: ~/.bash_profile
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
  startx
  logout
fi

or

File: ~/.bash_profile
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
  xinit
  logout
fi

Utilizing this method, X is automatically started when logging into the shell. Furthermore, the user will be logged out when X is killed using Ctrl+Alt+Backspace. If you are using the mingetty technique to automatically login to the console, remove the "logout" command from the above file example when implementing.

See also: http://bbs.archlinux.org/viewtopic.php?id=6182

/etc/inittab

Another way of circumventing display managers and booting straight into a preferred window manager or desktop environment involves editing /etc/inittab, changing:

id:3:initdefault:

[...]

x:5:respawn:/usr/bin/xdm -nodaemon

to:

id:5:initdefault:

[...]

x:5:once:/bin/su PREFERED_USER -l -c "/bin/bash --login -c /usr/bin/startx >/dev/null 2>&1"

changing PREFERED_USER as necessary.

Additionally, startx may be changed to any desired command or script. For example:

startx -- -nolisten tcp -br -deferglyphs 16

Note that startx will execute ~/.xinitrc, and may be customized to start the window manager of choice as described in the xinitrc article.

Personal tools