我发现很多投诉都针对不同的软件包,但都存在相同的错误。但是,我无法理解此错误的本质以及如何修复它。如果您对此有任何线索,请提供帮助。
当我尝试安装 rsyslog 时它首先出现。
# dpkg --configure -a
Setting up rsyslog (4.6.4-2) ...
insserv: warning: script 'K02ossec' missing LSB tags and overrides
insserv: warning: script 'K02drwebd' missing LSB tags and overrides
insserv: warning: script 'drwebd' missing LSB tags and overrides
insserv: script ctasd_initd: service Parallels already provided!
insserv: script ctasd_initd: service Premium already provided!
insserv: script ctasd_initd: service Outgoing already provided!
insserv: script ctasd_initd: service Antispam already provided!
insserv: warning: script 'ctmilter_initd' missing LSB tags and overrides
insserv: warning: script 'ossec' missing LSB tags and overrides
insserv: There is a loop between service munin-node and ctmilter_initd if stopped
insserv: loop involving service ctmilter_initd at depth 2
insserv: loop involving service munin-node at depth 1
insserv: Stopping ctmilter_initd depends on munin-node and therefore on system facility `$all' which can not be true!
insserv: exiting now without changing boot order!
update-rc.d: error: insserv rejected the script header
dpkg: error processing rsyslog (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
rsyslog
答案1
我猜问题在于缺少 insserv 的初始指令
/etc/init.d/rsyslog
因此在 /etc/init.d/rsyslog 中的 /bin/bash 指令后添加以下行
### BEGIN INIT INFO
# Provides: rsyslog
# Required-Start: $remote_fs $time
# Required-Stop: umountnfs $time
# X-Stop-After: sendsigs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: enhanced syslogd
# Description: Rsyslog is an enhanced multi-threaded syslogd.
# It is quite compatible to stock sysklogd and can be
# used as a drop-in replacement.
### END INIT INFO
进而
# dpkg --configure -a
答案2
环境:Docker 容器
Linux 发行版:Ubuntu 20.04 LTS
我也遇到了同样的错误,但是当我尝试安装Nagios 跨平台代理 (NCPA)在我的 Docker 容器环境中并执行我的自定义initialize.sh
bash 脚本时。有人能帮我解决我需要配置 /etc/init.d/ 中的哪些守护进程服务吗?以及我需要将其配置为哪种配置?
提前谢谢您!
我的 bash 脚本输出如下:
root@a132ae571fae:/var/scripts# apt-get -o DPkg::Options::=--force-confdef install -y ncpa
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
ncpa
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 10.7 MB of archives.
After this operation, 30.6 MB of additional disk space will be used.
Get:1 https://repo.nagios.com/deb/focal ncpa 2.4.0-1 [10.7 MB]
Fetched 10.7 MB in 2s (5990 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package ncpa.
(Reading database ... 29237 files and directories currently installed.)
Preparing to unpack .../ncpa_2.4.0-1_amd64.deb ...
Unpacking ncpa (2.4.0-1) ...
Setting up ncpa (2.4.0-1) ...
Configuration file '/usr/local/ncpa/etc/ncpa.cfg'
==> File on system created by you or by a script.
==> File also in package provided by package maintainer.
==> Keeping old config file as default.
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
dpkg: error processing package ncpa (--configure):
installed ncpa package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
Processing triggers for systemd (245.4-4ubuntu3.19) ...
Errors were encountered while processing:
ncpa
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@a132ae571fae:/etc/init.d# ls -lah
total 84K
drwxrwxr-x 1 root root 4.0K Jan 6 12:22 .
drwxr-xr-x 1 root root 4.0K Jan 6 12:22 ..
-rwxr-xr-x 1 root root 2.5K Feb 23 2021 apache-htcacheclean
-rwxr-xr-x 1 root root 8.0K Feb 23 2021 apache2
-rwxr-xr-x 1 root root 3.0K Feb 11 2020 cron
-rwxr-xr-x 1 root root 3.1K Sep 30 2019 dbus
-rwxr-xr-x 1 root root 3.8K Jul 28 2019 hwclock.sh
-rwxrwxr-x 1 root root 608 Jan 2 15:22 initialize.sh
-rwxr-xr-x 1 root root 6.9K Jan 6 12:07 nagios
-rwxr-xr-x 1 root root 1.6K Jan 6 12:22 ncpa_listener
-rwxr-xr-x 1 root root 1.5K Jan 6 12:22 ncpa_passive
-rwxr-xr-x 1 root root 1.6K Nov 27 2020 ntp
-rwxr-xr-x 1 root root 3.3K Aug 31 2021 postfix
-rwxr-xr-x 1 root root 924 Feb 13 2020 procps
-rwxr-xr-x 1 root root 2.8K Mar 7 2019 rsyslog
-rwxr-xr-x 1 root root 3.9K Mar 30 2022 ssh
-rwxr-xr-x 1 root root 2.1K Jan 21 2020 ufw
-rwxr-xr-x 1 root root 2.7K Jan 20 2017 x11-common
root@a132ae571fae:/var/scripts# ls -lah
total 24K
drwxr-xr-x 1 root root 4.0K Jan 6 12:16 .
drwxr-xr-x 1 root root 4.0K Jan 6 12:09 ..
-rwxrwxr-x 1 root root 806 Jan 6 12:16 initialize.sh
-rwxrwxr-x 1 root root 165 Jan 2 14:53 remove-nologin.sh
root@a132ae571fae:/var/scripts# nano initialize.sh
root@a132ae571fae:/var/scripts#
root@a132ae571fae:/var/scripts# cat initialize.sh
#!/bin/bash
INIT_FLAG="initialized.flag"
if [ ! -f "$INIT_FLAG" ]; then
## Ncpa install (repository and key already added in dockerfile)
apt-get update
export DEBIAN_FRONTEND=noninteractive
cd /tmp
dpkg -i dpkg_1.19.7ubuntu3.2_amd64.deb
apt-get update
apt-get install --reinstall dpkg
apt-get -o DPkg::Options::=--force-confdef install -y ncpa
## Set TimeZone to Europe/Amsterdam and Enable & Run Remove No-Login Service
timedatectl set-timezone Europe/Amsterdam
# systemctl start remove-nologin.service
# systemctl enable remove-nologin.service
#rm -rf /var/run/nologin
service apache2 start
service nagios start
service ncpa_listener start
service ncpa_passive start
echo "services are up and running!"
exit 1
else
touch $INIT_FLAG
echo "services have failed to load!"
exit 0
fi
我想要做的是使用我构建的自定义脚本来安装 NCPA。
并且因为我想保留特定的配置,以便它不会在默认的 ncpa 安装期间覆盖它,所以我没有使用标准的 apt-get 或 apt install ncpa 参数。
相反,我使用了:
apt-get -o DPkg::Options::=--force-confdef install -y ncpa
提前感谢你们的帮助!
亲切的问候,
多加