Force overwrite apt package duplicate file

December 04, 2026

Short post shows how to tell apt to force overwrite a file.

Every so often apt will fail due to some configuration issue across packages with an error like "trying to overwrite shared".

Preparing to unpack .../libpcap0.8-dev_1.10.4-4.1ubuntu3.2_amd64.deb ...
Unpacking libpcap0.8-dev:amd64 (1.10.4-4.1ubuntu3.2) over (1.10.4-4.1ubuntu3.1) ...
dpkg: error processing archive /var/cache/apt/archives/libpcap0.8-dev_1.10.4-4.1ubuntu3.2_amd64.deb (--unpack):
 trying to overwrite shared '/usr/bin/pcap-config', which is different from other instances of package libpcap0.8-dev:amd64
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libpcap0.8-dev_1.10.4-4.1ubuntu3.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

The fix for this is to simply tell it to force overwrite by adding a dpkg option flag to force-overwrite.

sudo apt --fix-broken install -o Dpkg::Options::="--force-overwrite"