I can't remove packages that have unmet dependencies

Solution 1:

After some digging around with different solutions I came to one that helped me.

  1. I restored the sources.list file using solution provided in this answer

  2. I restored the status file using these commands found here:

mv /var/lib/dpkg/status /var/lib/dpkg/status.old
ls -l /var/backups/dpkg.status*
cp /var/backups/dpkg.status.0 /var/lib/dpkg/status

  1. I had installed i386 architecture on my system when I tried installing Intel Graphics For Linux and some other programs that I didn't kept track off. I removed it using:

sudo dpkg --remove-architecture i386

  1. And finally I did the last 2 commands:

sudo apt-get update and sudo apt-get upgrade

Before I removed the package that was in my error (the libpciaccess one) using sudo dpkg -r libpciaccess* or sudo apt-get purge libpciaccess* , but I think restoring the status file was enough because when I updated and upgraded Ubuntu installed all it's needed upgrades after and my error at Software Updates was gone.

I think this answer will help others that have the same problem as me. Thank you for your awesome help!

Solution 2:

Firstly try, sudo dpkg --configure -a

If that didn't work use aptitude instead of apt-get

sudo aptitude install package_name_here

It will suggest dependencies solutions. Try them. If everything else fails, you need to manually edit dpkg status file

sudo gedit /var/lib/dpkg/status

Then look for the problematic package name. Remove those packages and save the file. Then update and upgrade.

sudo apt-get update && upgrade

Then it will install required packages during update. Let me know if this doesn't work out.