[systemd-devel] persistent changes to the serial console

David A. Marlin dmarlin at redhat.com
Wed Mar 27 06:40:00 PDT 2013


moving to the mailing list:

On 03/26/2013 09:04 PM, Lennart Poettering wrote:

> On 26.03.2013 19:21, David Marlin wrote:
>>
>> I am trying to make the serial console automatically log in a user on
>> boot.  I tried modifying:
>>
>>     /lib/systemd/system/serial-getty at .service
>
> /lib/ is package manager territory, you should never edit files there, 
> the package manager will otherwise override your changes without hehow 
> to correct thissitation.
>
> Instead, copy /lib/systemd/system/serial-getty at .service to 
> /etc/systemd/system/serial-getty at .service -- /etc is administrator 
> territory, and unit files stored there will automatically override 
> unit files by the same name in /lib.

I had actually tried this (or several variations on this), but it was 
not producing the desired results.

I tried again using exactly what you suggested.  For this example, I 
just used 'root' user for testing.  Below are snippets of the steps I 
performed:

--------------------------------------------------------------------------
cp /lib/systemd/system/serial-getty at .service 
/etc/systemd/system/serial-getty at .service

vi /etc/systemd/system/serial-getty at .service

diff -u /lib/systemd/system/serial-getty at .service 
/etc/systemd/system/serial-getty at .service
-----------
  [Service]
-ExecStart=-/sbin/agetty -s %I 115200,38400,9600 vt102
+ExecStart=-/sbin/agetty -s --noclear --autologin root %I 
115200,38400,9600 vt102
-----------

[root at localhost ~]# systemctl daemon-reload
[root at localhost ~]# exit
logout

Fedora release 18 (Spherical Cow)
Kernel 3.6.10-8.fc18.armv7hl.tegra on an armv7l (ttyS0)

localhost login:

     ( note: still prompts for login )

[root at localhost ~]# reboot
     :

Fedora release 18 (Spherical Cow)
Kernel 3.6.10-8.fc18.armv7hl.tegra on an armv7l (ttyS0)

localhost login:

     ( note: again, after reboot, prompts for login )

[root at localhost ~]# cp /etc/systemd/system/serial-getty at .service 
/lib/systemd/system/serial-getty at .service

[root at localhost ~]# systemctl daemon-reload
[root at localhost ~]# exit
logout

Fedora release 18 (Spherical Cow)
Kernel 3.6.10-8.fc18.armv7hl.tegra on an armv7l (ttyS0)

localhost login: root (automatic login)

     ( note: works as expected, autologin )

[root at localhost ~]# reboot
     :

Fedora release 18 (Spherical Cow)
Kernel 3.6.10-8.fc18.armv7hl.tegra on an armv7l (ttyS0)

localhost login: root (automatic login)

     ( note: works as expected, autologin.
       also, note that the change is persistent; survives reboot. )

--------------------------------------------------------------------------

So if I make the change only in /etc it does not seem to work.  If I 
make the change only in /lib it works, but does not survive reboot. If I 
make the change in both, it works and survives reboot.

I assume I am making some mistake in the process, but it is not obvious 
to me what I'm doing wrong.

This is a headless system, so I only have a serial console for access.  
I do pass "console=ttyS0,115200n8" on the kernel command line.  I am 
running systemd-195-15.fc18.

Please let me know what I'm missing.


Thank you,

d.marlin
=========

>
> Also see:
>
> http://www.freedesktop.org/wiki/Software/systemd/FrequentlyAskedQuestions
>
> Question #4 on that list.
>
> Lennart



More information about the systemd-devel mailing list