Ubuntu – Unable to fix unmet dependencies

dependenciespackage-management

I installed (not successfully) chrome 32-bit and didn't know that my OS type was 64-bit. I tried to fix it with this command sudo apt-get -f install but there was an error.

Every time I install a package, for example, flashplugin-installer or gdebi, it shows an error:

$ sudo apt-get install flashplugin-installer

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:
 libc6 : Breaks: locales (< 2.19)
 libc6:i386 : Recommends: libc6-i686:i386
              Breaks: locales (< 2.19)
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

-------------------------------------------------------------------------------

$ sudo apt-get install gdebi

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:
 gdebi : Depends: gdebi-core (= 0.9.5.5+nmu1) but it is not going to be installed
         Recommends: libgtk2-perl but it is not going to be installed
 libc6 : Breaks: locales (< 2.19)
 libc6:i386 : Recommends: libc6-i686:i386
              Breaks: locales (< 2.19)
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

How do I fix this? I'm new at Linux.


Edit:

Next, run:

sudo apt-get clean
sudo apt-get update

Well I am stuck at that before purging and downgrading libc6 on mchid's answer. I am having this error, and mchid suggested this link but the solutions didn't solved my problem.

Best Answer

EDIT

I found out that a pin-priority of 1001 will allow downgrades of this priority set so you can downgrade all existing Ubuntu packages that were mistakenly installed because of the Kali Repo. This should really help to fix things and should also prevent dependency issues in the future.

First, edit your /etc/apt/preferences file before you do anything else.

Run the following commands:

sudo nano /etc/apt/preferences

Now, copy and paste the following into the file:

Package: *
Pin: origin ppa.launchpad.net
Pin-Priority: 1001

Package: *
Pin: origin ph.archive.ubuntu.com
Pin-Priority: 1001

Package: *
Pin: origin security.ubuntu.com
Pin-Priority: 1001

Package: *
Pin: origin extras.ubuntu.com
Pin-Priority: 1001

Package: *
Pin: origin repo.kali.org
Pin-Priority: 600

Package: *
Pin: origin extras.ubuntu.com
Pin-Priority: 1001

Package: *
Pin: origin security.kali.org
Pin-Priority: 600

Package: *
Pin: origin http.kali.org
Pin-Priority: 600

Press CTRL + o and then press ENTER to save the file. Press CTRL + x to exit nano.

Next, run:

sudo apt-get clean
sudo apt-get update

Then, purge libc6-dbg and downgrade libc6:i386, libc6-dev, and libc6:

sudo dpkg -P libc6-dbg
apt-get download libc6-udeb=2.19-0ubuntu6 libc6-dev=2.19-0ubuntu6.6 libc6=2.19-0ubuntu6.6:i386
sudo dpkg -i libc6_2.19-0ubuntu6.6_amd64.deb
sudo dpkg -i libc6-dev_2.19-0ubuntu6.6_amd64.deb
sudo dpkg -i libc6_2.19-0ubuntu6.6_i386.deb

Also, downgrade gdebi:

sudo apt-get install gdebi=0.9.5.3ubuntu2

If all goes well, run the following commands. If not, please post your errors.


To install google-chrome-stable:

sudo apt-get clean
sudo dpkg -P google-chrome-stable
sudo apt-get update
sudo apt-get upgrade

Please post any errors. If there are no errors, continue:

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo gdebi google-chrome-stable_current_amd64.deb

gdebi will handle all the dependencies for you.