How to autostart X at login without SDDM (boot to your DE/WM without login)

16 December 2017, 07:30:25

I stuck this in the thread that is asking for suggestions for the FAQ. On second thoughts it is likely better off out here with its own title as it will make it easier for someone to find if they are looking for a how-to on this topic (autologin without a display manager - some of us operate our systems in "secure" environments, & also don't like to use DM's for whatever reason ).

I'm sure that someone can come up with alternative ways, perhaps there is a more correct way? I don't know?

I didn't create the following, I searched it out on the web, & it works perfectly for me (I'm using Openbox), & it was really quite quick & easy to do.

So here you go:

To start X automatically:

Make your /etc/conf.d/agetty.tty1 the same as the following:

# Set the baud rate of the terminal linebaud="38400"

# set the terminal typeterm_type="linux"

# extra options to pass to agetty for this portagetty_options="--autologin guest"

# make agetty quiet#quiet="no"

Be sure replace guest in the above code, to the user name that you desire to autologin.

Apart from the above, you will just need to use pacman to delete sddm, 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).

Thus far, once, I've had an update that overwrote the /etc/conf.d/agetty.tty1 which of course meant that I had to login manually again.

All that was required (in my case) was changing the following line:

agetty_options=""

Back to:

agetty_options="--autologin handy"

So you just have to add --autologin <your.user.name> between the double quotes & your good to go.

You could stop this from happening in future by using one of the two following methods. I used this first one today, but after @thefallenrat posted a link below, I am now using the 2nd method shown here, as it is more elegant:

Method 1. Making the agetty.tty1 file immutable like so:

$ sudo chattr +i /etc/conf.d/agetty.tty1

If you need to make the file changeable again then do this:

$ sudo chattr -i /etc/conf.d/agetty.tty1

If you want to list the file attributes of a file that is using the second extended file system (which is what the chattr command is using), you use the following command like so:

$ lsattr /etc/conf.d/agetty.tty1

Which will give a result like so:

----i---------e---- /etc/conf.d/agetty.tty1

Method 2. (quoted from the Arch Wiki)

Quote

To prevent any package from overwriting a certain file, add the following line to /etc/pacman.conf:

NoUpgrade = absolute/path/to/file

Note that the path must not start with a slash.

Which means that I've uncommented the # NoUpgrade = line in my /etc/pacman.conf & it now looks like this: