Home
Lauren Toivanen
2026-14-09

Automagic TTY1 login and startx on Linux

No display manager. Systemd assumed. Useful for yor specialty one-webpage machines and personal desktops. While testing it's useful to use TTY2 so you have access to the machine if something goes horribly wrong and you might find it useful to do sudo systemctl daemon-reload; sudo systemctl restart getty@tty1.service while testing.

Autologin TTY1

Create /etc/systemd/system/getty@tty1.service.d/autologin.conf and corresponding directory. Most aren't Laurens so replace the username accordingly.

[Service]
Type=simple
ExecStart=
ExecStart=-/sbin/agetty --noreset --noclear --autologin lauren - ${TERM}

Now test if your TTY1 logs in automagicly with the previous command or rebooting. You can always revert by just removing the file/folder and it'll be just like you never overrid the unit!

Autostart X on login

But that's just the logging in part. Now we need to start the X, preferably only for TTY1. On logging in bunch of files are read and one of them is ~/.profile. Works on my Bash, no idea about Dash. Don't replace the whole file but add to the end

#...

#TTY1 startx
if[-z "$DISPLAY"]&&["${XDG_VTNR}" -eq 1]; then
	.startx
	#logout
fi

#...

Logout was included in some guides but I left it out by commenting it. You do you.

User Xsession override

Optionally you can override system wide default session for the user by creating ~/.Xsession (remember to make it executable with chmod +x ~/.Xsession)

#!/bin/sh
xrdp -merge ~/.Xresources
xset -dpms
xset s off
xset s noblank

export MANGOHUD=1

#exec xterm
#exec openbox
exec awesome --no-argb

In this case I load my preferenses for xterm etc., set display power managing off to have it stay on, have an environment variable and lastly get a window manager going with popular alternatives commented out. The --no-argb for AwesomeWM let's variable refresh rate (freesync) to work but may limit other functionality as it's disabling transparency or something.

Lauren Toivanen
2026-09-14