[systemd-devel] How to control the login prompt from my application service unit file?

Lennart Poettering lennart at poettering.net
Thu Oct 31 17:12:21 UTC 2019


On Di, 15.10.19 04:15, Moji, Shashidhar (Shashidhar.Moji at dellteam.com) wrote:

> Hi,
> We have VMware vApp based solution. Our application gets installed during first boot.
> Till now we had SLES11 OS based VM and we upgraded to SLES12. Now we have systemd instead of init scripts for service handling.
> In SLES11, we had service dependency configured in init scripts that was holding back the login prompt until our application installation is done. But in SLES12, we get the login prompt before our application is installed.
>
> How to hold the login prompt until our application installation is
> complete? We tried adding Before=getty at .service  in our application
> install unit file, but its not helping.

getty at .service is just a template for a unit, not a unit itself. Thus
you cannot have a dependency on it as a whole.

You have two options:

1. You can add a dropin getty at .service.d/foobar.conf, i.e. extend the
   getty at .service file that all VT gettys are instantiated of. In
   there, just place:

   [Unit]
   After=…

2. Order your unit before systemd-user-sessions.service. All gettys
   and other logins order themselves after that service, so if you order
   yourse before it you get the behaviour you are looking for.

The first option is nicer, since it's more specific to a getty type,
while the latter appplies to all logins including SSH or graphical.

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list