Bug 1396651

Summary: Failed to read PID from file /var/run/iscsid.pid: Invalid argument
Product: Red Hat Enterprise Linux 7 Reporter: John Pittman <jpittman>
Component: iscsi-initiator-utilsAssignee: Chris Leech <cleech>
Status: CLOSED ERRATA QA Contact: Filip Suba <fsuba>
Severity: high Docs Contact:
Priority: high    
Version: 7.3CC: alex.wang, fsuba, jpittman, jsynacek, liu.junbj, loberman, nweddle, revers, systemd-maint-list, tcleveng, voxadam
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: iscsi-initiator-utils-6.2.0.874-15 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-31 20:03:52 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:
Bug Depends On:    
Bug Blocks: 1420851, 1711360    

Description John Pittman 2016-11-18 20:31:18 UTC
Description of problem:

At boot or at restart of iscsid service, systemd fails to load the pid from within the SERVICE_START case of service_sigchld_event.  Removing PIDFile from .service file does get around the error (fails on PID file %s not readable (yet?)), but per systemd.service documentation PIDFile should be used for forking service.

Log snip can be found at https://paste.fedoraproject.org/484515/
- you will see the RH_DEBUG lines just showing which function we come from

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

kernel-3.10.0-514.el7.x86_64
iscsi-initiator-utils-6.2.0.873-35.el7.x86_64
systemd-219-30.el7.6.x86_64

How reproducible:

Install iscsi, enable, and reboot

Actual results:

Failed to read PID from file /var/run/iscsid.pid: Invalid argument

Expected results:
 
Other than not hitting the error every time, unclear at this point.  I can not say with confidence whether this is the fault of iscsid or systemd, so I will start it in systemd.  Please feel free to change the component.  Also, if there is further information needed, please let me know and I would be glad to gather it.

Comment 1 John Pittman 2016-11-18 20:43:17 UTC
It was just noted that disabling selinux is a workaround for this.

selinux-policy-3.13.1-102.el7_3.4.noarch

log snip with selinux disabled:  https://paste.fedoraproject.org/484529/

Comment 2 Lukáš Nykrýn 2016-11-21 09:43:28 UTC
Can you provide us the message from /var/log/audit/audit.log why selinux denied accessing that pid file?

Comment 3 John Pittman 2016-11-21 15:02:40 UTC
There doesn't seem to be a denial, and in my tests today, disabling selinux did not work around the issue, we get the same message of failure.  Possibly changed the timing enough in my earlier attempts to get rid of the message.

Comment 6 Jan Synacek 2016-11-23 08:02:42 UTC
It looks like the pid file is there, but no pid has been written in it when systemd tries to read it. Does this happen only once on boot? Or every time that you start/restart iscsid?

Comment 7 John Pittman 2016-11-23 20:40:41 UTC
It happens every time.  I've been able to reproduce at boot, with 'systemctl restart iscsid' and 'systemctl stop iscsid ; systemctl start iscsid'.

Comment 8 Jan Synacek 2016-11-24 12:08:07 UTC
I managed to reproduce this in my VM. Excerpt from the debug log (with my comments marked):

Nov 24 12:47:54 rhel7-virt systemd[1]: About to execute: /usr/sbin/iscsid
Nov 24 12:47:54 rhel7-virt systemd[1]: Forked /usr/sbin/iscsid as 1272
Nov 24 12:47:54 rhel7-virt systemd[1]: iscsid.service changed dead -> start
Nov 24 12:47:54 rhel7-virt systemd[1]: Starting Open-iSCSI...
Nov 24 12:47:54 rhel7-virt systemd[1272]: Executing: /usr/sbin/iscsid
Nov 24 12:47:54 rhel7-virt iscsid[1272]: iSCSI logger with pid=1276 started!
Nov 24 12:47:54 rhel7-virt iscsid[1276]: iSCSI daemon with pid=1277 started!
Nov 24 12:47:54 rhel7-virt systemd[1]: Sent message type=signal sender=n/a destination=n/a object=/org/freedesktop/systemd1/unit/iscsid_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=82 reply_cookie=0 error=n/a
Nov 24 12:47:54 rhel7-virt systemd-logind[748]: Got message type=signal sender=:1.0 destination=n/a object=/org/freedesktop/systemd1/unit/iscsid_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=82 reply_cookie=0 error=n/a
Nov 24 12:47:54 rhel7-virt systemd[1]: Sent message type=signal sender=n/a destination=n/a object=/org/freedesktop/systemd1/unit/iscsid_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=83 reply_cookie=0 error=n/a
Nov 24 12:47:54 rhel7-virt systemd-logind[748]: Got message type=signal sender=:1.0 destination=n/a object=/org/freedesktop/systemd1/unit/iscsid_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=83 reply_cookie=0 error=n/a
Nov 24 12:47:54 rhel7-virt systemd[1]: Received SIGCHLD from PID 1272 (iscsid).
Nov 24 12:47:54 rhel7-virt systemd[1]: Child 1272 (iscsid) died (code=exited, status=0/SUCCESS)
Nov 24 12:47:54 rhel7-virt systemd[1]: Child 1272 belongs to iscsid.service
Nov 24 12:47:54 rhel7-virt systemd[1]: iscsid.service: control process exited, code=exited status=0
Nov 24 12:47:54 rhel7-virt systemd[1]: iscsid.service got final SIGCHLD for state start

                                       ^^^^ systemd realizes that it got the final SIGCHLD, but the PID file hasn't been written yet (by iscsid).

Nov 24 12:47:54 rhel7-virt systemd[1]: Failed to read PID from file /var/run/iscsid.pid: Invalid argument
Nov 24 12:47:54 rhel7-virt systemd[1]: Setting watch for iscsid.service's PID file /var/run/iscsid.pid

                                       ^^^^ systemd starts watching for the soon-to-be PID file...

Nov 24 12:47:54 rhel7-virt systemd[1]: Trying to read iscsid.service's PID file /var/run/iscsid.pid in case it changed
Nov 24 12:47:54 rhel7-virt systemd[1]: Sent message type=signal sender=n/a destination=n/a object=/org/freedesktop/systemd1/unit/iscsid_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=95 reply_cookie=0 error=n/a
Nov 24 12:47:54 rhel7-virt systemd-logind[748]: Got message type=signal sender=:1.0 destination=n/a object=/org/freedesktop/systemd1/unit/iscsid_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=95 reply_cookie=0 error=n/a
Nov 24 12:47:54 rhel7-virt systemd[1]: Sent message type=signal sender=n/a destination=n/a object=/org/freedesktop/systemd1/unit/iscsid_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=96 reply_cookie=0 error=n/a
Nov 24 12:47:54 rhel7-virt systemd-logind[748]: Got message type=signal sender=:1.0 destination=n/a object=/org/freedesktop/systemd1/unit/iscsid_2eservice interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=96 reply_cookie=0 error=n/a
Nov 24 12:47:54 rhel7-virt systemd[1]: inotify event for iscsid.service

                                       ^^^^ ...and it appears...

Nov 24 12:47:54 rhel7-virt systemd[1]: Main PID loaded: 1277
Nov 24 12:47:54 rhel7-virt systemd[1]: Stopping watch for iscsid.service's PID file /var/run/iscsid.pid

                                       ^^^^ ...and it is read, everything works as expected

Nov 24 12:47:54 rhel7-virt systemd[1]: iscsid.service changed start -> running
Nov 24 12:47:54 rhel7-virt systemd[1]: Job iscsid.service/start finished, result=done
Nov 24 12:47:54 rhel7-virt systemd[1]: Started Open-iSCSI.
Nov 24 12:47:54 rhel7-virt systemd[1]: iscsid.socket changed listening -> running

From now on, the service runs without any problems. I don't think that there are any problems with systemd with regards to this bug. If anything should be fixed, it's the iscsid - it should write the file earlier.

Comment 9 Adam Hunt 2017-01-31 21:22:24 UTC
Has any progress been made on this? If this is indeed a bug in iscsid, has anyone reported it upstream?

Comment 10 Alex Wang 2018-04-05 18:13:42 UTC
It's been over a year since the last update, any progress on this?

Comment 14 Filip Suba 2019-12-06 11:46:46 UTC
Verified with iscsi-initiator-utils-6.2.0.874-17.

Comment 16 errata-xmlrpc 2020-03-31 20:03:52 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/RHBA-2020:1124