如何解决dpkg依赖关系?


32
administrator@zlounes:~$ sudo apt-get dist-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:
 linux-server : Depends: linux-headers-server (= 3.2.0.37.44) but 3.2.0.37.45 is installed
E: Unmet dependencies. Try using -f.
administrator@zlounes:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  linux-image-server linux-server
The following packages will be upgraded:
  linux-image-server linux-server
2 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
4 not fully installed or removed.
Need to get 0 B/4,458 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Traceback (most recent call last):
  File "/usr/bin/apt-listchanges", line 237, in <module>
    main()
  File "/usr/bin/apt-listchanges", line 48, in main
    debs = apt_listchanges.read_apt_pipeline(config)
  File "/usr/share/apt-listchanges/apt_listchanges.py", line 83, in read_apt_pipeline
    return map(lambda pkg: filenames[pkg], order)
  File "/usr/share/apt-listchanges/apt_listchanges.py", line 83, in <lambda>
    return map(lambda pkg: filenames[pkg], order)
KeyError: 'linux-image-server'
Setting up initramfs-tools (0.99ubuntu13.1) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-image-3.2.0-37-generic (3.2.0-37.58) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
The link /initrd.img is a dangling linkto /boot/initrd.img-3.2.0-37-generic
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.2.0-37-generic /boot/vmlinuz-3.2.0-37-generic
update-initramfs: Generating /boot/initrd.img-3.2.0-37-generic

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.2.0-37-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.2.0-37-generic.postinst line 1010.
dpkg: error processing linux-image-3.2.0-37-generic (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of linux-image-server:
 linux-image-server depends on linux-image-3.2.0-37-generic; however:
  Package linux-image-3.2.0-37-generic is not configured yet.
dpkg: error processing linux-image-server (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-server:
 linux-server depends on linux-image-server (= 3.2.0.37.44); however:
  Package linux-image-server is not configured yet.
 linux-server depends on linux-headers-server (= 3.2.0.37.44); however:
  Version of linux-headers-server on system is 3.2.0.37.45.
dpkg: error processing linux-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.2.0-36-generic
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          No apport report written because the error message indicates its a followup error from a previous failure.

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.2.0-36-generic with 1.
dpkg: error processing initramfs-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-image-3.2.0-37-generic
 linux-image-server
 linux-server
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

我已经尝试了很多,但无法正常工作。我想我打断了安装过程,但一切都搞砸了。我已经用Google搜索并尝试了各种修复程序。

编辑(清理我的/ boot文件夹后):

administrator@zlounes:/boot$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  linux-server
The following packages will be upgraded:
  linux-server
1 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1,734 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Traceback (most recent call last):
  File "/usr/bin/apt-listchanges", line 237, in <module>
    main()
  File "/usr/bin/apt-listchanges", line 48, in main
    debs = apt_listchanges.read_apt_pipeline(config)
  File "/usr/share/apt-listchanges/apt_listchanges.py", line 83, in read_apt_pipeline
    return map(lambda pkg: filenames[pkg], order)
  File "/usr/share/apt-listchanges/apt_listchanges.py", line 83, in <lambda>
    return map(lambda pkg: filenames[pkg], order)
KeyError: 'linux-server'
dpkg: dependency problems prevent configuration of linux-server:
 linux-server depends on linux-image-server (= 3.2.0.37.44); however:
  Version of linux-image-server on system is 3.2.0.37.45.
 linux-server depends on linux-headers-server (= 3.2.0.37.44); however:
  Version of linux-headers-server on system is 3.2.0.37.45.
dpkg: error processing linux-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          E: Sub-process /usr/bin/dpkg returned an error code (1)
administrator@zlounes:/boot$

1
为什么在错误状态下您会认为程序包依赖项有问题gzip: stdout: No space left on device?在我看来,未安装依赖项是因为您缺少安装软件的空间。
Rinzwind

请添加的结果df。我猜您的/boot分区已满。
Rinzwind

谢谢 :)。我已经清理了/ boot文件夹,但是又遇到了同样的错误(我用代码错误编辑了我的第一篇文章),在此先感谢您,并感谢我的英语不好
zlounes

“清理我的启动文件夹”是指您删除了该文件夹中的文件吗?您可能不喜欢这样做的结果。
杰克

不,很好,我已选择文件;)
zlounes

Answers:


65

要确保您的系统状态良好并且不会因中止安装而出现问题,一个很好的尝试是调用

  dpkg --configure -a 

确保软件包列表已更新,并且在以下位置未显示任何问题:

 apt-get update

可选,您可以在更新之前删除所有旧数据,方法是:

 find /var/lib/apt/lists -type f  |xargs rm -f >/dev/null \

解决该问题的下一步是暂时删除linux-server软件包。之所以可以这样做是因为它没有实际内容,只引入了一个依赖项:

该软件包将始终依赖于可用于服务器设备的最新完整Linux内核。

 dpkg --remove linux-server

完成此步骤后,检查是否已安装所有当前依赖项:

apt-get install -f

如果一切正常,您现在可以再次安装linux-server

apt-get install linux-server

后记

linux-server12.04中已弃用。同样对于服务器设备,使用通用内核。看到apt-cache show linux-image-server

包:linux-image-server ...

部分:元包

....

取决于:linux-image-3.2.0-23- generic,linux-firmware


非常感谢你。我以为我会花一天重新安装服务器..
uncletall

8

我经常不得不清理机器的/ boot,通常太满了会破坏更新-不确定最终的解决方案是什么,但是我使用的过程似乎有效:

从一个开始 sudo su

然后转到/ boot并执行ls -lSrh-底部的那些是最大的- rm足够大的旧版可以清理足够的空间。

然后尝试以下操作(从上面摘录):

  1. sudo apt-get remove linux-server
  2. dpkg --configure -a
  3. apt-get update
  4. apt-get install -f
  5. apt-get autoremove
  6. dpkg --get-selections|grep 'linux-image*'|awk '{print $1}'|egrep -v "linux-image-$(uname -r)|linux-image-generic" |while read n;done
  7. apt-get install linux-image-server linux-server
  8. reboot

如果失败,请在此处发表评论,我将看看可能是什么问题。

当使用pitti PPA时,我已经看到这种事情适用于postgresql-9.1软件包问题。

有一次,我运行该程序时遇到grub问题。做一个apt-get install --reinstall grub固定的。

感谢您的一班班轮:http : //ubuntuforums.org/showpost.php?p=12180959&postcount=7

祝好运!


步骤6似乎已被切断:dpkg --get-selections | grep'linux-image *'| awk'{print $ 1}'| egrep -v“ linux-image-$(uname -r)| linux-image -generic” |一边读n,一边去apt-get -y删除$ n;完成
Tom

0

gzip:stdout:设备上没有剩余空间

看来您空间不足。清理一些空间并通过以下方法解决软件包问题:

sudo apt-get purge
sudo apt-get clean
sudo apt-get check
sudo apt-get install -f
sudo dpkg --configure -a 

然后再次重新安装软件包。

来源:线程:Dpkg:依赖关系问题-未配置

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.