Bug 1309164 - polkit uselessly noisy on a shutdown
polkit uselessly noisy on a shutdown
Status: CLOSED INSUFFICIENT_DATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd (Show other bugs)
7.2
x86_64 Unspecified
medium Severity medium
: rc
: ---
Assigned To: systemd-maint
qe-baseos-daemons
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-16 22:21 EST by Jarrod Petz
Modified: 2017-10-13 14:31 EDT (History)
17 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1205008
Environment:
Last Closed: 2016-06-06 06:36:06 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
strace logs (9.38 KB, application/zip)
2016-02-16 22:21 EST, Jarrod Petz
no flags Details

  None (edit)
Description Jarrod Petz 2016-02-16 22:21:08 EST
Created attachment 1127827 [details]
strace logs

+++ This bug was initially created as a clone of Bug #1205008 +++

Duplicating the above Bug report as I think the problem is likely with systemctl and therefore the systemd component/team. This is also for RedHat 7.2 instead of Fedora.

Description of problem:

Per Bug #1205008. When restarting, the session is spammed with the below text depending on command used.
---------------------------------------------------
PolicyKit daemon disconnected from the bus.
We are no longer a registered authentication agent.
---------------------------------------------------

I used a brand new RedHat 7.2 instance on AWS EC2.

$ uname -a
Linux ip-172-31-10-82.ap-southeast-2.compute.internal 3.10.0-327.4.5.el7.x86_64 #1 SMP Thu Jan 21 04:10:29 EST 2016 x86_64 x86_64 x86_64 GNU/Linux

These are the three different commands I tired(below) which are essentially all the same given the sym link to underlying executable "/bin/systemctl".

1.
# ls -la /bin/systemctl
-rwxr-xr-x. 1 root root 645664 Oct 12 08:39 /bin/systemctl

2.
# ls -la /sbin/reboot
lrwxrwxrwx. 1 root root 16 Nov  9 20:25 /sbin/reboot -> ../bin/systemctl

3. 
# ls -la /sbin/shutdown
lrwxrwxrwx. 1 root root 16 Nov  9 20:25 /sbin/shutdown -> ../bin/systemctl

If you use "sudo systemctl reboot" or "sudo reboot". Then I get
---------------------------------------------------
PolicyKit daemon disconnected from the bus.
We are no longer a registered authentication agent.
---------------------------------------------------

If I use "sudo shutdown -r now" OR "sudo shutdown -r --no-wall now" it doesn't appear.

Also doing "sudo su -" then running "systemctl reboot" or "reboot" also doesn't show the message.

Given this behaviour I suspect systemctl is doing something different depending on how it was called. When called via "reboot" or "systemctl" this something different doesn't seem to like the environment it is running in when run with sudo.

Strace logs attached for these three commands.
   1.  sudo nohup strace reboot > ./reboot_output.txt &
   2.  sudo nohup strace systemctl reboot > ./systemctl_output.txt &
   3.  sudo nohup strace shutdown -r --no-wall now > ./shutdown_output.txt &

Hopefully they help track down where it is doing things different. From what I can tell all three look the same/similar up to line 125 in the logs
-------------------------------------------
Line 125: ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7fff976b8d70) = -1 ENOTTY (Inappropriate ioctl for device)
-------------------------------------------
Comment 2 Miloslav Trmač 2016-02-18 09:29:27 EST
(See also #1249627; not sure what is the better place to track this.)

The messages in question are from polkitagentlistener.c, perhaps through /usr/bin/pkttyagent.

So there are two basic directions of inquiry:

* Which process are they from? systemctl seems a plausible case, it does create an /usr/bin/pkttyagent fork, and the behavior differences with different ways to invoke systemctl described in comment#0 would suggest that this is somehow governed from systemctl.

OTOH none of the attached straces show systemctl forking an agent; and the socket communication patterns seem very similar in all three cases.

Jarrod, a bit more precise information could help here:
* What are the exact starting environments, in particular {real,effective} [UG]ID
  - And if (sudo) vs. (su - ) vs. (ssh) matters, is perhaps sudoers configured differently ? What does (sudo id -a) say?
* What are the exact commands?
* straces should exactly match the commands showing the difference, or the difference in behavior should be in the straced processes. (I.e. if the straces are using nohup, does the same behavior difference show up when running (nohup $command) without strace?)
* Also, much larger string sizes of strace might be useful to actually show the DBus operations being performed.


* Why is polkitd terminating before whatever process is running the agent listener (i.e. probably before some users’ session)?
Comment 3 David Duncan 2016-03-08 19:34:22 EST
Addressed for the reporter in RH customer case 01588086.
Comment 4 Jan Synacek 2016-06-06 06:36:06 EDT
Closing for the to lack of input and information.

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