0

I'm trying to reinstall libc6-dev since I accidentally removed /usr/include/stdio.h, and I'm getting the following message:

Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu artful-updates/main amd64 libc6-dev amd64 2.26-0ubuntu2.1 [2,526 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu artful-updates/main i386 libc6-dev i386 2.26-0ubuntu2.1 [2,144 kB]
Fetched 4,669 kB in 1s (4,293 kB/s)       
(Reading database ... 910409 files and directories currently installed.)
Preparing to unpack .../libc6-dev_2.26-0ubuntu2.1_amd64.deb ...
Unpacking libc6-dev:amd64 (2.26-0ubuntu2.1) over (2.26-0ubuntu2.1) ...
dpkg: error processing archive /var/cache/apt/archives/libc6-dev_2.26-0ubuntu2.1_amd64.deb (--unpack):
 trying to overwrite shared '/usr/include/stdlib.h', which is different from other instances of package libc6-dev:amd64
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Preparing to unpack .../libc6-dev_2.26-0ubuntu2.1_i386.deb ...
Unpacking libc6-dev:i386 (2.26-0ubuntu2.1) over (2.26-0ubuntu2.1) ...
dpkg: error processing archive /var/cache/apt/archives/libc6-dev_2.26-0ubuntu2.1_i386.deb (--unpack):
 trying to overwrite shared '/usr/include/stdlib.h', which is different from other instances of package libc6-dev:i386
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libc6-dev_2.26-0ubuntu2.1_amd64.deb
 /var/cache/apt/archives/libc6-dev_2.26-0ubuntu2.1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've searched for solutions, but those deal with using apt install -f, rather than reïnstalling packages.

  • 2
    Looks like your two packages both provide /dev/include/stdlib.h. Do you really mean to be installing libc6-dev for both amd64 and i386 architectures? This is not a typical thing to do. – Martin W Apr 17 '18 at 20:15
1

If you are sure that this is really want to do (see comment above), you can do

sudo apt-get -o Dpkg::Options::="--force-overwrite" install libc6-dev-amd64 libc6-dev-i386

This passes the --force-overwrite flag to dpkg which allows one package to overwrite another one's file. Of course, if you have the deb files, you can using the underlying dpkg command directly as:

sudo dpkg -i --force-overwrite libc6-dev-amd64 libc6-dev-dev-i386

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.