Website Vidya
Linux & ServersStep-by-Step Guide

Fix E: Unable to Locate Package Error on Ubuntu: 11 Simple Ways

If you’ve used Ubuntu for any length of time, chances are you’ve run into this frustrating message at least once: E: Unable to locate package <package-name> It usually appears right when you’re trying to install something important—Docker, ...

RR
Rajesh RayLead Systems Educator
Published:
8 min read
Fix E: Unable to Locate Package Error on Ubuntu: 11 Simple Ways
AI Executive SummaryCORE CIS AI

8 min read

If you’ve used Ubuntu for any length of time, chances are you’ve run into this frustrating message at least once: E: Unable to locate package It usually appears right when you’re trying to install something important—Docker, ...

Key Highlights
  • What Are Broken Packages in Ubuntu?
  • Common Signs of Broken Packages
  • How to Fix Broken Packages in Ubuntu
Grounded in full engineering runbookCORE CIS Ai Engine

If you’ve been using Ubuntu for a while, chances are you’ve run into package-related issues at least once. A failed update, an interrupted installation, or conflicting dependencies can easily leave your system in a messy state. When that happens, you’ll often see errors like “broken packages”, “unmet dependencies”, or “dpkg was interrupted”.

This guide is a complete, practical walkthrough on How to Fix Broken Packages in Ubuntu—written for real users, real systems, and real problems. Whether you’re a beginner or an advanced Linux user, this article will help you diagnose the issue, fix it safely, and prevent it from happening again.


What Are Broken Packages in Ubuntu?

In Ubuntu, a package is a bundled piece of software managed by tools like APT and dpkg. A package is considered broken when:

  • Required dependencies are missing or incompatible
  • Installation or upgrade was interrupted
  • Conflicting versions of the same package exist
  • Repositories are misconfigured or outdated

When packages break, Ubuntu’s package manager refuses to proceed with installs or updates until the problem is resolved.

Advertisement

Common Signs of Broken Packages

You may be dealing with broken packages if you see errors like:

  • E: Unmet dependencies
  • E: Unable to correct problems, you have held broken packages
  • dpkg was interrupted, you must manually run 'dpkg --configure -a'
  • Software Center not opening or crashing
  • apt install or apt upgrade failing repeatedly

If any of these sound familiar, don’t worry—most broken package issues are recoverable.

How to Fix Broken Packages in Ubuntu



Method 1: Use APT to Fix Broken Packages Automatically

When Ubuntu shows broken package errors, the package manager usually already knows what went wrong. The command:

sudo apt --fix-broken install

What this command does:

  • Attempts to fix dependency issues
  • Installs missing dependencies
  • Removes partially installed packages if needed

After running it, try updating again:

sudo apt update
sudo apt upgrade

If this works, your problem may already be solved.

Advertisement

Method 2: Configure Unfinished Packages Using dpkg

Sometimes installations stop halfway—maybe due to a power cut, system crash, or forced shutdown. When that happens, Ubuntu marks packages as unconfigured.

sudo dpkg --configure -a

Why this method is important:

  • It completes pending setup scripts
  • It fixes packages that were installed but never configured
  • It restores the package database to a consistent state

This command does not install anything new. It simply completes incomplete installations, which often removes errors blocking further updates.

Once done, follow it with:

sudo apt --fix-broken install

Method 3: Identify and Remove Held Packages

Held packages are packages that Ubuntu refuses to upgrade, usually because:

  • A version conflict exists
  • The package was manually pinned
  • A dependency requires a specific version

You can check them us

Advertisement
apt-mark showhold

Remove the hold:

sudo apt-mark unhold package-name

After unholding, update your system again:

sudo apt update && sudo apt upgrade

Why held packages cause problems:

When APT tries to upgrade your system, held packages act like roadblocks, preventing dependency resolution.

Unholding them allows Ubuntu to:

  • Upgrade dependencies correctly
  • Replace outdated versions
  • Resolve conflicts naturally

Once unheld, package management becomes flexible again.

Method 4: Clean APT Cache and Rebuild Package Lists

Corrupted cache files can cause persistent package errors.

Step 1: Clean the cache

sudo apt clean
sudo apt autoclean

Step 2: Remove unused dependencies

sudo apt autoremove

Step 3: Refresh package lists

sudo apt update

What this method really does:

  • Deletes old and broken package files
  • Removes unused dependencies
  • Clears clutter that confuses the package manager

This method is like clearing browser cache—it doesn’t harm anything, but it often fixes strange behavior.


Method 5: Manually Remove a Problematic Package

Sometimes one specific package refuses to behave. It might:

  • Fail during installation every time
  • Block updates
  • Break dependency chains

Using dpkg with force options allows you to remove that one broken link.

Find broken packages:

dpkg -l | grep ^..r

Remove the package:

sudo dpkg --remove --force-remove-reinstreq package-name

Then fix dependencies:

sudo apt --fix-broken install

Why this works:

  • It removes partially installed packages
  • It clears dependency loops
  • It allows APT to rebuild a clean dependency tree

This is a more advanced fix and should be used carefully, especially if the package is system-critical.


Use this method carefully, especially with core system packages.

Method 6: Fix Repository Issues

Broken or outdated repositories are a major cause of package problems.

Check your sources list:

sudo nano /etc/apt/sources.list

Look for:

  • Unsupported Ubuntu versions
  • Third-party PPAs that no longer exist
  • Duplicate entries

Remove a problematic PPA:

sudo add-apt-repository --remove ppa:ppa-name

Then run:

sudo apt update

Method 7: Use Synaptic Package Manager (GUI Option)

If you prefer a graphical approach:

sudo apt install synaptic

Open Synaptic → Edit → Fix Broken Packages → Apply changes.

This is especially useful for beginners who want a visual overview of dependencies.


Method 8: Force Reinstallation of Packages

Sometimes reinstalling fixes version mismatches.

sudo apt install --reinstall package-name

For multiple packages:

sudo apt install --reinstall $(dpkg -l | awk '/^ii/ {print $2}')

Preventing Broken Packages in the Future

To avoid running into this issue again:

  • Don’t interrupt apt or dpkg commands
  • Avoid mixing packages from different Ubuntu releases
  • Be cautious with third-party PPAs
  • Update your system regularly:sudo apt update && sudo apt upgrade
  • Use apt instead of dpkg unless necessary


Final Thoughts

Knowing How to Fix Broken Packages in Ubuntu is an essential skill for anyone using Linux seriously. While package errors can look intimidating at first, they’re usually logical, traceable, and solvable with the right commands.

Start with simple fixes, understand what each command does, and avoid panic. Ubuntu’s package management system is powerful—and forgiving—when used correctly.

If you handle updates carefully and keep your repositories clean, broken packages will become a rare problem rather than a regular headache.

You can refer to the official Ubuntu package index, for the detailed reference.


RR
Written byVerified Author

Rajesh Ray

I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.

SPAM-FREE MODERATED DISCOURSE

Join the Conversation & Perspective

Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.

AT
MP
JV
+2

No comments on this guide yet. Be the first to share your thoughts or ask a question!

Recommended Reading10 Guides

Related Technical Guides

Tested runbooks, server administration walkthroughs, and troubleshooting guides

Linux & Servers•

How to Install PDO Extension in PHP

PHP Data Objects (PDO) is one of the most important extensions in PHP for working with databases in a secure, consistent, and modern way. If you are building dynamic websites, APIs, CMS platforms, or enterprise applications, PDO is not opti...

RR
Rajesh Rai
Read More
Linux & Servers•

How to Fix 406 Not Acceptable Error

What is the 406 Not Acceptable Error? The 406 Not Acceptable is an HTTP client error status code that indicates the server cannot produce a response matching the list of acceptable values defined in the request's proactive content negotiati...

RR
Rajesh Rai
Read More
Featured Infrastructure PartnerUp to 75% OFF + 3 Months Free

Supercharge Your Linux & Cloud Workloads with Hostinger

Deploy high-speed NVMe KVM VPS, Docker containers, and LiteSpeed-accelerated WordPress servers in under 60 seconds with full root access, dedicated IPv4, and 24/7 technical support.

Pure NVMe SSD StorageFull Root Access & SSHFree Domain & Unlimited SSL99.9% Uptime SLA
Plans from$2.99/mo
Claim Hostinger DealAffiliate link • Special discount applied at checkout