Ubuntu – Apt-get install -f errors


Whenever I try doing

sudo apt-get install -f

I get this

dell@elliot:~$ sudo apt-get install -f
Reading package lists... Done
Building dependancy tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 1262 not upgraded.
6 not fully installed or removed.
Need to get 0B/71,3 kB of archives.
After this operation, 227 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 300026 files and directories currently installed.)
Preparing to unpack .../libdbusmenu-qt5-2_0.9.3+16.04.20160218-1_amd64.deb ...
Unpacking libdbusmenu-qt5-2:amd64 (0.9.3+16.04.20160218-1) ...
dpkg: error processing archive /var/cache/apt/archives/libdbusmenu-qt5-2_0.9.3+16.04.20160218-1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libdbusmenu-qt5.so.2.6.0', which is also in package libdbusmenu-qt5:amd64 0.9.3+16.04.20160218-0ubuntu1
Processing triggers for libc-bin (2.23-0ubuntu4) ...
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Best Answer

Force overwrite

sudo dpkg -i --force-overwrite <archive_path>

Finish installing

sudo apt -f install

If you still have problems then execute whatever commands it presents to you afterwards.

Related Question