0

Application for which I'm writing service file expects its STDIN to be connected to the tty, or in other words to be run on the terminal. Systemd has the following settings which do the trick for my application, however here I use statically configured tty path, which could potentially already be used by other application or simply do not exist on the system.

StandardInput=tty-force
TTYPath=/dev/tty30

It would be much nicer if systemd (or me for that matter) could figure out unused pseudoterminal pair and use that instead.

3
  • What are you expecting to have an open file descriptor for the master side of the pseudo-terminal? – JdeBP Nov 7 '17 at 13:50
  • @JdeBP Hopefully no other process should consume master pty of the running service, at present nothing is attached to it. To my best knowledge systemd docs say nothing about the requirement to hang some other process on the master pty. – NarūnasK Nov 7 '17 at 14:28
  • You are misunderstanding one of the basic ideas of pseudo-terminals. And systemd doco is the wrong place to be looking for how pseudo-terminals work. – JdeBP Nov 8 '17 at 12:33
0

According to man systemd.exec. the feature you are looking for is not built into systemd.

As an alternative, you can write another small service that finds a free TTY, then writes out a systemd unit file with the hardcoded TTY, then calls systemctl start on the just-in-time unit file.

1
  • I suspected there's no built-in method in the systemd, therefore I also asked whether I could figure out a free pty, but I suppose it deserves a separate question. – NarūnasK Nov 8 '17 at 10:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.