Bug 1247556

Summary: Insufficient rights to stop service failed with errno 1 "Interactive authentication required"
Product: Red Hat Enterprise Linux 7 Reporter: Yongcheng Yang <yoyang>
Component: systemdAssignee: systemd-maint
Status: CLOSED NOTABUG QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: ksrot, lnykryn, omoris, systemd-maint-list
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-02 08:56:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yongcheng Yang 2015-07-28 10:14:39 UTC
Description of problem:
Test the "Insufficient rights" in current RHEL-7.2, the return status has changed from "4" to "1", and the warning messages also changed.

As the LSB said, the non-zero status code has different meanings:
"1	generic or unspecified error (current practice)"
"4	user had insufficient privilege"

So maybe we should still use the errno "4" for insufficient rights error.

And RHEL-7.1 does not has this issue.

Version-Release number of selected component (if applicable):
RHEL-7.2 with kernel-3.10.0-295.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. useradd test
2. su test -c "service nfs stop"

Actual results:
[root@hp-dl385pg8-03 ~]#  su test -c "service nfs stop"
Redirecting to /bin/systemctl stop  nfs.service
Error creating textual authentication agent: Error opening current controlling terminal for the process (`/dev/tty'): No such device or address (polkit-error-quark, 0)
Failed to stop nfs.service: Interactive authentication required.
[root@hp-dl385pg8-03 ~]# echo $?
1
^^<<<<<<<<<<<<<<<<<<<<<<<<<<<<< RHEL-7.2 kernel-3.10.0-295.el7.x86_64
[root@hp-dl385pg8-03 ~]# 


Expected results:
[root@hp-dl580g7-04 ~]# id testuserqa
uid=1001(testuserqa) gid=1001(testuserqa) groups=1001(testuserqa)
[root@hp-dl580g7-04 ~]# su testuserqa -c "service nfs-idmapd stop"
Redirecting to /bin/systemctl stop  nfs-idmapd.service
Failed to issue method call: Access denied
[root@hp-dl580g7-04 ~]# echo $?
4
^^<<<<<<<<<<<<<<<<<<<<<<<<<<<<< RHEL-7.1 kernel-3.10.0-229.el7.x86_64
[root@hp-dl580g7-04 ~]# 

Additional info:
http://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic.html#INISCRPTACT

Comment 2 Lukáš Nykrýn 2015-07-30 14:04:58 UTC
Yes this behavior has changed because now we support polkit authentication.

Comment 3 Yongcheng Yang 2016-06-02 08:56:57 UTC
According to comment 2, this is the expected result.

So close this bug as NOTABUG, please correct me if there's any concern.