Fixing Broken Updates

Your update went sideways. Take a breath — this is one of the most common Linux hiccups, and it's almost always fixable.

Don't panic

A broken update can look scary. Maybe your terminal spat out a wall of red text, or maybe your system won't even boot. Either way, this is not the end of the world. Linux gives you all the tools you need to recover, and people fix this kind of thing every single day.

Read through the section that matches your situation, follow the steps, and you'll be back up and running.

Common symptoms

Find the section below that matches your distro and error message.

APT problems (Ubuntu, Linux Mint, Debian)

APT is the package manager used on Ubuntu, Linux Mint, Debian, Pop!_OS, and many others. Here are the errors you'll run into most often.

"Could not get lock /var/lib/dpkg/lock"

What it means: Another program is already running an update. Only one thing can install or update packages at a time. This is totally normal.

What to do:

  1. Wait. If you recently opened your software updater or another terminal is running apt, just let it finish. This is the most common cause.
  2. Check if something is actually running:
    sudo lsof /var/lib/dpkg/lock-frontend
    If it shows a process, that's your update — let it finish.
  3. If you're sure nothing is running (for example, your computer crashed during an update), you can remove the lock:
    sudo rm /var/lib/dpkg/lock-frontend
    sudo rm /var/lib/dpkg/lock
    sudo dpkg --configure -a
    Only do this if you're certain no update is in progress. Removing the lock while something is running can break things.

"Unmet dependencies"

What it means: Some packages need other packages to work, and something got tangled up. Maybe an install was interrupted, or you mixed package sources.

What to do:

sudo apt --fix-broken install

This tells APT to figure out what's missing and install it. It works the vast majority of the time. After it finishes, try your update again:

sudo apt update && sudo apt upgrade

"Hash sum mismatch"

What it means: A file downloaded during the update got corrupted. This can happen if your internet hiccupped, or if a mirror (the server your distro downloads from) is temporarily out of sync.

What to do: Clear the downloaded files and try again:

sudo apt clean
sudo apt update

If it keeps happening, you might be hitting a bad mirror. You can switch to a different one in your Software Sources settings (usually found in your system settings or by searching "Software & Updates").

"dpkg was interrupted"

What it means: A previous install or update was cut short (maybe the power went out, or you closed the terminal mid-update). The package system is stuck halfway through setting something up.

What to do:

sudo dpkg --configure -a

This tells dpkg to finish configuring any packages that were left in limbo. Once it's done, follow up with:

sudo apt --fix-broken install
sudo apt update && sudo apt upgrade

Held packages

What it means: Some packages have been "held back" — the system is intentionally skipping them during updates. You'll see a message like The following packages have been kept back.

This usually happens because upgrading those packages would require installing new packages or removing existing ones, and APT is being cautious about it.

What to do:

DNF problems (Fedora)

DNF is Fedora's package manager. It's generally good at resolving problems on its own, but here's what to do when it can't.

Package conflicts

What it means: Two packages are fighting over the same file, or different versions are clashing. This sometimes happens after adding third-party repos.

What to do:

sudo dnf distro-sync

This synchronizes all your packages to the versions your repos say you should have. It's like telling DNF: "Just make everything match what it's supposed to be."

Broken dependencies

What it means: A package needs something that can't be installed, or installing it would break something else.

What to do:

sudo dnf --best --allowerasing update

Here's what those flags mean:

Read the output before pressing Y. DNF will show you exactly what it plans to remove. Make sure nothing important is on that list.

pacman problems (Arch Linux, Manjaro, EndeavourOS)

Arch-based distros use pacman. Because Arch is a rolling release (updates come continuously rather than in big batches), you'll run into a different set of issues.

Keyring issues

What it means: pacman verifies that packages are legit using cryptographic keys. If your keyring is out of date, you'll see errors about invalid or corrupted packages, even though the packages are fine.

What to do: Refresh the keyring:

sudo pacman -Sy archlinux-keyring
sudo pacman -Su

On Manjaro, use manjaro-keyring instead. On EndeavourOS, use endeavouros-keyring.

Partial upgrades — never do this

This is important: On Arch-based systems, never run sudo pacman -Sy without -u. Here's why:

Always use:

sudo pacman -Syu

This refreshes the database and upgrades everything in one go. That's the safe way.

"file exists in filesystem"

What it means: pacman wants to install a file, but that file already exists and belongs to a different package (or was put there manually). pacman won't overwrite it without your say-so.

What to do:

  1. First, figure out which package owns the conflicting file:
    pacman -Qo /path/to/the/file
  2. If the file belongs to another package, you may need to update or remove that package first.
  3. If the file is an orphan (nothing owns it) and you're comfortable overwriting it:
    sudo pacman -Syu --overwrite '/path/to/the/file'
    You can also use a glob pattern if multiple files conflict:
    sudo pacman -Syu --overwrite '/usr/lib/some-package/*'

Don't blindly overwrite everything. Check what the conflicting file is first. If it's from an AUR package or something you installed manually, deal with that package before forcing the overwrite.

My system won't boot after an update

This is the scary one, but you still have options. Here's how to get back in.

Boot into an older kernel version

When your computer starts up, there's a bootloader called GRUB that picks which version of Linux to load. If a kernel update broke things, you can boot into the previous (working) kernel.

  1. Restart your computer.
  2. Hold Shift (for BIOS systems) or press Esc repeatedly (for UEFI systems) right as the computer starts up. You need to catch it before Linux begins loading.
  3. You should see the GRUB menu — a text menu with a list of options.
  4. Select "Advanced options" and pick an older kernel from the list.
  5. If the older kernel boots fine, you can remove the broken kernel once you're logged in, or simply wait for the next kernel update to fix it.

Restore from Timeshift

If you set up Timeshift before things went wrong (good job!), you can roll back your entire system to a snapshot from before the broken update.

  1. Boot into the older kernel (see above) or use a live USB.
  2. Open Timeshift.
  3. Select a snapshot from before the update.
  4. Click Restore and follow the prompts.
  5. Reboot. Your system should be back to normal.

Chroot from a live USB

If you can't boot at all — not even into an older kernel — you can fix your system from outside using a live USB. This technique is called chroot (short for "change root"). It lets you pretend you're inside your installed system, even though you booted from the USB.

Step-by-step chroot instructions

You'll need a Linux live USB (the same one you used to install Linux works great).

  1. Boot from the live USB. Plug it in, restart your computer, and pick the USB from your boot menu (usually F12, F2, or Del at startup).
  2. Open a terminal once the live desktop loads.
  3. Find your Linux partition. Run:
    lsblk
    Look for your main partition — it's usually the biggest one, something like /dev/sda2 or /dev/nvme0n1p2.
  4. Mount your partition:
    sudo mount /dev/sda2 /mnt
    Replace /dev/sda2 with your actual partition.
  5. If you have a separate EFI partition (most modern systems do), mount that too:
    sudo mount /dev/sda1 /mnt/boot/efi
  6. Mount the special system directories:
    sudo mount --bind /dev /mnt/dev
    sudo mount --bind /proc /mnt/proc
    sudo mount --bind /sys /mnt/sys
    sudo mount --bind /run /mnt/run
  7. Chroot in:
    sudo chroot /mnt
    Your terminal prompt will change. You're now "inside" your installed system.
  8. Fix things. Now you can run the normal repair commands for your distro. For example:
    # For Ubuntu/Mint/Debian:
    apt --fix-broken install
    dpkg --configure -a
    apt update && apt upgrade
    
    # For Fedora:
    dnf distro-sync
    
    # For Arch:
    pacman -Syu
  9. Reinstall GRUB if the bootloader itself broke:
    # For UEFI systems:
    grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
    update-grub
    
    # For legacy BIOS:
    grub-install /dev/sda
    update-grub
    On Fedora, use grub2-install and grub2-mkconfig -o /boot/grub2/grub.cfg instead.
  10. Exit and reboot:
    exit
    sudo umount -R /mnt
    sudo reboot

Remove the USB drive as the system restarts. With any luck, you'll boot right back into your repaired system.

Preventing broken updates

A little bit of preparation goes a long way. Here's how to make sure a broken update is a minor annoyance rather than a crisis.

Use Timeshift

This is the single best thing you can do. Timeshift takes snapshots of your system that you can restore if something goes wrong. Think of it like System Restore on Windows, but better.

Don't interrupt updates

Seriously. If an update is running:

An interrupted update is the number one cause of a broken package system. Let it finish, even if it's taking a while.

Update regularly

The longer you wait between updates, the bigger and riskier each update becomes. Updating once a week (or even once every couple of weeks) keeps things smooth. Waiting six months and then running a massive update is asking for trouble.

Read before you press Y

When your package manager tells you it's about to remove or replace something, read the list. If it wants to remove 200 packages to install one thing, something is probably wrong. Don't blindly confirm.