sodcalculator

10 Tech How-To

Fix Snap Package Dependency Errors on Ubuntu

Guide 10-60683 · Updated · Step by step

Snap package dependency errors on Ubuntu usually stem from a broken snapd service, a corrupted snap cache, or a partially installed snap. The most reliable fix is to stop the snapd service, clear the snap cache, and reinstall the problematic snap, which resolves the majority of these errors without needing to reinstall the entire system.

What Causes Snap Dependency Errors

Snap packages are self-contained, which means they bundle their own dependencies. However, the snapd daemon that manages them still relies on system services and a local cache. When you see an error like “snap has bad dependencies” or “snap is not ready yet,” it usually points to one of these underlying issues:

  • Corrupted snap cache: The cached snap files in /var/lib/snapd/cache can become corrupted after an interrupted download or a power failure.
  • Stale mount points: Leftover mount points from a previous session can confuse snapd.
  • snapd service failure: The snapd daemon may have crashed or failed to start properly.
  • Partial installation: A snap install that was interrupted can leave the package in an inconsistent state.
  • Kernel or core mismatch: After a kernel update, the snap core may need to be refreshed to match.

Step-by-Step Fix for Snap Dependency Errors

These steps are safe to run on any current Ubuntu release (20.04 and later) and will clear the most common causes of dependency errors. Open a terminal and run each command in order.

  1. Stop the snapd service: sudo systemctl stop snapd
  2. Clear the snap cache: sudo rm -rf /var/lib/snapd/cache
  3. Remove stale mount points: sudo rm -rf /var/snap (this is safe; snapd will recreate it)
  4. Restart snapd: sudo systemctl start snapd
  5. Refresh the snap core: sudo snap refresh core
  6. Reinstall the problematic snap: sudo snap remove then sudo snap install

If the error persists, try rebooting after step 4, as some mount points are only cleaned on boot.

Why Snap Dependencies Work Differently Than apt

Traditional apt packages share system libraries. If one library updates, all packages that use it get the update. Snaps are different: each snap bundles its own libraries, which is why they are larger. This isolation prevents “dependency hell” where one package breaks another. However, it means the snapd daemon must mount and unmount these bundles correctly. If the mounting fails, you get a dependency error even though the snap’s actual libraries are fine.

Another key difference is the snapd service itself. It runs as a system daemon and maintains a database of installed snaps. If that database gets corrupted, snap commands may fail with cryptic errors. The fix above resets the cache and forces snapd to rebuild its state.

Common Snap Errors and Their Specific Fixes

Here are a few specific error messages you might see and how to address them:

  • “snap has bad dependencies” – This usually means the snap’s YAML metadata is corrupt. Reinstall the snap as shown above.
  • “snap is not ready yet” – This often happens right after boot. Wait a few seconds and try again. If it persists, run sudo systemctl restart snapd.
  • “cannot install snap: mount failed” – This is a mount point issue. Run sudo rm -rf /var/snap and reboot.
  • “snapd failed to talk to snapd” – The daemon isn’t running. Check with systemctl status snapd and start it if needed.
  • “snap has no update available” – This is not an error; it just means you’re up to date. If you need a specific version, use snap refresh --channel.

When to Use `snap revert` Instead

If a snap worked yesterday but fails today after an automatic update, the update itself may have introduced a bug. In that case, reverting to the previous version is faster than reinstalling:

  1. Check the snap’s version history: snap changes
  2. Find the change ID that corresponds to the last successful update.
  3. Revert: sudo snap revert --revision=

This is especially useful for core snaps like core20 or core22 that provide the base runtime for other snaps.

Preventing Future Snap Dependency Errors

Most dependency errors are caused by interrupted operations or disk full conditions. To minimize the risk:

  • Ensure you have at least 10% free disk space; snaps are large and need room to unpack.
  • Do not interrupt snap installs or refreshes. Let them finish.
  • Keep snapd updated: sudo snap refresh snapd
  • If you use a proxy or VPN, make sure it doesn’t cut off connections mid-download.
  • Consider using snap set system refresh.retain=2 to keep only two old versions of each snap, reducing cache bloat.

Alternatives to Snap: When to Switch

If you repeatedly encounter snap issues, you might prefer using the native apt version of an application, if one exists. For example, Firefox and Chromium are available as both snaps and PPAs. However, on Ubuntu 22.04 and later, Firefox is only provided as a snap by default. You can install the .deb version from Mozilla’s official repository, but that requires adding a third-party source. For most users, fixing snapd is simpler than switching package formats, but it’s good to know the option exists.

Frequently Asked Questions

Will clearing the snap cache delete my applications or data?

No. The cache only contains downloaded snap files that are used for installation and updates. Your installed snaps and their user data (in ~/snap) are untouched. Clearing the cache is safe and often the first step in fixing errors.

Why does snapd use so much disk space?

Snapd keeps multiple revisions of each snap so you can revert if an update fails. By default, it keeps 3 revisions. You can reduce this with sudo snap set system refresh.retain=2. Also, each snap includes its own libraries, which adds to the size.

Can I remove all snaps and use only apt?

Yes, but it’s not recommended on default Ubuntu. Some system components like the GNOME desktop rely on snaps. You can remove individual snaps and install apt alternatives, but you may lose integration features. If you want a snap-free system, consider using a different distribution like Linux Mint or Debian.

What does “snap has bad dependencies” actually mean?

It means the snap’s metadata file (snap.yaml) is corrupted or incomplete. This can happen if the download was interrupted. Reinstalling the snap will fetch a fresh copy and fix it.

Do I need to reboot after fixing snapd?

Not usually, but if you removed /var/snap, a reboot ensures all old mount points are cleared. If you still see mount errors after the fix, a reboot is the next step.

Is it safe to use sudo snap refresh --edge to get the latest version?

It’s safe but not recommended for stable systems. Edge versions are pre-release and may have bugs. Stick to the stable channel unless you need a specific feature or fix that’s only in edge.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →