16

After installing some packages and libraries I have an error on Package Manager, I can't run any update because it says:

The package system is broken If you are using third party repositories then disable them, since they are a common source of problems. Now run the following command in a terminal: apt-get install -f

I've tried to do what it says and it returns me:

jara@jara-Aspire-5738:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libcaca-dev libopencv2.3-bin nite-dev python-bluez ps-engine libslang2-dev
python-sphinx ros-electric-geometry-tutorials
ros-electric-geometry-visualization python-matplotlib libzzip-dev
ros-electric-orocos-kinematics-dynamics ros-electric-physics-ode
libbluetooth-dev libaudiofile-dev libassimp2 libnetpbm10-dev
ros-electric-laser-pipeline python-epydoc ros-electric-geometry-experimental
libasound2-dev evtest python-matplotlib-data libyaml-dev ros-electric-bullet
ros-electric-executive-smach ros-electric-documentation libgl2ps0
libncurses5-dev ros-electric-robot-model texlive-fonts-recommended
python-lxml libwxgtk2.8-dev daemontools libxxf86vm-dev libqhull-dev
libavahi-client-dev ros-electric-geometry libgl2ps-dev libcurl4-openssl-dev
assimp-dev libusb-1.0-0-dev libopencv2.3 ros-electric-diagnostics-monitors
libsdl1.2-dev libjs-underscore libsdl-image1.2 tipa libusb-dev libtinfo-dev
python-tz python-sip libfltk1.1 libesd0 libfreeimage-dev
ros-electric-visualization x11proto-xf86vidmode-dev python-docutils
libvtk5.6 ros-electric-assimp x11proto-scrnsaver-dev libnetcdf-dev
libidn11-dev libeigen3-dev joystick libhdf5-serial-1.8.4
ros-electric-joystick-drivers texlive-fonts-recommended-doc esound-common
libesd0-dev tcl8.5-dev ros-electric-multimaster-experimental ros-electric-rx
libaudio-dev ros-electric-ros-tutorials libwxbase2.8-dev
ros-electric-visualization-common python-sip-dev
ros-electric-visualization-tutorials libfltk1.1-dev libpulse-dev libnetpbm10
python-markupsafe openni-dev tk8.5-dev wx2.8-headers freeglut3-dev
libavahi-common-dev python-roman python-jinja2
ros-electric-robot-model-visualization libxss-dev libqhull5 libaa1-dev
ros-electric-eigen freeglut3 ros-electric-executive-smach-visualization
ros-electric-common-tutorials ros-electric-robot-model-tutorials libnetcdf6
libjs-sphinxdoc python-pyparsing libaudiofile0
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libcv-dev
The following NEW packages will be installed
libcv-dev
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
2 not fully installed or removed.
Need to get 0 B/3,114 kB of archives.
After this operation, 11.1 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 261801 files and directories currently installed.)
Unpacking libcv-dev (from .../libcv-dev_2.1.0-7build1_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/libcv-dev_2.1.0-7build1_amd64.deb 
(--           unpack):
trying to overwrite '/usr/bin/opencv_haartraining', which is also in package
libopencv2.3-bin 2.3.1+svn6514+branch23-12~oneiric
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libcv-dev_2.1.0-7build1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've tried everything people recommend on internet like:

sudo apt-get clean
sudo apt-get autoremove
sudo apt-get update
sudo apt-get upgrade
sudo apt-get -f install

Also I've tried to install the synaptic manager but it doesn't let me install anything..

As you can see nothing works so I'm desperate!

I'm using ubuntu 11.10, 64 bits

Thanks!!

1
  • IMHO Avinash Raj's answer is the safest and best explained answer for this problem. I recommend trying this first.
    – Zanna
    Aug 27, 2017 at 10:00

4 Answers 4

20

Command OP tried:

sudo apt-get install -f

Error report for the above command:

dpkg: error processing /var/cache/apt/archives/libcv-dev_2.1.0-7build1_amd64.deb (--unpack):
trying to overwrite '/usr/bin/opencv_haartraining', which is also in package
libopencv2.3-bin 2.3.1+svn6514+branch23-12~oneiric
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libcv-dev_2.1.0-7build1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

From the above error report it was clearly shown that, while running sudo apt-get install -f command dpkg tries to extract and install /var/cache/apt/archives/libcv-dev_2.1.0-7build1_amd64.deb file.Installation requires to place opencv_haartraining file on the /usr/bin directory.

But it was shocked on seeing the same /usr/bin/opencv_haartraining file on the /usr/bin directory and produced the error, because this file had already been placed during libopencv2.3-bin package installation.

Solution for the above error is to remove the already installed libopencv2.3-bin package by running,

sudo dpkg -P libopencv2.3-bin

And then do,

sudo apt-get install -f

Now the above command automatically tries to install /var/cache/apt/archives/libcv-dev_2.1.0-7build1_amd64.deb package and it can install the package successfully because now there was no block.

0
15

http://www.iasptk.com/ubuntu-fix-broken-package-best-solution

After trying

sudo dpkg --configure -a

and

sudo apt-get install -f

the problem of a broken package still exist the solution is to edit the dpkg status file manually.

sudo nano /var/lib/dpkg/status  

(you can use vim instead of nano)

Locate the corrupt package, and remove the whole block of information about it and save the file.

7
  • Editing the status file was the solution! Thank you so much! :D
    – delha
    Oct 4, 2012 at 8:38
  • Same here, got it fixed by editing the status file. +1
    – ppp
    Jan 6, 2013 at 10:57
  • up-vote because thanks for solving the problem!! BUT gedit? vim, please Aug 20, 2013 at 20:10
  • 1
    Sorry, this is the wrong thing to do. Downvoting. Jun 27, 2014 at 21:49
  • 3
    Doing this blindly will more surely cause problems. Yeah, it can fix some very specific cases but there are better alternatives like this other answer.
    – Braiam
    Jun 27, 2014 at 21:53
3

first remove the libcv-dev package

sudo dpkg -r libcv-dev

then

sudo apt-get install -f

the

sudo apt-get update
1
  • 1
    it kept giving an error but i've tried the other answer and it worked. Thank you a lot anyway!!
    – delha
    Oct 4, 2012 at 8:38
-3

Replace the /var/lib/dpkg/status files with the same file from another working system running the same OS version. This worked for me.

1
  • 2
    Can you clarify what you mean? Oct 19, 2012 at 9:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .