ltb-project / openldap-deb

Debian packages for OpenLDAP
http://ltb-project.org/wiki/documentation/openldap-deb
GNU General Public License v3.0
14 stars 13 forks source link

Upgrading openldap-ltb package start the slapd service even if it was stopped #53

Closed sophieqc closed 3 years ago

sophieqc commented 3 years ago

Hello,

When debugging #52 I realized that the slapd service is automatically started even if it was stopped before

root@openldap:~# /usr/local/openldap/sbin/slapd-cli status
slapd-cli: [INFO] Using /usr/local/openldap/etc/openldap/slapd-cli.conf for configuration
slapd-cli: [INFO] LDAP Tool Box OpenLDAP init script version 2.5
slapd-cli: [INFO] Process OpenLDAP is not running
slapd-cli: [INFO] Detected suffix: dc=my-domain,dc=com
root@openldap:~# apt install openldap-ltb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libfreetype6
Use 'apt autoremove' to remove it.
Suggested packages:
  openldap-ltb-check-password openldap-ltb-contrib-overlays
The following packages will be upgraded:
  openldap-ltb
1 upgraded, 0 newly installed, 0 to remove and 28 not upgraded.
Need to get 1686 kB of archives.
After this operation, 23.6 kB of additional disk space will be used.
Get:1 https://ltb-project.org/debian/jessie jessie/main amd64 openldap-ltb amd64 2.4.51.1 [1686 kB]
Fetched 1686 kB in 0s (5898 kB/s) 
(Reading database ... 27987 files and directories currently installed.)
Preparing to unpack .../openldap-ltb_2.4.51.1_amd64.deb ...
Unpacking openldap-ltb (2.4.51.1) over (2.4.49.1) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
Processing triggers for systemd (229-4ubuntu21.29) ...
Setting up openldap-ltb (2.4.51.1) ...
Installing new version of config file /usr/local/openldap/etc/openldap/ldap.conf ...
slapd.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable slapd
root@openldap:~# /usr/local/openldap/sbin/slapd-cli status
slapd-cli: [INFO] Using /usr/local/openldap/etc/openldap/slapd-cli.conf for configuration
slapd-cli: [INFO] LDAP Tool Box OpenLDAP init script version 2.5
slapd-cli: [INFO] Process OpenLDAP is running (PID 2804)
slapd-cli: [INFO] Listening to services ldap://*:389 ldaps://*:636 ldapi://%2Fvar%2Frun%2Fslapd%2Fldapi
slapd-cli: [INFO] Process usage:  0.0% CPU /  0.0% MEM
slapd-cli: [INFO] Detected suffix: dc=my-domain,dc=com

Could It be possible to make the service stay as it was before the upgrade ? It would make errors like #52 a lot easier to debug and not leave the packages in a unconfigured state.

Thanks

davidcoutadeur commented 3 years ago

Hello,

This topic is not so easy to solve and needs investigation. If we fix it, we must fix it in RPM packages too. What's your opinion on this @coudot ?

davidcoutadeur commented 3 years ago

Furthermore, I like the principle of "fail fast".

If there is no restart, we don't know if the upgrade has worked. You may be in an incoherent state.

coudot commented 3 years ago

We do this in RPM: https://github.com/ltb-project/openldap-rpm/blob/master/SPECS/openldap-ltb.spec#L578

We get the slapd running status before the upgrade and restart it only if it was running before.

davidcoutadeur commented 3 years ago

Here is the behaviour expected:

For coding this behaviour, I had to revert the logic in RPM. Indeed:

davidcoutadeur commented 3 years ago

Fixed with last commit 15295d9

sophieqc commented 3 years ago

Thank you for the quick fix.