Apt-get can't install anything due to broken dependencies

23,873

Solution 1

I fixed it by first running

sudo dpkg -r libc6-dev-i386

then by running sudo apt-get install libc6-dev-i386.

Solution 2

I had tried the following

  • sudo dpkg --configure -a
  • sudo apt-get -f install
  • sudo apt-get -u dist-upgrade
  • sudo apt --fix-broken
  • sudo apt-get -f install

but the problem still persisted, then this method worked for me. first: Move the /etc/apt/ folder to a temporary location [you my need Admin permission (sudo)] then run

  • sudo apt-get update
  • sudo apt full-upgrade

delete the auto generated /etc/apt/ folder then i return the previous /etc/apt/ folder back to its original location and run

  • sudo apt-get update
  • sudo apt full-upgrade

Solution 3

This usually happens as a result of 'Unmet dependencies for installed packages'

Open the terminal and run these commands in the following order:

  • sudo apt-get update
  • sudo apt --fix-broken install
  • sudo dpkg --configure -a
  • sudo apt-get clean
Share:
23,873
Alex
Author by

Alex

Updated on July 19, 2022

Comments

  • Alex
    Alex almost 2 years

    Whenever I run apt-get install for any package I get this error

    ➜  ~ sudo apt-get install clang-5.0
    
    Reading package lists... Done
    
    Building dependency tree       
    
    Reading state information... Done
    
    You might want to run 'apt --fix-broken install' to correct these.
    
    The following packages have unmet dependencies:
    
     gcc-7-multilib : Depends: libc6-dev-i386 (>= 2.11) but it is not going to be installed
    
     libc6-dev-x32 : Depends: libc6-dev-i386 (= 2.25-2) but it is not going to be installed
    
    E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
    

    And when I run sudo apt --fix-broken install I get this error

    Unpacking libc6-dev-i386 (2.25-2) ...
    
    dpkg: error processing archive /var/cache/apt/archives/libc6-dev-i386_2.25-2_amd64.deb (--unpack):
     trying to overwrite '/usr/include/bits', which is also in package libc6-dev-amd64:i386 2.25-2
    
    Errors were encountered while processing:
    
     /var/cache/apt/archives/libc6-dev-i386_2.25-2_amd64.deb
    
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    
    • j-p
      j-p over 6 years
      first advice, try aptitude command, it will try to find solution automatically for you.
    • GAD3R
      GAD3R over 6 years
      What is the output of cat /etc/apt/souces.list and cat /etc/apt/sources.list.d/*?
  • Mona Jalal
    Mona Jalal about 3 years
    didn't work for me dpkg: warning: ignoring request to remove libpng12-0:amd64 which isn't installed
  • Mona Jalal
    Mona Jalal about 3 years
    Errors were encountered while p rocessing: /var/cache/apt/archives/libpng12-0_1.2.54-1ubuntu1_amd64.deb