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 2179278 - dirsrv failed to start after reboot because "dirsrv" did not have access on /run/dirsrv
Summary: dirsrv failed to start after reboot because "dirsrv" did not have access on ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: 389-ds-base
Version: 9.1
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: 9.3
Assignee: LDAP Maintainers
QA Contact: LDAP QA Team
Evgenia Martynyuk
URL:
Whiteboard: sync-to-jira
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-17 07:53 UTC by Ding-Yi Chen
Modified: 2023-11-07 09:08 UTC (History)
5 users (show)

Fixed In Version: 389-ds-base-2.3.6-2.el9
Doc Type: Bug Fix
Doc Text:
.The `dirsrv` service now starts correctly after reboot Previously, `dirsrv` service could fail to start after reboot because `dirsrv` service did not explicitly wait for `systemd-tmpfiles-setup.service` to finish. This led to a race condition. With this update, `dirsrv` service waits for the `systemd-tmpfiles-setup.service` to finish and no longer fail to start after reboot.
Clone Of:
Environment:
Last Closed: 2023-11-07 08:25:18 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker IDMDS-2991 0 None None None 2023-05-03 15:36:03 UTC
Red Hat Issue Tracker IDMDS-3559 0 None None None 2023-08-14 08:03:35 UTC
Red Hat Issue Tracker RHELPLAN-152161 0 None None None 2023-03-17 07:54:15 UTC
Red Hat Product Errata RHBA-2023:6350 0 None None None 2023-11-07 08:25:43 UTC

Description Ding-Yi Chen 2023-03-17 07:53:43 UTC
Description of problem:

After reboot, dirsrv failed to start because /run/dirsrv is not create yet.

~~~
Mar 17 14:58:39 dchen ns-slapd[1994]: [17/Mar/2023:14:58:39.117785245 +1000] - EMERG - main - Unable to access nsslapd-rundir: No such file or directory
Mar 17 14:58:39 dchen ns-slapd[1994]: [17/Mar/2023:14:58:39.127244140 +1000] - EMERG - main - Ensure that user "dirsrv" has read and write permissions on /run/dirsrv
Mar 17 14:58:39 dchen ns-slapd[1994]: [17/Mar/2023:14:58:39.136663531 +1000] - EMERG - main - Shutting down.
Mar 17 14:58:39 dchen journal[2066]: Skipping parental controls support as it’s disabled
Mar 17 14:58:39 dchen systemd[1]: dirsrv: Main process exited, code=exited, status=1/FAILURE
Mar 17 14:58:39 dchen systemd[1]: dirsrv: Failed with result 'exit-code'.
Mar 17 14:58:39 dchen systemd[1]: Failed to start 389 Directory Server EXAMPLE-COM..
Mar 17 14:58:39 dchen ipactl[1686]: Failed to start Directory Service: CalledProcessError(Command ['/bin/systemctl', 'start', 'dirsrv'] returned non-zero exit status 1)
~~~

This is because /run mounted as tmpfs, thus it is possible no dirsrv/ under it
~~~
# mount  | grep /run
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,size=13107724k,nr_inodes=819200,mode=755,inode64)
~~~


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

389-ds-base-2.1.3-4.el9_1.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Install RH IdM
2. ensure 'nsslapd-rundir: /run/dirsrv' in dse.ldif
3. ensure /run is mounted as tmpfs
4. reboot

Actual results:

Following error message shown:

EMERG - main - Ensure that user "dirsrv" has read and write permissions on /run/dirsrv

Expected results:

389ds create the /run/dirsrv with correct owner and file mod

Additional info:

IPA service that also suffer similar symptom: ipa, named, samba

Workaround:

1. create the directory before 389ds-start, like:
  mkdir -p dirsrv
  chmod -v 770 dirsrv
  chown -v dirsrv:dirsrv dirsrv
  mkdir -p lock/dirsrv/slapd-CHEN-HOME
  chmod -vR 770 lock/dirsrv
  chown -vR dirsrv:dirsrv lock/dirsrv

2. Service systemd-tmpfiles-setup also create the required directories.  

- service ipa, name

Comment 1 Viktor Ashirov 2023-07-14 10:52:21 UTC
I believe there is a race condition when dirsrv tries to start before systemd-tmpfiles-setup. I couldn't reproduce it myself, but this is not the first time this issue gets reported.

Perhaps we should explicitly require it in our unit file, like so:
After=systemd-tmpfiles-setup.service

Comment 2 Viktor Ashirov 2023-07-26 17:13:40 UTC
https://github.com/389ds/389-ds-base/pull/5865

Comment 6 Viktor Ashirov 2023-08-14 15:59:32 UTC
Build tested: 389-ds-base-2.3.6-2.el9.x86_64

# systemctl cat dirsrv@localhost | grep tmpfiles
After=chronyd.service ntpd.service network-online.target systemd-tmpfiles-setup.service
Wants=systemd-tmpfiles-setup.service

# systemctl list-dependencies dirsrv@localhost | grep tmpfiles
● ├─systemd-tmpfiles-setup.service
●   ├─systemd-tmpfiles-setup-dev.service
●   ├─systemd-tmpfiles-setup.service

Marking as Verified:Tested, SanityOnly.

Comment 11 errata-xmlrpc 2023-11-07 08:25:18 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 (389-ds-base 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:6350


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