Fix apt-get unmet dependencies in Ubuntu 22.04

Linux & Unix Intermediate 👁 9 views 📅 Jul 3, 2026

When apt-get refuses to install because it says 'unmet dependencies' or 'held broken packages', here's the fix that works 90% of the time.

You're running sudo apt-get install something and you get this wall of text that says something like unmet dependencies or held broken packages. Maybe you were trying to install a VPN client, or a Docker package, or something from a third-party PPA. I've seen this happen most often after you added a repository from Ubuntu's Software & Updates tool, then tried to upgrade. The package manager can't figure out which version of a library to keep.

What's actually happening

Your package list has two different sources trying to provide the same library (like libssl1.1 vs libssl3), and apt doesn't know which one to trust. It's not a hardware problem, it's not a virus. It's just a mismatch between what's installed and what's in the repositories you have enabled.

The real root cause: you probably have a PPAs or third-party repos enabled that are offering versions of packages that conflict with the official Ubuntu repos. Or you did a partial upgrade and left some packages half-installed.

The fix: step-by-step

I'm going to show you the method I've used on hundreds of Ubuntu machines. This works for 20.04, 22.04, and 24.04. Do these steps in order. Don't skip any.

  1. Open a terminal
    Press Ctrl+Alt+T. You'll see a black window with a blinking cursor.
  2. Update your package list
    Type: sudo apt update
    After you press Enter, you'll see it download package lists from your repositories. This takes maybe 20 seconds.
  3. Try to fix broken packages
    Type: sudo apt --fix-broken install
    This tells apt to look for packages that are partially installed or have missing dependencies. It will probably show you a list of packages to remove or install. Type Y and press Enter. After it finishes, you should see a message saying 0 upgraded, 0 newly installed, 0 to remove or similar.
  4. Clean the apt cache
    Type: sudo apt clean
    This clears the download cache. Won't break anything.
  5. Upgrade everything
    Type: sudo apt upgrade
    This tries to upgrade all your packages to the latest versions their repositories provide. If it asks to install new packages, type Y and press Enter.
  6. Force-configure any half-installed packages
    Type: sudo dpkg --configure -a
    This reconfigures any packages that got stuck during installation. You should see no errors after this command. If you see errors, write down which packages they mention.
  7. Try your original install command again
    Type the command you were trying to run, for example: sudo apt install openvpn

That's the standard fix. It works maybe 80% of the time.

If that doesn't work: the nuclear option

Sometimes a specific package is the troublemaker. Here's what I do then.

  1. Find the bad package
    Run: sudo apt list --upgradable 2>/dev/null | grep -i held
    This shows packages marked as "held back" — these often cause the dependency conflict.
  2. Remove that package
    If you see a package like libssl1.1 in the output, remove it with: sudo apt remove libssl1.1
    Type Y when it asks to confirm.
  3. Reinstall it from the correct repo
    Type: sudo apt install libssl1.1
    This time it should pull the right version from your main Ubuntu repositories.

I've done this with libc6, libssl, and libcurl conflicts. It works because you're removing the broken version first, then letting apt give you the good one.

Still failing? Check these things

  • You have duplicate repositories
    Open /etc/apt/sources.list with sudo nano /etc/apt/sources.list. Look for lines that start with deb and have the same URL but different names (like focal and jammy mixed together). Comment out the wrong ones by putting a # at the beginning of the line.
  • You added a PPAs that's no longer maintained
    Run ls /etc/apt/sources.list.d/ to see your PPAs. Remove any you don't need with sudo rm /etc/apt/sources.list.d/badrepo.list. Then run sudo apt update again.
  • Your system is too old for the repo
    Ubuntu 22.04 repos work for 22.04 only. If you're on 20.04 and have a 22.04 repo, everything breaks. Check your Ubuntu version with lsb_release -a.

If none of this helped, you can try the last resort: backup your home folder, reinstall Ubuntu from scratch. I know that sounds extreme, but I've seen dependency conflicts that took hours to fix, and a fresh install takes 30 minutes. Sometimes it's the smart move.

Was this solution helpful?