Bug 1373909

Summary: Running systemctl stop kadmin.service causes the status to be failed instead of inactive
Product: Red Hat Enterprise Linux 7 Reporter: Jan Pazdziora <jpazdziora>
Component: krb5Assignee: Robbie Harwood <rharwood>
Status: CLOSED ERRATA QA Contact: Patrik Kis <pkis>
Severity: unspecified Docs Contact:
Priority: low    
Version: 7.3CC: dpal, jpazdziora, mkosek, pkis
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://github.com/krb5/krb5/pull/745
Whiteboard:
Fixed In Version: krb5-1.15.1-28.el7 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 08:08:00 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 Jan Pazdziora 2016-09-07 12:10:07 UTC
Description of problem:

With IPA / IdM installed, stopping the kadmin.service makes the state of the service

   Active: failed (Result: exit-code) since Wed 2016-09-07 08:07:39 EDT; 2s ago

Version-Release number of selected component (if applicable):

krb5-server-1.14.1-26.el7.x86_64

How reproducible:

Deterministic.

Steps to Reproduce:
1. yum install ipa-server-dns
2. ipa-server-install with some options
3. systemctl stop kadmin.service
4. systemctl status kadmin.service -l

Actual results:

● kadmin.service - Kerberos 5 Password-changing and Administration
   Loaded: loaded (/usr/lib/systemd/system/kadmin.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2016-09-07 08:07:39 EDT; 2s ago
  Process: 8987 ExecStart=/usr/sbin/_kadmind -P /var/run/kadmind.pid $KADMIND_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 8988 (code=exited, status=2)

Sep 07 08:06:38 ipa.example.test systemd[1]: Starting Kerberos 5 Password-changing and Administration...
Sep 07 08:06:38 ipa.example.test systemd[1]: Started Kerberos 5 Password-changing and Administration.
Sep 07 08:07:39 ipa.example.test systemd[1]: Stopping Kerberos 5 Password-changing and Administration...
Sep 07 08:07:39 ipa.example.test systemd[1]: kadmin.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Sep 07 08:07:39 ipa.example.test systemd[1]: Stopped Kerberos 5 Password-changing and Administration.
Sep 07 08:07:39 ipa.example.test systemd[1]: Unit kadmin.service entered failed state.
Sep 07 08:07:39 ipa.example.test systemd[1]: kadmin.service failed.

Expected results:

No failed.

Additional info:

Comment 1 Jan Pazdziora 2016-09-07 12:29:39 UTC
I fails on RHEL 7.2 with krb5-server-1.13.2-10.el7.x86_64 as well.

Comment 6 Robbie Harwood 2016-09-07 18:03:55 UTC
I'm a bit confused what you're asking for here.  Our service file is really simple; we don't do any mangling of return codes or anything from kadmind.  Additionally, return code from kadmind is not defined.  This is especially true in the case where it dies from signal, which is the normal exit route.

What information do you think is being lost here?

Comment 7 Jan Pazdziora 2016-09-08 06:49:28 UTC
The ability to say "all is clean and fine on the system" is lost.

When you run systemctl, you see red bullet next to this service.

When you run systemctl status, it will say

    State: degraded

When you run systemctl status kadmin, it says

    Active: failed

but it should not be failed -- it should be marked inactive (dead) like all other services seem to do.

Comment 8 Robbie Harwood 2016-09-08 17:29:54 UTC
We haven't done anything special to our service.  It is literally this:

[Service]
Type=forking
PIDFile=/var/run/kadmind.pid
EnvironmentFile=-/etc/sysconfig/kadmin
ExecStart=/usr/sbin/_kadmind -P /var/run/kadmind.pid $KADMIND_ARGS
ExecReload=/bin/kill -HUP $MAINPID

where _kadmind execs kadmind.  It matches krb5kdc, which is presumably working correctly.

If someone who knows more about systemd knows what's wrong here, I'm happy to fix it, but to my untrained eye I think you have a "behavior" in systemd.

Comment 9 Jan Pazdziora 2016-09-09 06:23:43 UTC
If the exit status 2 marks correct exit, then something like

SuccessExitStatus=2

is probably called for.

Comment 16 errata-xmlrpc 2018-10-30 08:08:00 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, 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/RHSA-2018:3071