unoverse

Posted:

Autologin on Void Linux

A display manager is what displays the login screen you’re coming to after boot to login to the desktop. I don’t have a display manager installed so instead of that login screen I have to login through the TTY which also means that it is the TTY that is showing instead of my desktop.

What to do?

All my machines are always encrypted and I’m the only user on them, so for me it’s just redundant to have to login to the user each time since the encryption needs a password to decrypt. Instead of having to login twice I just enable autologin for my user.

Void Linux uses the runit init system and to enable autologin we need to change the tty service file.

Open /etc/sv/agetty-tty1/conf and add the -a flag and your username after any other arguments in the GETTY_ARGS variable

doas vim /etc/sv/agetty-tty1/conf
GETTY_ARGS="--noclear -a <username>"

Now we will always be logged in automatically when we start up the machine.

x

We still got one problem though, x is not starting automatically, so even if we’re logged in, we’re still in the TTY, and I would prefer if my system could startx for me, so we have to put the following in to .bashrc

if [ -z "$DISPLAY" ] && [ "$(fgconsole)" -eq 1 ]; then
	exec startx
fi

When this is done, we’ll be logged in automatically and the system will start x for us.