RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2128989 - pkttyagent gets stopped if killed in the background
Summary: pkttyagent gets stopped if killed in the background
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: polkit
Version: 8.6
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Jan Rybar
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
Depends On:
Blocks: 2150310 2186311 2186756 2186757
TreeView+ depends on / blocked
 
Reported: 2022-09-22 08:25 UTC by José Enrique
Modified: 2023-05-16 11:22 UTC (History)
7 users (show)

Fixed In Version: polkit-0.115-15.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2150310 2186311 2186756 2186757 (view as bug list)
Environment:
Last Closed: 2023-05-16 09:12:22 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-134661 0 None None None 2022-09-22 09:20:26 UTC
Red Hat Product Errata RHBA-2023:3051 0 None None None 2023-05-16 09:12:41 UTC

Description José Enrique 2022-09-22 08:25:00 UTC
Description of problem:
Virsh is stucked when running in background, if affects to Virtual Domain cluster resource, it is based on virsh.

Version-Release number of selected component (if applicable):
libvirt-client-8.0.0-5.4.module+el8.6.0+16370+bb85faee.x86_64
# virsh version
Compiled against library: libvirt 8.0.0
Using library: libvirt 8.0.0
Using API: QEMU 8.0.0
Running hypervisor: QEMU 6.2.0

How reproducible:

tee ~/virsh_test.sh <<EOF
#!/bin/bash
virsh list --all
EOF
# chmod u+x ~/virsh_test.sh
# ~/virsh_test.sh
Id   Name   State
--------------------
# ~/virsh_test.sh 2>stderr &
# ps f
    PID TTY      STAT   TIME COMMAND
 101995 pts/0    Ss     0:00 -bash
 144669 pts/0    T      0:00  \_ -bash
 144670 pts/0    Tl     0:00  |   \_ /usr/bin/virsh list --all
 144672 pts/0    Tl     0:00  |       \_ /usr/bin/pkttyagent --process 144670 --notify-fd 4 --fallback
 144676 pts/0    R+     0:00  \_ ps f
   1296 tty1     Ss+    0:00 /sbin/agetty -o -p -- \u --noclear tty1 linux

[1]+  Stopped                 ~/virsh_test.sh 2> stderr
# fg
~/virsh_test.sh 2> stderr
 Id   Name   State
--------------------

Steps to Reproduce:
1.
2.
3.

Actual results:

Virsh command is stopped.

Expected results:

Virsh not being stucked and is hindering the proper execution of cluster  Virtual Domain resources.

Additional info:

The problem is not observed in virsh version 8.1, I don't know what patch or patches resolve the issue, only found this related gitlab thread [1] and this mail discussion [2].

This bugzilla is not marked as Urgent because we found a workaround which consists on the creation of a little script that calls virsh with the setuid command, like this one,

# tee /usr/local/bin/virsh <<EOF
#!/bin/bash
setsid --wait /usr/bin/virsh "\$@"
EOF
sudo chmod +x /usr/local/bin/virsh


[1] https://gitlab.com/libvirt/libvirt/-/issues/366
[2] https://listman.redhat.com/archives/libvir-list/2021-December/226188.html

Comment 1 Lili Zhu 2022-09-28 02:05:30 UTC
Not reproduced with:
libvirt-daemon-6.0.0-37.module+el8.5.0+12162+40884dd2.x86_64

1. run virsh in backgroud
# virsh list &
[1] 63993
#  Id   Name   State
--------------------


2. check the process
# ps f
    PID TTY      STAT   TIME COMMAND
  63091 pts/1    Ss     0:00 -bash
  64031 pts/1    R+     0:00  \_ ps f
  59348 pts/0    Ss+    0:00 -bash
   1017 ttyS1    Ss+    0:00 /sbin/agetty -o -p -- \u --keep-baud 115200,38400,9600 ttyS1 vt220
   1016 tty1     Ss+    0:00 /sbin/agetty -o -p -- \u --noclear tty1 linux
(no virsh process running)



Reproduced with:
libvirt-8.0.0-10.module+el8.7.0+16047+746a126c.x86_64

1. run virsh in backgroud
# virsh list &
[1] 327395

2. check the process
# ps f
    PID TTY      STAT   TIME COMMAND
 327362 pts/0    Ss     0:00 -bash
 327395 pts/0    Tl     0:00  \_ virsh list
 327397 pts/0    Tl     0:00  |   \_ /usr/bin/pkttyagent --process 327395 --notify-fd 4 --fallback
 327545 pts/0    R+     0:00  \_ ps f
   2040 ttyS0    Ss+    0:00 /sbin/agetty -o -p -- \u --keep-baud 115200,38400,9600 ttyS0 vt220
   2039 tty1     Ss+    0:00 /sbin/agetty -o -p -- \u --noclear tty1 linux

[1]+  Stopped                 virsh list

3. track the virsh process
# strace -p  327395
strace: Process 327395 attached
--- stopped by SIGTTOU ---

(virsh process run in background hangs)

Comment 2 Martin Kletzander 2022-10-11 15:44:14 UTC
Preliminary fix posted here:

https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/139

Comment 3 Martin Kletzander 2022-10-25 11:55:54 UTC
The fix was merged upstream to polkit and it looks like it fixes the issue:

https://gitlab.freedesktop.org/polkit/polkit/-/commit/07593c1055ddbdda85465e09da1f44b1b4f0fc3d

It is caused originally by a combination of two commits, one in polkit fixing Bug 1693781 and one in libvirt fixing Bug 1945501.

To reproduce this it is enough to run pkttyagent in the background and kill it.  It can even be used to put in a password and then backgrounded and killed:

$ pkttyagent &
$ kill %1
$
[1]+  Terminated              pkttyagent
$


It should not get stopped and it should not disable echo for the terminal (both of which could happen before this patch due to bash changing the tty attributes).  On top of that any of the aforementioned BZs should not be broken by this change.

I'm reassigning this to polkit since there is nothing to do in libvirt.

Comment 15 errata-xmlrpc 2023-05-16 09:12:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (polkit bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:3051


Note You need to log in before you can comment on or make changes to this bug.