0

When I try to install something, for example fish I get this

    fun2code@fun2code-ThinkPad-X220:~$ sudo apt-get install fish
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    You might want to run 'apt-get -f install' to correct these:
    The following packages have unmet dependencies:
     fish : Depends: fish-common (= 2.2.0-3) but it is not going to be installed
            Recommends: xsel but it is not going to be installed
     libreoffice-core : Depends: libreoffice-common (> 1:5.1.6~rc2) but it is not going to be installed
     libreoffice-java-common : Depends: libreoffice-common (= 1:5.1.6~rc2-0ubuntu1~xenial2) but it is not going to be installed
     libreoffice-style-elementary : Depends: libreoffice-

common (= 1:5.1.6~rc2-0ubuntu1~xenial2) but it is not going to be installed
 libreoffice-style-galaxy : Depends: libreoffice-common (= 1:5.1.6~rc2-0ubuntu1~xenial2) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

So I try to run sudo apt-get install -f but I get this error

fun2code@fun2code-ThinkPad-X220:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies...Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
 Done
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following packages were automatically installed and are no longer required:
  fonts-roboto fonts-roboto-hinted libavfilter-ffmpeg5 libavresample-ffmpeg2
  libbs2b0 libcec-platform1v5 libcec3 libflite1 libfstrcmp0 libjs-iscroll
  libllvm4.0 libllvm4.0:i386 libopencv-core2.4v5 libopencv-imgproc2.4v5
  libqt4-designer libqt4-help libqt4-opengl libqt4-scripttools libqt4-test
  libqtassistantclient4 libqtwebkit4 libsdl2-2.0-0 libsndio6.1 libsodium18
  libtbb2 libzmq5 python3-pyqt4 python3-sip
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libreoffice-common
Suggested packages:
  libreoffice-style-breeze libreoffice-style-hicontrast
  libreoffice-style-human libreoffice-style-oxygen libreoffice-style-sifr
  libreoffice-style-tango
The following NEW packages will be installed:
  libreoffice-common
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
21 not fully installed or removed.
Need to get 0 B/22,2 MB of archives.
After this operation, 84,9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 181275 files and directories currently installed.)
Preparing to unpack .../libreoffice-common_1%3a5.1.6~rc2-0ubuntu1~xenial2_all.deb ...
Unpacking libreoffice-common (1:5.1.6~rc2-0ubuntu1~xenial2) ...
dpkg: error processing archive /var/cache/apt/archives/libreoffice-common_1%3a5.1.6~rc2-0ubuntu1~xenial2_all.deb (--unpack):
 trying to overwrite '/usr/bin/soffice', which is also in package openoffice-debian-menus 4.1.4-9788
rmdir: failed to remove '/var/lib/libreoffice/share/prereg/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/share/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/program/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for gnome-icon-theme (3.12.0-1ubuntu3) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
Processing triggers for shared-mime-info (1.5-2ubuntu0.1) ...
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Processing triggers for man-db (2.7.5-1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/libreoffice-common_1%3a5.1.6~rc2-0ubuntu1~xenial2_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

2 Answers2

0

I have the same issue and when i changed my mirror server the problem was fixed.

step 1 : Go to software and updates

Step 2 : Change the download from and click the best mirror location and choose another location.

Then try to install the software again..... Hopefully it will work

tinlyx
  • 3,230
0

The problem is clearly stated in the error message. Simply read one line at a time, and it's quite clear:

Unpacking libreoffice-common (1:5.1.6~rc2-0ubuntu1~xenial2) ...
dpkg: error processing archive /var/cache/apt/archives/libreoffice-common_1%3a5.1.6~rc2-0ubuntu1~xenial2_all.deb (--unpack):
 trying to overwrite '/usr/bin/soffice', which is also in package openoffice-debian-menus 4.1.4-9788
rmdir: failed to remove '/var/lib/libreoffice/share/prereg/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/share/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice/program/': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
rmdir: failed to remove '/var/lib/libreoffice': No such file or directory
  • Looks like you have been mixing Debian and Ubuntu packages. DON'T DO THAT. Stick with one or the other....or you get problems like this.
  • Looks like you have been rm-ing files and directories that were placed by the package manager. DON'T DO THAT. Always use the package manager to remove files placed by the package manger.

One solution is to simply undo the damage:

  • Use sudo mkdir to re-create the directories that the package manager wants to remove.
  • Uninstall all the packages from Debian sources, especially openoffice-debian-menus
user535733
  • 62,253