Operating System: Debian GNU/Linux 8.8 (jessie)
Kernel: Linux 3.16.0-4-amd64
Architecture: x86-64
我有几台 Debian 服务器。
每个都包含在默认存储库nginx
版本 1.6 中。
从原始nginx
存储库更新后,在所有服务器上收到相同的错误:
Preparing to unpack .../nginx_1.12.0-1~jessie_amd64.deb ...
Unpacking nginx (1.12.0-1~jessie) over (1.6.2-5+deb8u4) ...
dpkg: error processing archive /var/cache/apt/archives/nginx_1.12.0-1~jessie_amd64.deb (--unpack):
trying to overwrite '/etc/default/nginx', which is also in package nginx-common 1.6.2-5+deb8u4
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/nginx_1.12.0-1~jessie_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我尝试deb
从源代码构建包,但仍然遇到相同的错误。
如果不将 Debian 重新安装到更新版本,我找不到任何升级它的方法。
/var/log/dpkg.log
:
2017-06-26 19:56:31 startup archives install
2017-06-26 19:56:31 upgrade nginx:all 1.6.2-5+deb8u4 1.12.0-1~jessie
2017-06-26 19:56:31 status half-configured nginx:all 1.6.2-5+deb8u4
2017-06-26 19:56:31 status unpacked nginx:all 1.6.2-5+deb8u4
2017-06-26 19:56:31 status half-installed nginx:all 1.6.2-5+deb8u4
2017-06-26 19:56:32 status unpacked nginx:all 1.6.2-5+deb8u4
2017-06-26 19:56:32 status installed nginx:all 1.6.2-5+deb8u4
我尝试完全卸载/清除默认设置nginx
并安装更新版本,但仍然出现错误。
The following packages have been kept back:
libpcre3 libpcre3-dev nginx nginx-common nginx-full
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
答案1
成为root:
sudo -i
或者:
su
2017-06-26 19:56:31 status half-configured nginx:all 1.6.2-5+deb8u4
配置包:
dpkg --configure -a
修复损坏的包:
apt-get install --fix-broken
继续升级:
apt-get dist-upgrade
答案2
很难说出您在清除+重新安装时尝试了什么,但请尝试以下操作:
sudo dpkg --purge --force-all nginx nginx-common nginx-full
sudo apt-get install nginx