时间:2017年10月
关键字:debian、apacheds、安装、失败、删除
安装失败
Debian 9,通过apt安装ApacheDS,出错如下:
root@debian:~# apt-get install apacheds
...
Failed to start apacheds.service: Unit apacheds.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status apacheds.service' for details.
invoke-rc.d: initscript apacheds, action "start" failed.
● apacheds.service - Apache Directory Server
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
Oct 28 08:41:44 c1037u systemd[1]: [/lib/systemd/system/apacheds.service:11] Executable path is not absolute, ignoring: ${JAVA_HOME}/bin/java ${JAVA_OPTS} -Dapacheds.controls=${ADS_CONTROLS} -Dapacheds.extendedOperations=${ADS_EXTENDED_OPERATIONS} -Dlog4j.configuration=file:${ADS_INSTANCES}/${ADS_INSTANCE}/conf/log4j.properties -Dapacheds.log.dir=${ADS_INSTANCES}/${ADS_INSTANCE}/log -cp '${ADS_HOME}/lib/*' org.apache.directory.server.UberjarMain ${ADS_INSTANCES}/${ADS_INSTANCE}/
...
root@debian:~#
无法删除
进行删除,但失败,如下:
root@debian:~# apt-get remove apacheds Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: ant ant-optional junit4 libantlr-java libapache-directory-api-java libapache-directory-jdbm-java libapacheds-i18n-java libapacheds-java libapacheds-kerberos-codec-java libbcprov-java libcommons-collections3-java libcommons-io-java libcommons-lang-java libcommons-pool-java libdom4j-java libehcache-java libhamcrest-java libisorelax-java libjaxen-java libjdom1-java libjetty9-java libmavibot-java libmina2-java libmsv-java librelaxng-datatype-java libxom-java libxpp2-java libxpp3-java Use 'apt autoremove' to remove them. The following packages will be REMOVED: apacheds 0 upgraded, 0 newly installed, 1 to remove and 76 not upgraded. 1 not fully installed or removed. After this operation, 172 kB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 118924 files and directories currently installed.) Removing apacheds (2.0.0~M15-4) ... Failed to stop apacheds.service: Unit apacheds.service not loaded. invoke-rc.d: initscript apacheds, action "stop" failed. dpkg: error processing package apacheds (--remove): subprocess installed pre-removal script returned error exit status 5 Errors were encountered while processing: apacheds E: Sub-process /usr/bin/dpkg returned an error code (1) root@debian:~#
解决方法
根据提示判断是ExecStart有问题,于是屏蔽问题ExecStart,重新删除:
root@debian:~# vim /lib/systemd/system/apacheds.service
[Unit]
Description=Apache Directory Server
After=network.target
ConditionPathExists=/etc/apacheds/config.ldif
[Service]
Type=simple
User=apacheds
Group=apacheds
EnvironmentFile=/etc/default/apacheds
ExecStart=/bin/true
#ExecStart=${JAVA_HOME}/bin/java ${JAVA_OPTS} \
# -Dapacheds.controls=${ADS_CONTROLS} \
# -Dapacheds.extendedOperations=${ADS_EXTENDED_OPERATIONS} \
# -Dlog4j.configuration=file:${ADS_INSTANCES}/${ADS_INSTANCE}/conf/log4j.properties \
# -Dapacheds.log.dir=${ADS_INSTANCES}/${ADS_INSTANCE}/log \
# -cp '${ADS_HOME}/lib/*' \
# org.apache.directory.server.UberjarMain \
# ${ADS_INSTANCES}/${ADS_INSTANCE}/
PrivateTmp=true
[Install]
WantedBy=multi-user.target
root@debian:~# apt-get remove --purge apacheds
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
ant ant-optional junit4 libantlr-java libapache-directory-api-java libapache-directory-jdbm-java libapacheds-i18n-java
libapacheds-java libapacheds-kerberos-codec-java libbcprov-java libcommons-collections3-java libcommons-io-java
libcommons-lang-java libcommons-pool-java libdom4j-java libehcache-java libhamcrest-java libisorelax-java libjaxen-java
libjdom1-java libjetty9-java libmavibot-java libmina2-java libmsv-java librelaxng-datatype-java libxom-java libxpp2-java
libxpp3-java
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
apacheds*
0 upgraded, 0 newly installed, 1 to remove and 76 not upgraded.
1 not fully installed or removed.
After this operation, 172 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 118924 files and directories currently installed.)
Removing apacheds (2.0.0~M15-4) ...
(Reading database ... 118839 files and directories currently installed.)
Purging configuration files for apacheds (2.0.0~M15-4) ...
Processing triggers for systemd (232-25+deb9u1) ...
root@debian:~#
后记
也许是Debian9的ApacheDS安装包存在bug,没有深入研究,选择slapd代替。