1

I have a customized Linux image. When it first boots, it checks for some flags, then should ask if the user on console wants to kick off the setup script. If yes, then run setup, display important output to console, wait for confirm, then continue. If no, then just continue as usual.

How do I create a systemd unit file that will interact with the user on console? Since most systemd units start in parallel, how do I wait until everything is done and then "grab the interaction" prior to the user being presented the usual "login" interface?

The setup is entirely console, not graphical, so no need to deal with any graphical login. I just want to have an interactive menu at the right point in startup.

If I actually knew how systemd initiated the login session, might be easier....

  • 1
    I'm not even sure this is possible, systemd unit have usually no attached terminal, and I don't see how they could have one before login even starts. Is this what you want to do ? superuser.com/questions/689715/… – lgeorget Apr 28 '16 at 12:57
  • @lgeorget thanks. That is in the right direction. Yeah, it isn't attached to a terminal, but I should be able to create a service that attaches to the "primary" terminal and does interactive startup stuff. After all, login service does it. I don't want it for every user, or part of (pre)login, as much as something that checks if one-time setup was run and, if not, asks for setup information and does it. – deitch Apr 28 '16 at 13:43
  • I see. Then maybe you can look at how systemd-logind works? That's the unit in charge of running login. – lgeorget Apr 28 '16 at 15:42
  • That is a very good idea. Figure out how it connects to ttys, and use it as a basis for dependencies and scheduling. Thanks. – deitch Apr 30 '16 at 20:12
  • Unfortunately, that didn't help @lgeorget. systemd-logind.service just launches systemd-logind binary, which handles all of the ttys internally. Got to be an easier way to do this.... – deitch May 1 '16 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.