Autostart X at Login - OpenRC & SystemD

From Manjaro Linux
Jump to: navigation, search

Auto-Login with either systemd or OpenRC

I've dramatically updated this page, as the info' on how to autostart X at login for those using systemd was badly out of date (it still worked, but thankfully, there are easier ways to do it now). I've removed the systemd information & incorporated a link to the appropriate ArchWiki page.

I've also added a section on how to setup OpenRC to autostart X at login. Both the OpenRC & the systemd method shown on the ArchWiki should work with either WMs or DEs.

How to Auto-Login on an OpenRC system

To start X automatically:

Enable autologin to a tty through /etc/openrc/inittab with the following (swap out <username> for your username - without the angle brackets of course):

c6:2345:respawn:/usr/bin/agetty -a <username> -8 -s 38400 tty6 linux

Put the following in ~/.bash_profile :

[[ -f ~/.bashrc ]] && . ~/.bashrc
 # start x on login
 if [[ -z $DISPLAY && ! -e /tmp/.X11-unix/X0 ]]; then
    exec xinit -- /usr/bin/X -nolisten tcp vt7

When editing /etc/openrc/inittab , remember that the line of code (found above) which starts with these characters c6:2345: already exists in /etc/openrc/inittab , so find it, (use those characters to do it) & edit that line only, making it the same as the one quoted above except with your username replacing <username>.

Apart from the above, you will just need to use pacman to delete lightdm or whichever other DM you have installed. After you have done that, the above changes should allow you to boot straight into your WM or DE without any user input (no logging in with user names & passwords).

Note: the above code & information came from the excellent notfoss blog: [1]

Autostart X at login on a systemd system

Before trying to automatically start .xinitrc file, make sure to have a Proper ~/.xinitrc File.

The most up to date instructions for those systems that use the ever developing systemd can be found here on the ArchWiki: [2]

Other Options that may be very useful

I've not used these methods posted in the forum by Chrysostomus, but I've put a copy of his post here for those that are interested:

Other options for systemd:

- xlogin

Other options for systemd and openrc:


Both of these should be faster methods, because they go directly to X without going through Getty. I haven't tested nodm, but at least xlogin is visibly faster. Bspwm edition does not have display manager, so it comes with option to enable auto login with xlogin. I'm considering moving to nodm though, because it hopefully would not depend on systemd.


Following is a link to this page's forum counterpart where you can post any related feedback: [3]