当我sudo apt-get upgrade
在 Debian Squeeze 安装上运行时,出现以下错误:
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
libxml2-dev : Depends: libxml2 (= 2.7.8.dfsg-2+squeeze3) but 2.7.8.dfsg-2+squeeze5 is installed
E: Unmet dependencies. Try using -f.
我不确定“squeeze3”与“squeeze5”的含义,但这是 libxml2 包中唯一不同的地方。
当我尝试“sudo apt-get install -f”时,我得到:
The following extra packages will be installed:
libxml2-dev
The following packages will be upgraded:
libxml2-dev
1 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
108 not fully installed or removed.
Need to get 0 B/830 kB of archives.
After this operation, 69.6 kB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 96842 files and directories currently installed.)
Preparing to replace libxml2-dev 2.7.8.dfsg-2+squeeze3 (using .../libxml2-dev_2.7.8.dfsg-2+squeeze5_amd64.deb) ...
Unpacking replacement libxml2-dev ...
dpkg: error processing /var/cache/apt/archives/libxml2-dev_2.7.8.dfsg-2+squeeze5_amd64.deb (--unpack):
unable to install new version of `./usr/include/libxml2': No such file or directory
configured to not write apport reports
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libxml2-dev_2.7.8.dfsg-2+squeeze5_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
类似的错误也会发生sudo apt-get upgrade -f
。
我的 /etc/apt/sources.list 目前是:
deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free
deb http://ftp.debian.org/debian/ squeeze-updates main contrib non-free
deb http://security.debian.org/ squeeze/updates main contrib non-free
我该如何解决这个问题?谢谢!
答案1
squeeze3
是squeeze的第三个补丁版本,squeeze5
是第五个。它们是版本号的一部分。库和开发文件的版本必须完全匹配,因此apt-get install -f
当您的系统版本不一致时,APT 希望您运行是正常的。
不正常的是升级libxml2-dev
失败。关于无法阅读的消息/usr/include/libxml2
很不寻常。这似乎表明安装已以某种方式损坏。检查该目录是否仍然存在。如果您在某个时候移动或删除了它......请不要这样做,并重新创建或移回目录以进行恢复。如果该目录存在但您看到类似的内容
$ ls -ld /usr/include/libxml2
?????????? ??? ???????? ???????? 4096 ??? ?? ???? /usr/include/libxml2
那么你的文件系统或者RAM可能被损坏了。第一的,检查你的内存:这是文件系统损坏的最常见原因。在您确定 RAM 的情况之前,请尽可能少地写入,因为这可能会使损坏变得更严重。如何从那里取出它取决于损坏的性质和程度。
答案2
尝试清除它,然后重新安装。
sudo apt-get purge -f libxml2-dev
sudo apt-get clean
sudo apt-get update
sudo apt-get install libxml2 libxml2-dev
包-dev
只是编译与该库链接的程序所需的组件,运行时不需要它,因此完全清除是安全的。