Start X at login

From ArchWiki
Revision as of 17:55, 30 March 2011 by Wooptoo (talk | contribs) (vt7)
Jump to navigation Jump to search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end

Typically, Template:Filename or Template:Filename are used to manually start X. Both will execute Template:Filename, which may be customized to start the window manager of choice as described in the xinitrc article.

The majority of users wishing to start an X server during the boot process will want to install a Display Manager instead.

By using the #~/.bash_profile method, X will be started once logged in from a tty. The #/etc/inittab way allows automatically starting X without supplying a password.


Note: This method can be combined with automatic login to virtual console and act similar to the inittab method, but it will properly register your session and work with ConsoleKit.

An alternative to a login manager is to add the following to the bottom of your Template:Filename (if Template:Filename does not yet exist, you can copy a skeleton version from Template:Filename):


or with additional checking (if tty1 (ctrl-alt-F1) shows an error message):


The user will be logged out when X is killed. In order to avoid this, remove the Template:Codeline part from the script.


Warning: This method will not use /bin/login or register your session, therefore no session will appear in `who` or `w`. Your session will also not be authorized as 'local' by consolekit, so you will be unable to shutdown/suspend/reboot or mount drives without using sudo or su.

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



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




x:5:once:/bin/su - -- PREFERRED_USER -l -c '/usr/bin/startx </dev/null'

The - option invokes a "login shell" by prepending a dash (-) to its name. Because a command is specified with the -c option, the shell is also run in "non-interactive mode". Bash does not do the normal login process in non-interactive login mode unless it is forced with the -l option. The -- option ensures that the -l and -c options are passed to the shell rather than used by su itself. These workarounds are needed for the combination of Gnu su and Bash; see "su 5.2.1 does not invoke bash as a login shell".

The field populated with Template:Codeline may be changed to Template:Codeline in order to continously restart X if it exits.

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

startx -- -nolisten tcp -br -deferglyphs 16

Also you can do this for multiple users using different runlevels,

x1:4:once:/bin/su - -- PREFERRED_USER1 -l -c '/usr/bin/startx </dev/null'
x2:5:once:/bin/su - -- PREFERRED_USER2 -l -c '/usr/bin/startx </dev/null'

and inserting a new entries in GRUB menu.lst

# (0) Arch Linux
title  Arch Linux USER1
root   (hd0,0)
kernel /vmlinuz26 root=/dev/disk/by-label/Arch ro 4
initrd /kernel26.img

# (1) Arch Linux
title  Arch Linux USER2
root   (hd0,0)
kernel /vmlinuz26 root=/dev/disk/by-label/Arch ro 5
initrd /kernel26.img

Note: if you have problems with writing non-ASCII letters terminals in that new X, remove the -l switch (see here).