在上一次 Debian Stretch 路由安全更新中,我遇到了一个问题。当尝试安装安全升级并随后升级时nginx
,我收到以下错误。
我尝试apt-get upgrade
再次运行,或者apt-get install
使用任何涉及的软件包,但似乎没有任何效果。
该怎么办?
$ apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
6 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up libnginx-mod-stream (1.10.2-2) ...
nginx: [alert] kill(1433, 1) failed (3: No such process)
dpkg: error processing package libnginx-mod-stream (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up libnginx-mod-http-echo (1.10.2-2) ...
nginx: [alert] kill(1433, 1) failed (3: No such process)
dpkg: error processing package libnginx-mod-http-echo (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx-full:
nginx-full depends on libnginx-mod-http-echo (= 1.10.2-2); however:
Package libnginx-mod-http-echo is not configured yet.
nginx-full depends on libnginx-mod-stream (= 1.10.2-2); however:
Package libnginx-mod-stream is not configured yet.
dpkg: error processing package nginx-full (--configure):
dependency problems - leaving unconfigured
Setting up libnginx-mod-http-upstream-fair (1.10.2-2) ...
nginx: [alert] kill(1433, 1) failed (3: No such process)
dpkg: error processing package libnginx-mod-http-upstream-fair (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up libnginx-mod-http-geoip (1.10.2-2) ...
nginx: [alert] kill(1433, 1) failed (3: No such process)
dpkg: error processing package libnginx-mod-http-geoip (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
nginx depends on nginx-full (<< 1.10.2-2.1~) | nginx-light (<< 1.10.2-2.1~) | nginx-extras (<< 1.10.2-2.1~); however:
Package nginx-full is not configured yet.
Package nginx-light is not installed.
Package nginx-extras is not installed.
nginx depends on nginx-full (>= 1.10.2-2) | nginx-light (>= 1.10.2-2) | nginx-extras (>= 1.10.2-2); however:
Package nginx-full is not configured yet.
Package nginx-light is not installed.
Package nginx-extras is not installed.
dpkg: error processing package nginx (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
libnginx-mod-stream
libnginx-mod-http-echo
nginx-full
libnginx-mod-http-upstream-fair
libnginx-mod-http-geoip
nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
最终,分析问题,并查看安装后脚本,确定了问题所在。安装/升级任何这些nginx
组件时,每一个软件包,请尝试重新启动nginx
并检查操作是否成功。
因此,在我们的更新操作中,我们必须monit
在执行维护安全更新/升级周期之前开始停止,以免它nginx
在apt-get upgrade
.
修复最终是按顺序进行的:
- 停止
monit
; (p)kill -9
对进程进行 anginx
(奇怪的是,停止似乎不再有效)- 做一个
service start nginx
- 最后再做
apt-get upgrade
一次。 - 最后,升级成功结束
service monit start
。
这次没有monit
碍事,upgrade
果然有效。
归根结底,我们的教训是修改我们的标准升级程序,并更改我们的 Ansible 剧本以monit
在安全更新过程之前停止或理想情况下暂停。