Start X at login
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.
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. If you use zsh as your preferred shell, add the following lines to your Template:Filename instead.):
Or with a prompt:
The user will be logged out when X is killed. In order to avoid this, remove the Template:Codeline part from the script.
Another way of circumventing display managers and booting straight into a preferred window manager or desktop environment involves editing Template:Filename, changing:
id:3:initdefault: [...] x:5:respawn:/usr/bin/xdm -nodaemon
id:5:initdefault: [...] x:5:once:/bin/su - -- PREFERRED_USER -l -c '/usr/bin/startx </dev/null >/dev/null 2>&1'
The Template:Codeline option invokes a "login shell" by prepending a dash (-) to its name. Because a command is specified with the Template:Codeline 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 Template:Codeline option. The Template:Codeline option ensures that the Template:Codeline and Template:Codeline 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 standard input must be redirected (Template:Codeline) if Getty or some other program is still used on the console, otherwise there will be a conflict between multiple programs stealing console input from each other.
The output can also be redirected (Template:Codeline) to avoid outputting messages from X to the console.
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 >/dev/null 2>&1' x2:5:once:/bin/su - -- PREFERRED_USER2 -l -c '/usr/bin/startx </dev/null >/dev/null 2>&1'
and inserting a new entry in GRUB's Template:Filename:
# (0) Arch Linux title Arch Linux USER1 root (hd0,0) kernel /vmlinuz-linux root=/dev/disk/by-label/Arch ro 4 initrd /initramfs-linux.img # (1) Arch Linux title Arch Linux USER2 root (hd0,0) kernel /vmlinuz-linux root=/dev/disk/by-label/Arch ro 5 initrd /initramfs-linux.img