Skip to content

systemd-run always warns Failed to open /dev/tty: No such device or address #20576

Closed

Description

@WhyNotHugo

systemd version the issue has been seen with

$ systemctl --version
systemd 249 (249.r241.gc7cfde640d-1-arch)
+PAM +AUDIT -SELINUX -APPARMOR -IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY +P11KIT -QRENCODE +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified

Used distribution

ArchLinux

Linux kernel version used (uname -a)

Linux 5.13.12-arch1-1 GNU/Linux

CPU architecture issue was seen on

amd64

Steps to reproduce the problem

I've set up my compositor to run the my terminal when pressing Super+Return:

systemd-run --user alacritty

Expected behaviour you didn't see

Terminal should run with no warnings.

Unexpected behaviour you saw

systemd-run prints the following warning, no matter what program I run:

Failed to open /dev/tty: No such device or address

Nothing seems to fail though, but this quickly piles up lots of useless log entries.

Additional program output to the terminal or log subsystem illustrating the issue

This can be quickly reproduce by running sway(hint: this compositor can be nested inside another Wayland sessions), and then running:

swaymsg exec -- systemd-run --user true

Activity

  1. poettering commented on Aug 30, 2021

    @poettering
    Member

    Smells like something wrong with your WM: it passes stdout/stderr on a tty, but not a controlling tty. This usually means the program is a bit confused about ttys (i.e. thinks its a background shell job or so)

    That said, even though your tty setup looks broken we should probably handle this better and detect this case.

    You can work around this by using --no-ask-password

  2. WhyNotHugo commented on Aug 30, 2021

    @WhyNotHugo
    Author

    Smells like something wrong with your WM: it passes stdout/stderr on a tty, but not a controlling tty. This usually means the program is a bit confused about ttys (i.e. thinks its a background shell job or so)

    I'm not sure I 100% understand this. It gets passed stdout/stderr. However, it is run as a background shell / job.

    What I'm doing is running mapping a global keybinding to swaymsg exec -- systemd-run --user true. So I think it makes sense that there's not tty for it.

    --no-ask-password does suppress the error message.

  3. linked a pull request that will close this issuesome polkit agent tweaks #20583on Aug 30, 2021
  4. poettering commented on Aug 30, 2021

    @poettering
    Member

    The problem is not that there was no tty for it. There is a TTY for it. However it's not the controlling TTY.

  5. WhyNotHugo commented on Aug 31, 2021

    @WhyNotHugo
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions