apt-get upgrade fails: "guvcview : Depends: libguvcview-2.0-0 but it is not installed" [duplicate]
EDIT: My question is a duplicate but my answer here is a bit different than the answer in the linked duplicate above.
I cannot install, remove, or upgrade anything using APT because of this error:
$ sudo apt-get upgrade
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:
guvcview : Depends: libguvcview-2.0-0 but it is not installed
Recommends: uvcdynctrl but it is not installed
E: Unmet dependencies. Try using -f.
I'm certain I can find and fix this error. I'm more interested in knowing why the entirety of apt is broken because of one program having a problem.
Edit: I can't apt-get dist-upgrade
either:
$ sudo apt-get dist-upgrade
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:
guvcview : Depends: libguvcview-2.0-0 but it is not installed
Recommends: uvcdynctrl but it is not installed
E: Unmet dependencies. Try using -f.
apt-get -f install
is met with this error:
Preparing to unpack .../libguvcview-2.0-0_2.0.5+ubuntu2~ppa1+1418-0ubuntu1~201702081552~ubuntu16.10.1_amd64.deb ...
Unpacking libguvcview-2.0-0:amd64 (2.0.5+ubuntu2~ppa1+1418-0ubuntu1~201702081552~ubuntu16.10.1) ...
dpkg: error processing archive /var/cache/apt/archives/libguvcview-2.0-0_2.0.5+ubuntu2~ppa1+1418-0ubuntu1~201702081552~ubuntu16.10.1_amd64.deb (--unpack):
trying to overwrite '/usr/lib/x86_64-linux-gnu/libgviewaudio-2.0.so.2.0.0', which is also in package libguvcview-2.0-2:amd64 2.0.4+debian-1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libguvcview-2.0-0_2.0.5+ubuntu2~ppa1+1418-0ubuntu1~201702081552~ubuntu16.10.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
It should be noted that the file /usr/lib/x86_64-linux-gnu/libgviewaudio-2.0.so.2.0.0
does not exist on my system.
I can't do anything with APT because of this. I can't even remove an unrelated program. abiword
is a text editor.
$ sudo apt-get remove abiword
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:
guvcview : Depends: libguvcview-2.0-0 but it is not going to be installed
Recommends: uvcdynctrl but it is not going to be installed
lubuntu-desktop : Depends: abiword but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
OS: Lubuntu desktop (Ubuntu 16.10)
Solution 1:
I found the answer here:
apt-get commands are failing with libpython3.3 unmet dependencies
Apparently I had two conflicting versions of guvcview
installed.
apt list --installed | grep guvc
guvcview/yakkety,now 2.0.5+ubuntu2~ppa1+1418-0ubuntu1~201702081552~ubuntu16.10.1 amd64 [installed]
libguvcview-2.0-2/yakkety,now 2.0.4+debian-1 amd64 [installed]
As per the answer above, I used dkpg -r --force-depends
to remove them:
sudo dpkg -r --force-depends guvcview
sudo dpkg -r --force-depends libguvcview-2.0-2
At that point I tried to apt-get upgrade
again as normal:
sudo apt-get upgrade
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:
lubuntu-desktop : Depends: guvcview but it is not installed
E: Unmet dependencies. Try using -f.
Aha! This time I got an expected error message. guvcview
is a package that lubuntu-desktop
depends on: that means if I reinstall it after it's removed, everything should be back to normal, right?
After running these commands:
sudo apt-get -f install
sudo apt-get upgrade
Everything works now. guvcview
is working again too, which is nice, because I broke it while debugging this error.