Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I run sudo apt-get upgrade on my Debian Squeeze install, I get the following error:

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.

I'm not sure what "squeeze3" versus "squeeze5" means, but it is the only thing that differs in the libxml2 package.

When I try "sudo apt-get install -f", I get:

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)

A similar error occurs with sudo apt-get upgrade -f.

My /etc/apt/sources.list is currently:

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

How do I go about fixing this? Thanks!

share|improve this question
2  
squeeze3 is the third patch release for squeeze, squeeze5 is the fifth. They're part of the version number. The versions for the library and the development files must match exactly. It's normal that APT wants you to run apt-get install -f. What isn't normal is that the upgrade of libxml2-dev is failing. Does the directory /usr/include/libxml2 exist? Are the permissions reasonable? Is there enough disk space? –  Gilles Aug 20 '12 at 1:03
    
@Gilles Ah, the permissions are messed up: ls -l says that it can't access libxml2 (even as root) and it gives ? marks in place of all of the permission information. Promote to answer? Not sure how to fix, but I can look into / talk to my host. –  Jonathan Aug 20 '12 at 1:51
add comment

2 Answers

up vote 4 down vote accepted

squeeze3 is the third patch release for squeeze, squeeze5 is the fifth. They're part of the version number. The versions for the library and the development files must match exactly, so it's normal that APT wants you to run apt-get install -f when your system has inconsistent versions.

What isn't normal is that the upgrade of libxml2-dev is failing. The message about not being able to read /usr/include/libxml2 is unusual. It seems to indicate that the installation has been damaged in some way. Check whether the directory still exists. If you moved or removed it at some point… don't do that, and re-create or move back the directory to recover. If the directory exists but you see something like

$ ls -ld /usr/include/libxml2
?????????? ??? ???????? ???????? 4096 ??? ?? ???? /usr/include/libxml2

then your filesystem is corrupted, or perhaps your RAM. First, check your RAM: this is the most common cause of filesystem corruption. Write as little as possible until you're sure about the RAM, as you may make the damage worse. How to take it from there depends on the nature and extent of the damage.

share|improve this answer
add comment

Try to purge it and then reinstall.

sudo apt-get purge -f libxml2-dev
sudo apt-get clean
sudo apt-get update
sudo apt-get install libxml2 libxml2-dev

A -dev package is only the components required to compile programs linked against that library, it's not needed for run time so it's safe to completely purge.

share|improve this answer
    
This didn't help in my case, because the file ended up being corrupted. Would recommend this procedure for others with library dependency issues (+1). –  Jonathan Aug 20 '12 at 16:03
    
In that case, I've added apt-get clean which would purge the package cache and force re-downloading from the repo the package you needed. –  bahamat Aug 20 '12 at 16:55
    
Sorry, I meant the file /usr/include/libxml2 was corrupted. Even rm -f /usr/include/libxml2 would fail, saying something like it couldn't find the file. It took my webhost 17 hours to fix it. –  Jonathan Aug 21 '12 at 17:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.