#48147 Unable to enable DS service for auto start
Closed: Fixed None Opened 4 years ago by edewata.

Currently the DS service cannot be enabled to start at boot time. The issue was found in 389-ds-base-1.3.3.9-1.fc21.x86_64.

To reproduce the problem, create a DS instance:

$ setup-ds.pl --silent --\
        General.FullMachineName=$HOSTNAME\
        General.SuiteSpotUserID=nobody\
        General.SuiteSpotGroup=nobody\
        slapd.ServerPort=389\
        slapd.ServerIdentifier=pki-tomcat\
        slapd.Suffix=dc=example,dc=com\
        slapd.RootDN="cn=Directory Manager"\
        slapd.RootDNPwd=Secret123
Your new DS instance 'pki-tomcat' was successfully created.
Exiting . . .
Log file is '/tmp/setup9tIzW_.log'

The DS service is started immediately:

$ systemctl status dirsrv@pki-tomcat.service
● dirsrv@pki-tomcat.service - 389 Directory Server pki-tomcat.
   Loaded: loaded (/usr/lib/systemd/system/dirsrv@.service; enabled)
   Active: active (running) since Sat 2015-04-11 15:00:56 EDT; 38s ago
  Process: 1099 ExecStart=/usr/sbin/ns-slapd -D /etc/dirsrv/slapd-%i -i /var/run/dirsrv/slapd-%i.pid -w /var/run/dirsrv/slapd-%i.startpid (code=exited, status=0/SUCCESS)
 Main PID: 1100 (ns-slapd)
   CGroup: /system.slice/system-dirsrv.slice/dirsrv@pki-tomcat.service
           └─1100 /usr/sbin/ns-slapd -D /etc/dirsrv/slapd-pki-tomcat -i /var/run/dirsrv/slapd-pki-tomcat.pid -w /var/run/dirsrv/slapd-pki-tomcat.startpid

Then enable the DS service as described in http://www.port389.org/docs/389ds/howto/howto-systemd.html#how-do-i-make-it-start-at-boot-time:

$ systemctl enable dirsrv@pki-tomcat.service
The unit files have no [Install] section. They are not meant to be enabled
using systemctl.
Possible reasons for having this kind of units are:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).

After rebooting the machine, the DS service is not running:

$ systemctl status dirsrv@pki-tomcat.service
● dirsrv@pki-tomcat.service - 389 Directory Server pki-tomcat.
   Loaded: loaded (/usr/lib/systemd/system/dirsrv@.service; static)
   Active: inactive (dead)

The 'systemctl enable' command should not generate an error and the DS service should have started automatically after reboot.

The auto start is needed by standalone Dogtag (without IPA) with DS running on the same machine to ensure that it can auto start after reboot:
https://fedorahosted.org/pki/ticket/1315


I believe that this issue has been resolved for Dogtag 10.2.3 (see [https://fedorahosted.org/pki/ticket/1315 PKI TRAC Ticket #1315 - pki-tomcatd fails to start on system boot]) with an explanation of why in [https://fedorahosted.org/pki/ticket/1315#comment:7 comment #7].

Replying to [comment:1 mharmsen]:

I believe that this issue has been resolved for Dogtag 10.2.3 (see [https://fedorahosted.org/pki/ticket/1315 PKI TRAC Ticket #1315 - pki-tomcatd fails to start on system boot]) with an explanation of why in [https://fedorahosted.org/pki/ticket/1315#comment:7 comment #7].

Hi Endi, Hi Matt,
If this is no longer an issue, can we close this ticket?

Is this supposed to be a valid command?

{{{
$ systemctl enable dirsrv@<instance>.service
}}}

If it is, the ticket is still valid. If it's not, the ticket should be changed to fix the documentation.

The correct way to enable this is:

{{{
systemctl enable dirsrv.target
}}}

If you look in /etc/systemd/system/dirsrv.target.wants you'll find all your instance .service files there, and then you enable dirsrv.target to start them.

I think that we should probably have an [Install] section to link our dirsrv@.services into dirsrv.target though.

{{{
[root@victoria]ds# systemctl disable dirsrv@localhost.service
Removed symlink /etc/systemd/system/dirsrv.target.wants/dirsrv@localhost.service.
[root@victoria]ds# systemctl enable dirsrv@localhost.service
Created symlink from /etc/systemd/system/dirsrv.target.wants/dirsrv@localhost.service to /usr/lib/systemd/system/dirsrv@.service.

[root@victoria]ds# systemctl disable dirsrv.target
Removed symlink /etc/systemd/system/multi-user.target.wants/dirsrv.target.
[root@victoria]ds# systemctl enable dirsrv.target
Created symlink from /etc/systemd/system/multi-user.target.wants/dirsrv.target to /usr/lib/systemd/system/dirsrv.target.
}}}

This patch should give you the behaviour you desire.

commit 522972eb30c5cfdc1add7b80d86af6feb50573a4

To ssh://git.fedorahosted.org/git/389/ds.git
63b8ece..4e39b5b master -> master

Metadata Update from @edewata:
- Issue assigned to firstyear
- Issue set to the milestone: 1.3.5 backlog

2 years ago

Login to comment on this ticket.

Metadata