Automatic login to virtual console

From ArchWiki
Jump to: navigation, search

This article describes how to automatically log in to a virtual console at the end of the boot process. This article only covers console log-ins; see Start X at login for information about automatic login into Xorg.

Configuration

Configuration relies on systemd drop-in files to override the default parameters passed to agetty.

Configuration differs for virtual versus serial consoles. In most cases, you want to set up automatic login on a virtual console, (whose device name is ttyN, where N is a number). The configuration of automatic login for serial consoles will be slightly different. Device names of the serial consoles look like ttySN, where N is a number.

Virtual console

Edit the provided unit either manually by creating the following drop-in snippet, or by running systemctl edit getty@tty1 and pasting its content:

/etc/systemd/system/getty@tty1.service.d/override.conf
[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin username --noclear %I $TERM
Tip: The option Type=idle found in the default getty@.service will delay the service startup until all jobs (state change requests to units) are completed in order to avoid polluting the login prompt with boot-up messages. When starting X automatically, it may be useful to start getty@tty1.service immediately by adding Type=simple into the drop-in snippet. Both the init system and startx can be silenced to avoid the interleaving of their messages during boot-up.

If you want to use a tty other than tty1, see systemd FAQ.

Serial console

Create the following file (and leading directories):

/etc/systemd/system/serial-getty@ttyS0.service.d/autologin.conf
[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin username -s %I 115200,38400,9600 vt102

See also