Login and start X automatically on Void Linux
#void linux #linux #xorg
I always encrypt all my machines with LUKS and I’m the only user on these machines. This makes the step involving me to login to my user each and every time I boot my computer up totally unnecessary and a waste of time. That extra login step provides no security at all.
Another thing that we are going to fix here is to automatically start X when we’re logging in to our user.
Auto login
There is a simpel fix to this. We need to make a change in the file which controls the startup of TTY1. To be on the safe side, we can create a copy of the file.
cp /etc/sv/agetty-tty1/conf /etc/sv/agetty-tty1/conf.bak
vim /etc/sv/agetty-tty1/conf
In there we can see an if statement and in there we find a variable called GETTY_ARGS that we need to add an option called --autologin followed by our user name.
if [ -x /sbin/agetty -o -x /bin/agetty ]; then
# util-linux specific settings
if [ "${tty}" = "tty1" ]; then
GETTY_ARGS="--noclear --autologin oux"
fi
fi
Start x
To skip the need to type startx everytime the computer starts is a nice thing to have as well.
This time we need to add these lines below to our ~/.xinit file:
if [ -z "$DISPLAY" ] && [ "$(fgconsole)" -eq 1 ]; then
exec startx
fi