4

I'm trying to install linux-libc-dev with apt-get in Windows Subsystem for Linux (ubuntu), but I get an error and I can't seem to resolve it:

dpkg: error processing archive /var/cache/apt/archives/linux-libc-dev_3.13.0-126.175_amd64.deb (--unpack):
 unable to install new version of `/usr/include/linux/netfilter/xt_DSCP.h': File exists
Errors were encountered while processing:
 /var/cache/apt/archives/linux-libc-dev_3.13.0-126.175_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

But when I list the files in /usr/include/, the linux directory doesn't even exist.

What could be causing this? How can the file exist when the directory does not?

Thanks.

  • I ran into this same thing - did you ever find a resolution? – Peter Tirrell Aug 15 '17 at 13:44
  • Unfortunately no. – Peter Aug 15 '17 at 15:35
3

Probably an install was aborted mid way, leaving it broken.

Find borked packages:

dpkg --configure -a

This should return a list like:

Errors were encountered while processing:
libc6-dev:amd64
libstdc++-4.8-dev:amd64
g++-4.8
g++

Force remove these:

dpkg --remove libc6-dev
dpkg --remove g++
...

Clear your cache of any downloaded packages which are invalid, and purge extra packages:

apt-get clean
apt-get autoremove

You should be able to apt-get install foo again now.

As far as I'm aware apt isn't smart enough to fix this itself once it gets into this kind of state, you have to fall back to explicitly purging packages using dpkg --remove.

0

I had the same problem and found that it is triggered simply because, for some unfortunate and weird reason, the Ubuntu package linux-libc-dev contains a handful of (header) files with names that are distinct only by letter case, e.g., /usr/include/linux/netfilter/xt_DSCP.h and /usr/include/linuxnetfilter/xt_dscp.h.

The issue is due to some silly behavior of the WSL, namely a bug/inconsistency how its case-sensitive file system is implemented. Suppose in some directory there is a file and you want to create in the same directory a further file with a name that is the same except for case. This should work and create the second file in addition to the other one (or maybe overwrite the existing file). Yet this fails and, even worse, produces a misleading error:

touch a.txt touch A.txt yields touch: cannot touch 'A.txt': Input/output error

On the other hand, one can produce files with both cases in this way: touch b.txt touch x.txt mv x.txt B.txt ls {b,B}.txt yields b.txt B.txt

Here is a workaround for packages with names like linux-libc-dev_4.4.0-97.120_amd64.deb:

cd any-temp-dir

apt-get download linux-libc-dev
ar x linux-libc-dev*deb
tar xJf data.tar.xz        # ignore all erors like ./usr/include/linux/netfilter/xt_DSCP.h: Cannot open: Input/output error
tar cJf data.tar.xz ./usr
ar rcs linux-libc-dev*.deb debian-binary control.tar.gz data.tar.xz 

sudo dpkg -i linux-libc-dev*.deb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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