[systemd-devel] Cannot restart service when StandardInput=tty-force (or tty)

Tom Vaughan thomas.david.vaughan at gmail.com
Tue Jan 10 02:56:57 UTC 2017


Hi,

I don't even pretend to understand this one. Let's say I have a
service that looks like:

    [Unit]
    Description=nginx
    After=docker.service
    Requires=docker.service

    [Service]
    StandardInput=tty-force
    ExecStart=/usr/bin/docker run --name %p nginx
    ExecStop=/usr/bin/docker stop %p
    ExecStopPost=/usr/bin/docker rm %p

    [Install]
    WantedBy=multi-user.target

I cannot reliably restart this when StandardInput=tty-force (or tty).
Sometimes the stop operations timeout, and sometimes the start
operations time out. At the very least the stop and start operations
take orders of magnitude longer to complete. Everything works as
expected with this commented out. Why and what can I do to work around
this problem?

This is with Ubuntu 16.04 with systemd 229 and CoreOS 1284.0.0 and
systemd 231. There's nothing helpful in `journalctl -u nginx.service`
or `systemctl status nginx.service`. The docker server logs are also
unhelpful. A google search didn't turn up any answers. There was one
similar problem where the solution was to add `KillMode=process` to
docker.service, but this has already been set on each of these two
machines.

This is just an example. I understand that nginx doesn't require a
tty, but the application that I really want to run does.

Thanks,
-Tom


More information about the systemd-devel mailing list