每次我尝试运行升级时,都会出现以下错误。
root@Nixie:~# apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
nginx : Depends: nginx-core (< 1.4.6-1ubuntu3.3.1~) but 1.4.6-1ubuntu3.4 is installed or
nginx-full (< 1.4.6-1ubuntu3.3.1~) but it is not installed or
nginx-light (< 1.4.6-1ubuntu3.3.1~) but it is not installed or
nginx-extras (< 1.4.6-1ubuntu3.3.1~) but it is not installed or
nginx-naxsi (< 1.4.6-1ubuntu3.3.1~) but it is not installed
E: Unmet dependencies. Try using -f.
我跑apt-get -f install
root@Nixie:~# apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libxslt1.1 nginx-common nginx-core
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
nginx
The following packages will be upgraded:
nginx
1 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Need to get 0 B/402 kB of archives.
After this operation, 958 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 123867 files and directories currently installed.)
Preparing to unpack .../nginx_1.8.1-1~trusty_amd64.deb ...
Unpacking nginx (1.8.1-1~trusty) over (1.4.6-1ubuntu3.3) ...
dpkg: error processing archive /var/cache/apt/archives/nginx_1.8.1-1~trusty_amd64.deb (--unpack):
trying to overwrite '/usr/share/nginx/html/index.html', which is also in package nginx-common 1.4.6-1ubuntu3.4
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/nginx_1.8.1-1~trusty_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
首先,您应该删除旧的 nginx(1.4.x),然后安装新的。nginx 1.8.x 和 1.4.x 有一些不兼容性,所以您不能轻易地升级它。