https://wiki.archlinux.org/api.php?action=feedcontributions&user=Mr.Magne&feedformat=atomArchWiki - User contributions [en]2024-03-28T18:27:36ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Automatic_login_to_virtual_console&diff=280851Automatic login to virtual console2013-11-01T16:31:33Z<p>Mr.Magne: /* Use drop-in feature of systemd for getty autologin */</p>
<hr />
<div>[[Category:Boot process]]<br />
[[Category:Security]]<br />
[[es:Automatic login to virtual console]]<br />
[[it:Automatic login to virtual console]]<br />
{{Article summary start}}<br />
{{Article summary text|Describes how to automatically log in to a virtual console.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Display Manager}}<br />
{{Article summary wiki|Silent boot}}<br />
{{Article summary wiki|Start X at Login}}<br />
{{Article summary end}}<br />
<br />
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]].<br />
<br />
== Installation ==<br />
=== Use drop-in feature of systemd for getty autologin ===<br />
[http://cgit.freedesktop.org/systemd/systemd/tree/NEWS#n655 Since systemd 198] unit files may now be extended via drop-in files without having to edit/override the unit files themselves, to learn more about this feature, consult [http://www.freedesktop.org/software/systemd/man/systemd.unit.html systemd.unit(5)] and search for ''Along with a unit file foo.service a directory foo.service.d/ may exist.''<br />
<br />
There are two types of consoles: virtual and serial ones. In most cases you would want to setup up autologin on virtual console, the one which device name is ''ttyN'', where ''N'' is a number. The configuration of the autologin for the serial consoles will be slightly different. Device names of the serial consoles look like ''ttySN'', where ''N'' is a number.<br />
<br />
For the virtual console proceed with the following steps, the case with serial console is dealt with at the bottom of this page.<br />
<br />
Create a new directory named {{ic|getty@tty1.service.d}} under {{ic|/etc/systemd/system}}:<br />
<br />
# mkdir /etc/systemd/system/getty@tty1.service.d<br />
<br />
Then create a new file named {{ic|autologin.conf}} and add it into the directory:<br />
<br />
{{hc|/etc/systemd/system/getty@tty1.service.d/autologin.conf|<br />
2=[Service]<br />
ExecStart=<br />
ExecStart=-/usr/bin/agetty --autologin <username> --noclear %I 38400 linux<br />
}}<br />
<br />
{{Tip|The option {{ic|1=Type=idle}} will delay the execution of agetty until all jobs (state change requests to units) are completed. On the other hand it may cause systemd boot-up messages to pollute the login prompt. This option is more useful when [[Start X at Login|starting X automatically]]. See {{ic|man systemd.service}} for more info.}}<br />
<br />
By default, {{ic|getty@.service}} uses {{ic|1=Type=idle}}. If you want to use {{ic|1=Type=simple}}, then your {{ic|autologin.conf}} should look like this:<br />
<br />
{{hc|/etc/systemd/system/getty@tty1.service.d/autologin.conf|<br />
2=[Service]<br />
ExecStart=<br />
ExecStart=-/usr/bin/agetty --autologin <username> --noclear %I 38400 linux<br />
Type=simple<br />
}}<br />
<br />
If you want to use another tty than tty1 see [[Systemd FAQ#Q:_How_do_I_change_the_number_of_gettys_running_by_default.3F|Systemd FAQ]].<br />
<br />
In the case of a serial console you need to create different directory<br />
<br />
# mkdir /etc/systemd/system/serial-getty@ttyS0.service.d<br />
<br />
The file {{ic|autologin.conf}} will also look slightly different<br />
<br />
{{hc|/etc/systemd/system/serial-getty@ttyS0.service.d/autologin.conf|<br />
2=[Service]<br />
ExecStart=<br />
ExecStart=-/sbin/agetty --autologin <username> -s %I 115200,38400,9600 vt102<br />
Type=simple<br />
}}<br />
<br />
== Tips & Tricks ==<br />
<br />
=== Avoiding unnecessary dmesg errors ===<br />
To avoid errors related to {{ic|display-manager.service}} in dmesg, you should set the default target to multi-user instead of graphical:<br />
# systemctl enable multi-user.target<br />
<br />
==See also==<br />
* [[Systemd#Change_default_target_to_boot_into|Change default runlevel/target to boot into]].</div>Mr.Magne