![Ubuntu 服务器:dpkg 返回错误代码(1)](https://linux22.com/image/1081189/Ubuntu%20%E6%9C%8D%E5%8A%A1%E5%99%A8%EF%BC%9Adpkg%20%E8%BF%94%E5%9B%9E%E9%94%99%E8%AF%AF%E4%BB%A3%E7%A0%81%EF%BC%881%EF%BC%89.png)
我以前也遇到过这个错误,但可以通过运行“sudo apt-get -f install”来解决它;然而,现在情况不再如此。我花了大约 4 个小时研究这个问题,非常感谢任何帮助!
终端输出:
当我尝试安装 unoconv 包时,一切都开始了:
patrick@SERVER01:~$ sudo apt-get install unoconv
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:
initramfs-tools : Depends: initramfs-tools-bin (< 0.99ubuntu13.1.1~) but 0.99ubuntu13.2 is to be installed
libapache2-mod-php5 : Depends: apache2-api-20120211
Depends: apache2 (>= 2.4)
Depends: php5-common (= 5.5.4+dfsg-1+debphp.org~precise+1) but 5.4.15-1~precise+1 is to be installed
linux-server : Depends: linux-headers-server (= 3.2.0.43.51) but 3.2.0.54.64 is to be installed
unoconv : Depends: python-uno but it is not going to be installed
Recommends: libreoffice-core but it is not going to be installed
Recommends: libreoffice-java-common but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
当我尝试安装 libreoffice-core 或 libreoffice-common 时,我得到以下输出:
patrick@SERVER01:~$ sudo apt-get install libreoffice-common
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:
initramfs-tools : Depends: initramfs-tools-bin (< 0.99ubuntu13.1.1~) but 0.99ubuntu13.2 is to be installed
libapache2-mod-php5 : Depends: apache2-api-20120211
Depends: apache2 (>= 2.4)
Depends: php5-common (= 5.5.4+dfsg-1+debphp.org~precise+1) but 5.4.15-1~precise+1 is to be installed
libreoffice-common : Depends: libreoffice-style-default or
libreoffice-style
Depends: ure but it is not going to be installed
Recommends: xfonts-mathml but it is not going to be installed
Recommends: libexttextcat-data but it is not going to be installed
linux-server : Depends: linux-headers-server (= 3.2.0.43.51) but 3.2.0.54.64 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
我注意到提到了服务器的内核,我将在本文末尾返回一些输出。
这是我运行 apt-get -f install 时的输出
patrick@SERVER01:~$ sudo 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:
linux-image-3.2.0-40-generic linux-image-3.2.0-39-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
apache2 apache2-bin apache2-data apache2-mpm-itk initramfs-tools libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libgd3 libjson-c2 liblua5.1-0
libvpx1 linux-image-3.2.0-54-generic linux-image-server linux-server php5-cgi php5-cli php5-common php5-curl php5-gd php5-json php5-mcrypt
php5-mysql
Suggested packages:
apache2-doc apache2-suexec-pristine apache2-suexec-custom libgd-tools fdutils linux-doc-3.2.0 linux-source-3.2.0 linux-tools php-pear
php5-user-cache
Recommended packages:
php5-readline
The following packages will be REMOVED:
apache2.2-bin apache2.2-common
The following NEW packages will be installed:
apache2-bin apache2-data libgd3 libjson-c2 liblua5.1-0 libvpx1 linux-image-3.2.0-54-generic php5-json
The following packages will be upgraded:
apache2 apache2-mpm-itk initramfs-tools libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap linux-image-server linux-server php5-cgi php5-cli
php5-common php5-curl php5-gd php5-mcrypt php5-mysql
15 upgraded, 8 newly installed, 2 to remove and 110 not upgraded.
37 not fully installed or removed.
Need to get 0 B/49.2 MB of archives.
After this operation, 153 MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
dpkg: apache2.2-common: dependency problems, but removing anyway as you requested:
apache2-mpm-itk depends on apache2.2-common (= 2.2.22-1ubuntu1.3).
apache2 depends on apache2.2-common (= 2.2.22-1ubuntu1.3); however:
Package apache2.2-common is to be removed.
(Reading database ... 122179 files and directories currently installed.)
Removing apache2.2-common ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Processing triggers for ufw ...
(Reading database ... 121861 files and directories currently installed.)
Preparing to replace apache2 2.2.22-1ubuntu1.3 (using .../apache2_2.4.6-3+debphp.org~precise+1_amd64.deb) ...
Moving obsolete conffile /etc/apache2/mods-available/authz_default.load out of the way...
Moving obsolete conffile /etc/apache2/mods-available/authn_default.load out of the way...
Moving obsolete conffile /etc/apache2/mods-available/mem_cache.load out of the way...
Moving obsolete conffile /etc/apache2/mods-available/mem_cache.conf out of the way...
Moving obsolete conffile /etc/apache2/mods-available/authn_alias.load out of the way...
Moving obsolete conffile /etc/apache2/mods-available/cern_meta.load out of the way...
Moving obsolete conffile /etc/apache2/mods-available/disk_cache.load out of the way...
Moving obsolete conffile /etc/apache2/mods-available/disk_cache.conf out of the way...
Moving obsolete conffile /etc/apache2/mods-available/ident.load out of the way...
Moving obsolete conffile /etc/apache2/mods-available/imagemap.load out of the way...
Moving obsolete conffile /etc/apache2/mods-available/version.load out of the way...
Unpacking replacement apache2 ...
Preparing to replace apache2-mpm-itk 2.2.22-1ubuntu1.3 (using .../apache2-mpm-itk_2.4.6-3+debphp.org~precise+1_amd64.deb) ...
* Stopping web server apache2
* The apache2 configtest failed, so we are trying to kill it manually. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!
... waiting [ OK ]
Unpacking replacement apache2-mpm-itk ...
Selecting previously unselected package apache2-data.
Unpacking apache2-data (from .../apache2-data_2.4.6-3+debphp.org~precise+1_all.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
(Reading database ... 122245 files and directories currently installed.)
Removing apache2.2-bin ...
(Reading database ... 122164 files and directories currently installed.)
Preparing to replace libaprutil1-ldap 1.3.12+dfsg-3 (using .../libaprutil1-ldap_1.5.2-1~precise+1_amd64.deb) ...
Unpacking replacement libaprutil1-ldap ...
Preparing to replace libaprutil1-dbd-sqlite3 1.3.12+dfsg-3 (using .../libaprutil1-dbd-sqlite3_1.5.2-1~precise+1_amd64.deb) ...
Unpacking replacement libaprutil1-dbd-sqlite3 ...
Preparing to replace libaprutil1 1.3.12+dfsg-3 (using .../libaprutil1_1.5.2-1~precise+1_amd64.deb) ...
Unpacking replacement libaprutil1 ...
Selecting previously unselected package liblua5.1-0.
Unpacking liblua5.1-0 (from .../liblua5.1-0_5.1.4-12ubuntu1_amd64.deb) ...
Selecting previously unselected package apache2-bin.
Unpacking apache2-bin (from .../apache2-bin_2.4.6-3+debphp.org~precise+1_amd64.deb) ...
Preparing to replace php5-mysql 5.4.15-1~precise+1 (using .../php5-mysql_5.5.4+dfsg-1+debphp.org~precise+1_amd64.deb) ...
Unpacking replacement php5-mysql ...
Preparing to replace php5-cli 5.4.15-1~precise+1 (using .../php5-cli_5.5.4+dfsg-1+debphp.org~precise+1_amd64.deb) ...
Unpacking replacement php5-cli ...
Preparing to replace php5-mcrypt 5.4.15-1~precise+1 (using .../php5-mcrypt_5.5.4+dfsg-1+debphp.org~precise+1_amd64.deb) ...
Unpacking replacement php5-mcrypt ...
Preparing to replace php5-curl 5.4.15-1~precise+1 (using .../php5-curl_5.5.4+dfsg-1+debphp.org~precise+1_amd64.deb) ...
Unpacking replacement php5-curl ...
Selecting previously unselected package libvpx1.
Unpacking libvpx1 (from .../libvpx1_1.0.0-1_amd64.deb) ...
Selecting previously unselected package libgd3.
Unpacking libgd3 (from .../libgd3_2.1.0-2~precise+1_amd64.deb) ...
Preparing to replace php5-gd 5.4.15-1~precise+1 (using .../php5-gd_5.5.4+dfsg-1+debphp.org~precise+1_amd64.deb) ...
Unpacking replacement php5-gd ...
Preparing to replace php5-cgi 5.4.15-1~precise+1 (using .../php5-cgi_5.5.4+dfsg-1+debphp.org~precise+1_amd64.deb) ...
Moving obsolete conffile /etc/apache2/mods-available/php5_cgi.load out of the way...
Unpacking replacement php5-cgi ...
Selecting previously unselected package libjson-c2.
Unpacking libjson-c2 (from .../libjson-c2_0.11-3+debphp.org~precise+1_amd64.deb) ...
Preparing to replace php5-common 5.4.15-1~precise+1 (using .../php5-common_5.5.4+dfsg-1+debphp.org~precise+1_amd64.deb) ...
Unpacking replacement php5-common ...
dpkg: warning: unable to delete old directory '/etc/php5/conf.d': Directory not empty
Selecting previously unselected package php5-json.
Unpacking php5-json (from .../php5-json_1.3.1+dfsg-4+debphp.org~precise+1_amd64.deb) ...
Unpacking linux-image-3.2.0-54-generic (from .../linux-image-3.2.0-54-generic_3.2.0-54.82_amd64.deb) ...
Done.
dpkg: error processing /var/cache/apt/archives/linux-image-3.2.0-54-generic_3.2.0-54.82_amd64.deb (--unpack):
failed in write on buffer copy for backend dpkg-deb during `./boot/vmlinuz-3.2.0-54-generic': No space left on device
No apport report written because the error message indicates a disk full error
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-54-generic /boot/vmlinuz-3.2.0-54-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-54-generic /boot/vmlinuz-3.2.0-54-generic
Processing triggers for man-db ...
Errors were encountered while processing:
/var/cache/apt/archives/linux-image-3.2.0-54-generic_3.2.0-54.82_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
内核信息:
patrick@SERVER01:~$ dpkg --list | grep "linux-*"
ii libselinux1 2.1.0-4.1ubuntu1 SELinux runtime shared libraries
ii linux-firmware 1.79.6 Firmware for Linux kernel drivers
ii linux-headers-3.2.0-53 3.2.0-53.81 Header files related to Linux kernel version 3.2.0
ii linux-headers-3.2.0-53-generic 3.2.0-53.81 Linux kernel headers for version 3.2.0 on 64 bit x86 SMP
ii linux-headers-3.2.0-54 3.2.0-54.82 Header files related to Linux kernel version 3.2.0
ii linux-headers-3.2.0-54-generic 3.2.0-54.82 Linux kernel headers for version 3.2.0 on 64 bit x86 SMP
ii linux-headers-server 3.2.0.54.64 Linux kernel headers on Server Equipment.
ii linux-image-3.2.0-23-generic 3.2.0-23.36 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii linux-image-3.2.0-29-generic 3.2.0-29.46 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii linux-image-3.2.0-32-generic 3.2.0-32.51 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii linux-image-3.2.0-33-generic 3.2.0-33.52 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii linux-image-3.2.0-34-generic 3.2.0-34.53 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii linux-image-3.2.0-38-generic 3.2.0-38.61 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii linux-image-3.2.0-39-generic 3.2.0-39.62 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii linux-image-3.2.0-40-generic 3.2.0-40.64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii linux-image-3.2.0-41-generic 3.2.0-41.66 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
iF linux-image-3.2.0-43-generic 3.2.0-43.68 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
iF linux-image-3.2.0-44-generic 3.2.0-44.69 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
iU linux-image-server 3.2.0.43.51 Linux kernel image on Server Equipment.
iU linux-libc-dev 3.2.0-54.82 Linux Kernel Headers for development
iU linux-server 3.2.0.43.51 Complete Linux kernel on Server Equipment.
ii util-linux 2.20.1-1ubuntu3 Miscellaneous system utilities
非常感谢大家的帮助!我是一名边学边读的高中生 :)