[systemd-devel] persistent changes to the serial console

Andrey Borzenkov arvidjaar at gmail.com
Fri Mar 29 02:29:32 PDT 2013


В Wed, 27 Mar 2013 08:40:00 -0500
"David A. Marlin" <dmarlin at redhat.com> пишет:

> 
> 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 )
> 

serial-getty at .service is used only as template, and it looks like
getty-generator always links to (/usr)/lib/systemd:

        from = strappend(SYSTEM_DATA_UNIT_PATH "/", fservice);
        to = strjoin(arg_dest,"/getty.target.wants/", tservice, NULL);

It probably should use real unit path for fservice.

> [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
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel



More information about the systemd-devel mailing list