Difference between revisions of "Automatic login to virtual console"

From ArchWiki
Jump to: navigation, search
m (Service: Consistency)
(all information available in getty via https://wiki.archlinux.org/index.php?title=Getty&diff=440522&oldid=440520)
(71 intermediate revisions by 34 users not shown)
Line 1: Line 1:
[[Category:Boot process]]
#REDIRECT: [[Getty#Automatic_login_to_virtual_console]]
[[es:Automatic login to virtual console]]
[[it:Automatic login to virtual console]]
{{Article summary start}}
{{Article summary text|Describes how to automatically log in to a virtual console.}}
{{Article summary heading|Related}}
{{Article summary wiki|Display Manager}}
{{Article summary wiki|Start X at Login}}
{{Article summary end}}
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; methods for starting an [[Xorg|X server]] are described in [[Start X at Login]].
== Service ==
Create a new service file similar to {{ic|getty@.service}} by copying it to {{ic|/etc/systemd/system/}}:
# cp /usr/lib/systemd/system/getty@.service /etc/systemd/system/autologin@.service
{{Note|{{ic|/etc/systemd/system/}} takes precedence over {{ic|/usr/lib/systemd/system/}}.}}
Once created you can link the new {{ic|autologin@.service}} to your chosen tty, e.g. {{ic|tty1}}, {{ic|tty2}}, [...] {{ic|tty8}}, etc., by specifying it as an alias in the {{ic|[Install]}} section of the unit file. Accordingly, change the value of {{ic|ExecStart}} in {{ic|autologin@.service}}:
ExecStart=-/sbin/agetty --noclear -a ''USERNAME'' %I 38400
{{Tip|It is possible to change {{ic|1=Type=idle}} to {{ic|1=Type=simple}} and avoid delaying the execution of agetty until all jobs (state change requests to units) are completed. This option is more useful when [[Start X at Login|starting X automatically]]. See {{ic|man systemd.service}} for more info. {{Note|{{ic|1=Type=simple}} can cause systemd boot-up messages to pollute the login prompt.}}}}
Finally, you need to disable the old getty@.service for the specified tty and enable the new autologin@.service for the same tty:
# systemctl daemon-reload
# systemctl disable getty@tty1
# systemctl enable autologin@tty1
# systemctl start autologin@tty1
{{Warning|If you are currently in an X session on the same tty configured in the service file, starting autologin@tty''X''.service will kill your X server.}}
To avoid errors related to display-manager.service in dmesg, you should set the default target to multi-user instead of graphical:
# systemctl enable multi-user.target
(See also: [[Systemd#Change_default_target_to_boot_into|Change default runlevel/target to boot into]].)

Latest revision as of 12:48, 17 August 2016