Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 911336 - sys-apps/util-linux - wall command displays error message for ttys that do not exist
Summary: sys-apps/util-linux - wall command displays error message for ttys that do no...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-27 20:09 UTC by Jay Faulkner
Modified: 2023-08-03 19:04 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
util-linux patch (0001-wall-do-not-error-for-ttys-that-do-not-exist.patch,1.08 KB, patch)
2023-07-29 21:37 UTC, Mike Gilbert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jay Faulkner 2023-07-27 20:09:51 UTC
So, wall appears to be broken in a polkit+systemd+loginctl world due to missing /dev/seat0 -- I'm not sure where in the path things breakdown, but it was trivial to reproduce:

- set USE=tty-helpers on util-linux
- `echo 'lol' | wall`
- Get error:

# echo lol | wall
wall: /dev/seat0: No such file or directory


It also errors in write, when fed seat0 explicitly:

# echo 'lol' | write jay seat0
write: /dev/seat0: No such file or directory



This is likely something introduced upstream; it's reported as broken by a friend of mine running CentOS Stream 8 with all packages updated as well but still seems to work in e.g. ubuntu.

Happy to do anything I can to help troubleshoot the problem :).


I'll note this likely will impact nut as well as any other applications which expect to be able to write messages to ttys using write/wall.
Comment 1 Jay Faulkner 2023-07-27 20:11:25 UTC
This is happening on =sys-apps/util-linux-2.38.1-r2.

I will test and report back if behavior changes on ~amd64 util-linux; but I don't expect it to.
Comment 2 Mike Gilbert gentoo-dev 2023-07-27 20:16:02 UTC
Works fine for me with sys-apps/util-linux-2.39.1.

% echo foo | wall

Broadcast message from floppym@naomi (pts/3) (Thu Jul 27 16:14:49 2023):

foo
Comment 3 Mike Gilbert gentoo-dev 2023-07-27 20:17:35 UTC
What does the "w" command show on your system?

% w
 16:16:30 up 6 days, 16:45,  5 users,  load average: 0.03, 0.04, 1.19
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
floppym  tty2      20Jul23  6days  0.20s  0.20s /usr/bin/startplasma-wayland
floppym  pts/1     20Jul23  6days  0.00s  1:22  /usr/bin/kded5
floppym  pts/2     Wed20   14:55m  0.07s  0.07s /bin/zsh
floppym  pts/3     16:13    3.00s  0.07s  0.01s w
floppym  pts/4     16:15    1:02   0.04s  0.04s -zsh
Comment 4 Jay Faulkner 2023-07-27 20:27:02 UTC
jay in ~ 
❯ w
 13:26:18 up  4:54,  2 users,  load average: 4.41, 9.33, 9.04
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
jay      seat0     08:31    0.00s  0.00s  0.00s /usr/libexec/gdm-wayland-session /usr/bin/gnome-session
jay      tty2      08:31    4:54m  0.00s  0.00s /usr/libexec/gnome-session-binary

jay in ~ 
❯ loginctl
SESSION  UID USER SEAT  TTY 
      3 1000 jay  seat0 tty2

1 sessions listed.

jay in ~ 
❯ 


(I'll note; the seat0 in output is identical to what my friend reproducing this on CentOS Stream 8 saw, too)
Comment 5 Jay Faulkner 2023-07-27 20:28:17 UTC
I reproduced this using 2.39.1 as well; I could not try it with -9999 due to bug 911339
Comment 6 Mike Gilbert gentoo-dev 2023-07-27 20:44:32 UTC
So it appears that GDM is setting the ut_line field to "seat0" in the utmp database.

This is supposed to be a valid tty device. "seat0" is never a valid tty device.

Re-assigning this to the GNOME team.
Comment 7 Mike Gilbert gentoo-dev 2023-07-27 21:06:16 UTC
It appears that wall already has some special handling to skip X11 sessions, which may have a ut_line value starting with ":".

https://github.com/util-linux/util-linux/blob/v2.39.1/term-utils/wall.c#L256

If you can't convince the GNOME developers to stop putting "seatN" in ut_line, you might be able to convince the util-linux developers to add another special case.
Comment 8 Mike Gilbert gentoo-dev 2023-07-29 21:37:20 UTC
Created attachment 866642 [details, diff]
util-linux patch

Here's a patch for the wall command. Please test.
Comment 9 Jay Faulkner 2023-08-02 14:23:04 UTC
I confirm the posted patch suppresses the error.
Comment 10 Mike Gilbert gentoo-dev 2023-08-02 14:49:04 UTC
Ok, swapping this back to util-linux and base-system.

Upstream pull request is in See Also.
Comment 11 Mike Gilbert gentoo-dev 2023-08-03 14:14:12 UTC
The fix has been merged upstream, and should be included in the next major release.

Given the low impact of this issue, I am not inclined to backport the fix, but let me know if you feel otherwise.
Comment 12 Larry the Git Cow gentoo-dev 2023-08-03 19:03:52 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a7839bf00b46ac9675d8e05998130d29e77135d

commit 5a7839bf00b46ac9675d8e05998130d29e77135d
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-08-03 19:02:43 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-08-03 19:03:20 +0000

    sys-apps/util-linux: fix mount with older kernels (no statx); fix wall
    
    Ended up backporting the wall fix as we need the mount w/ no statx
    fix anyway.
    
    Bug: https://bugs.gentoo.org/911336
    Bug: https://github.com/util-linux/util-linux/issues/2409
    Signed-off-by: Sam James <sam@gentoo.org>

 .../files/util-linux-2.39.1-mount-no-statx.patch   |  34 ++
 .../files/util-linux-2.39.1-wall-no-tty.patch      |  26 ++
 sys-apps/util-linux/util-linux-2.39.1-r1.ebuild    | 402 +++++++++++++++++++++
 3 files changed, 462 insertions(+)