View Issue Details

IDProjectCategoryView StatusLast Update
0000156Rocky-Linux-9rocky-releasepublic2023-07-31 23:39
ReporterRoman Zhivotovskiy Assigned ToLouis Abel  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Summary0000156: Can't add the name of the current tty before login prompt
DescriptionEdit /etc/issue to show current tty by adding \l escape code. Test with agetty --show-issue is fine, but before login prompt I see "-" instead of the current tty name. Try to some other escape codes and they all work fine.
In Rocky 8.6 and Fedora 36 I have no such problem.
Steps To ReproduceAdd \l in /etc/issue
Run agetty --show-issue
Exit the shell to show message before login prompt
TagsNo tags attached.
Attached Files
bug.png (21,182 bytes)   
bug.png (21,182 bytes)   

Relationships

has duplicate 0000157 closedLouis Abel Can't add the name of the current tty before login prompt 

Activities

Louis Abel

Louis Abel

2022-07-20 17:19

administrator   ~0000291

Last edited: 2022-07-20 18:41

Thank you for the report. This behavior appears to have been started by a change in systemd itself upstream, where stdin is used to determine the tty. This works in Fedora as you've seen. This is reproducible in RHEL 9 and CentOS Stream 9, though it is unclear why Fedora does not exhibit this issue. This may be a bug report that can be filed upstream to bugzilla.redhat.com.

Context:

EL8:

[root@router ~]# systemctl status | grep getty
           │ │ └─3914354 grep --color=auto getty
           │ ├─system-getty.slice
           │ │ └─getty@tty1.service
           │ │ └─2292 /sbin/agetty -o -p -- \u --noclear tty1 linux
[root@router ~]# grep 'ExecStart' /usr/lib/systemd/system/getty@.service
ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear %I $TERM

EL9:

[root@awx ~]# systemctl status | grep getty
           │ ├─system-getty.slice
           │ │ └─getty@tty1.service
           │ │ └─5883 /sbin/agetty -o "-p -- \\u" --noclear - linux
[root@awx ~]# grep 'ExecStart' /usr/lib/systemd/system/getty@.service
ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear - $TERM

The change in systemd occurred here: https://github.com/systemd/systemd/commit/b4bf9007cbee7dc0b1356897344ae2a7890df84c

If the tty arg is set to "-", agetty uses the stdin fd as the tty.
Let's pass the tty this way so that we keep an fd open to the tty
at all times. If all fd's to a tty are closed, the kernel might
reset the tty which we want to avoid.
Roman Zhivotovskiy

Roman Zhivotovskiy

2022-07-20 18:48

reporter   ~0000292

Thank You very much for answer! It helped me to understand strange behavior of agetty on my system.
Louis Abel

Louis Abel

2022-07-20 18:51

administrator   ~0000293

Upstream bug has been filed: https://bugzilla.redhat.com/show_bug.cgi?id=2109252
Roman Zhivotovskiy

Roman Zhivotovskiy

2022-07-21 06:18

reporter   ~0000296

I find:
Fedora 36 uses agetty from util-linux 2.38
Rocky Linux uses agetty from util-linux 2.37.4

https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.38/v2.38-ReleaseNotes
Changes between v2.37 and v2.38
...
agetty:
    - ...
    - resolve tty name even if stdin is specified [tamz]

So for fix, we must update agetty
Roman Zhivotovskiy

Roman Zhivotovskiy

2022-07-21 06:53

reporter   ~0000297

https://github.com/util-linux/util-linux/issues/1546

Systemd 250 changed its getty@ unit file in systemd/systemd@b4bf900
to call agetty with stdin ("-") port as apparently the kernel could have pontentially reset ttys otherwise.
This means that any distribution running systemd will now not display the tty device name at the login prompt, but a dash symbol instead (systemd/systemd#21919).

Issue History

Date Modified Username Field Change
2022-07-20 11:32 Roman Zhivotovskiy New Issue
2022-07-20 11:32 Roman Zhivotovskiy File Added: bug.png
2022-07-20 16:14 Louis Abel Relationship added has duplicate 0000157
2022-07-20 17:19 Louis Abel Assigned To => Louis Abel
2022-07-20 17:19 Louis Abel Status new => confirmed
2022-07-20 17:19 Louis Abel Note Added: 0000291
2022-07-20 18:41 Louis Abel Note Edited: 0000291
2022-07-20 18:48 Roman Zhivotovskiy Note Added: 0000292
2022-07-20 18:51 Louis Abel Note Added: 0000293
2022-07-21 06:18 Roman Zhivotovskiy Note Added: 0000296
2022-07-21 06:53 Roman Zhivotovskiy Note Added: 0000297
2023-07-31 23:39 Louis Abel Status confirmed => closed
2023-07-31 23:39 Louis Abel Resolution open => fixed