slapd cannot get resinstalled or removed if the configuration files were lost
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
openldap (Ubuntu) |
Triaged
|
Low
|
Unassigned |
Bug Description
Binary package hint: slapd
The installation scripts for slapd force good system even in recovery modes.
In a moment of complete blackout, I dropped the configuration in /etc/ldap/slap.d/ with 'rm -r *' .
Usually it is possible to reinstall a package in order to get to a clean system state, but not with the slapd package.
I would expect the following:
If slapd is set for reinstallation, missing configuration files should not hinder the package manager to create the configuration files just as in a vanilla installation.
However, when I want to reinstall or remove slapd I get is:
somehow the package management identifies the package as "configuration pending".
it tries to reconfigure the package and fails because the files are missing.
The messages are as follows:
# apt-get install slapd --reinstall -f -m
1 Reading package lists...
2 Building dependency tree...
3 Reading state information...
4 0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
5 1 not fully installed or removed.
6 Need to get 0B/1519kB of archives.
7 After this operation, 0B of additional disk space will be used.
8 Do you want to continue [Y/n]? Preconfiguring packages ...
9 (Reading database ... 272567 files and directories currently installed.)
10 Preparing to replace slapd 2.4.15-1ubuntu3 (using .../slapd_
11 sed: can't read /etc/ldap/
12 invoke-rc.d: initscript slapd, action "stop" failed.
13 dpkg: warning - old pre-removal script returned error exit status 2
14 dpkg - trying script from the new package instead ...
15 sed: can't read /etc/ldap/
16 invoke-rc.d: initscript slapd, action "stop" failed.
17 dpkg: error processing /var/cache/
18 subprocess new pre-removal script returned error exit status 2
19 Backing up /etc/ldap/slapd.d/ in /var/backups/
20 grep: /etc/ldap/
21 sed: can't read /etc/ldap/
22 invoke-rc.d: initscript slapd, action "start" failed.
23 dpkg: error while cleaning up:
24 subprocess post-installation script returned error exit status 2
25 Errors were encountered while processing:
26 /var/cache/
E: Sub-process /usr/bin/dpkg returned an error code (1)
no surprisingly the old pre-removal script fails in line 11.
even less surprisingly the new pre-removal script fails in line 15.
This is the case because both scripts are the same.
BTW, the server stop fails because the server did not run in the first place.
The problem is that the script is not able to recognize that the configuration files are missing.
The correct solution would be to test for the configuration files in the pre-removal scripts and perform the operations only if the files are actually present. Otherwise it should just ignore the missing configuration and do only the pre-removal stuff that does not require the configuration.
Changed in openldap (Ubuntu): | |
status: | Incomplete → Triaged |
I found that the problem was related to the init script (/etc/init.d/slapd)
With the attached patch the problem disappears, because the script stops before the daemon tries to access the configuration.