Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Package management is broken after a mistaken attempt to install TeamViewer (I selected the wrong TeamViewer package from the TeamViewer web site).

I have tried:

sudo apt-get clean
sudo apt-get update

Then if I do:

sudo apt-get install -f

I get:

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:
  language-pack-kde-en kde-l10n-engb language-pack-kde-en-base
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libsane:i386
Suggested packages:
  hpoj:i386 hplip:i386 libsane-extras:i386 sane-utils:i386
The following NEW packages will be installed
  libsane:i386
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/3,554 kB of archives.
After this operation, 8,503 kB of additional disk space will be used.
Do you want to continue [Y/n]? 
(Reading database ... 479536 files and directories currently installed.)
Unpacking libsane:i386 (from .../libsane_1.0.22-7ubuntu1_i386.deb) ...
dpkg: error processing /var/cache/apt/archives/libsane_1.0.22-7ubuntu1_i386.deb (--unpack):
 './lib/udev/rules.d/40-libsane.rules' is different from the same file on the system
Errors were encountered while processing:
 /var/cache/apt/archives/libsane_1.0.22-7ubuntu1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Removing the problem package doesn't seem to work:

sudo apt-get remove libsane:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libsane:i386 is not installed, so not removed
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies.
 ia32-libs-multiarch:i386 : Depends: libsane:i386 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

And removing ia32-libs-multiarch:i386 doesn't work either:

sudo apt-get remove ia32-libs-multiarch:i386
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.
 ia32-libs : Depends: ia32-libs-multiarch
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Ubuntu software center now can't be used as it continually gives me an error dialog saying "Items cannot be installed or removed until the package catalog is repaired. Do you want to repair it now?" - however the repair fails as follows:

(Reading database ... 479536 files and directories currently installed.)
Unpacking libsane:i386 (from .../libsane_1.0.22-7ubuntu1_i386.deb) ...
dpkg: error processing /var/cache/apt/archives/libsane_1.0.22-7ubuntu1_i386.deb (--unpack):
 './lib/udev/rules.d/40-libsane.rules' is different from the same file on the system
Errors were encountered while processing:
 /var/cache/apt/archives/libsane_1.0.22-7ubuntu1_i386.deb
Error in function: 
dpkg: dependency problems prevent configuration of ia32-libs-multiarch:i386:
 ia32-libs-multiarch:i386 depends on libsane; however:
  Package libsane:i386 is not installed.
dpkg: error processing ia32-libs-multiarch:i386 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ia32-libs:
 ia32-libs depends on ia32-libs-multiarch; however:
  Package ia32-libs-multiarch is not installed.
  Package ia32-libs-multiarch:i386 is not configured yet.
dpkg: error processing ia32-libs (--configure):
 dependency problems - leaving unconfigured

I also get a notification saying "An error occurred, Please run Package Manager from the right-click menu or apt-get in a terminal to see what is wrong. The error message was: 'Error: BrokenCount > 0'. This usually means that your installed packages have unmet dependencies".

Any advice on how to get out of this mess? Thanks very much.

share|improve this question
    
as the output said try sudo apt-get install -f –  Josh Sep 10 '13 at 22:30
    
Or try to rename the file ./lib/udev/rules.d/40-libsane.rules and reinstall the package. –  Manuel Sep 11 '13 at 6:16
    
@Manuel are you noticing that you are telleing him to rename a file in a subdirectory of the current directory? ./lib/udev/rules.d/40-libsane.rules normally translate to /home/username/lib/udev/rules.d/40-libsane.rules –  Braiam Sep 11 '13 at 15:14
    
@Braiam: Sorry, I missed that. –  Manuel Sep 12 '13 at 6:40
    
@Josh I already tried apt-get istall -f as mentioned at the top of the post. Also tried moving the 40-libsane.rules file (I presumed that the dot was not wanted at the start of the file path) however that doesn't make any difference. Thanks –  user191794 Sep 13 '13 at 20:43
add comment

2 Answers

up vote 1 down vote accepted

I finally resolved this. There was a circular dependency: ia32-libs-multiarch:i386 depends on libsane:i386 and vice versa. apt-get refuses to remove either one because it depends on the other. Also it refuses to remove them both, if you specify both on the same command line. For example:

sudo apt-get remove libsane:i386 ia32-libs-multiarch:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libsane:i386 is not installed, so not removed
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies.
 ia32-libs : Depends: ia32-libs-multiarch
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

However it will allow you to install both if you specify them on the same command line:

sudo apt-get install libsane:i386 ia32-libs-multiarch:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
ia32-libs-multiarch:i386 is already the newest version.
The following packages were automatically installed and are no longer required:
  language-pack-kde-en kde-l10n-engb language-pack-kde-en-base
Use 'apt-get autoremove' to remove them.
Suggested packages:
  hpoj:i386 hplip:i386 libsane-extras:i386 sane-utils:i386
The following NEW packages will be installed
  libsane:i386
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
2 not fully installed or removed.
Need to get 0 B/3,554 kB of archives.
After this operation, 8,503 kB of additional disk space will be used.
Do you want to continue [Y/n]? 
(Reading database ... 479536 files and directories currently installed.)
Unpacking libsane:i386 (from .../libsane_1.0.22-7ubuntu1_i386.deb) ...
Setting up libsane:i386 (1.0.22-7ubuntu1) ...
Setting up ia32-libs-multiarch:i386 (20090808ubuntu36) ...
Setting up ia32-libs (20090808ubuntu36) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

After that things are back working and I can remove ia32-libs-multiarch:i386 again.

share|improve this answer
    
If you had removed also ia32-libs it would have worked too >_<. –  Braiam Sep 13 '13 at 21:13
    
Oh yes I see now thanks for your help @Braiam. This stuff can be confusing. –  user191794 Sep 13 '13 at 22:22
add comment

Ok, lets fix one by one your errors:

  • Delete teamviewer and dependencies:

    sudo apt-get --purge autoremove teamviewer*
    
  • Remove any ia32-libs package:

    sudo apt-get --purge autoremove ia32-libs*
    
  • I believe you have a 64-bits system, so libsane 32 bits has to go:

    sudo apt-get --purge autoremove libsane:i386
    
  • Repair any other problem:

    sudo apt-get update
    sudo apt-get -f install
    
  • Verify that everything is correct:

    sudo apt-get check
    

    If with last step you find problems different that what are you facing right now, please ask another question.

share|improve this answer
    
Thanks but none of this works. There seems to be a circular dependency: ia32-libs-multiarch:i386 depends on libsane:i386 and vice versa. If I try to remove either one then it refuses because the other depends on it. –  user191794 Sep 13 '13 at 20:36
    
@user191794 then delete them both sudo apt-get --purge autoremove ia32-libs-multiarch:i386 libsane:i386. As last resource, if you need artillery you can always use sudo dpkg --force-all -r libsane:i386 ia32-libs-multiarch:i386 –  Braiam Sep 13 '13 at 20:39
    
Thanks @Braiam as I posted below this didn't work but it did work to install both together. I don't quite understand it but it seems like one or both packages were actually already removed, but somehow still creating this circular dependency problem? Oh well. –  user191794 Sep 13 '13 at 21:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.