Skip to Content

How to repair snap store Ubuntu?

How to repair snap store Ubuntu?

The snap store is a popular application store for installing and managing snap apps on Ubuntu and other Linux distributions. However, sometimes the snap store can encounter errors that prevent it from working properly. This article will provide step-by-step instructions on how to diagnose and repair common issues with the snap store on Ubuntu.

Troubleshooting Common Snap Store Issues

Here are some of the most common snap store errors and how to fix them:

Snap Store Won’t Open

If the snap store icon does nothing when clicked or you get an error trying to launch it from the command line, there are a few things to try:

  • Open a terminal and run sudo snap refresh to refresh and update the snapd service.
  • Reinstall the snapd service with sudo apt install --reinstall snapd
  • Restart your system.

Snap Store is Slow or Unresponsive

A slow or lagging snap store could indicate network connectivity issues. Try the following:

  • Check your internet connection is working properly.
  • Change your DNS server settings to use Google or Cloudflare public DNS.
  • Flush your DNS cache with sudo systemd-resolve --flush-caches
  • Restart networking services with sudo systemctl restart systemd-resolved.service

“Snap Store Crashed” Error

If you receive a “Snap store crashed” pop-up error, try:

  • Running sudo snap run snap-store in a terminal to restart the store.
  • Deleting cached snap data with rm -rf ~/snap
  • Uninstalling and reinstalling the core snap with sudo snap remove core; sudo snap install core

Permissions Errors When Installing Snaps

Permission denied errors when trying to install snaps are often fixed by running:

sudo chown -R $USER:$USER ~/.cache/snapd/
sudo chmod -R 755 /var/lib/snapd/

Old Snaps Won’t Update

If you have old snaps installed that won’t update, try:

  • Uninstalling the snap completely, then reinstalling the latest version.
  • Refreshing all snaps with sudo snap refresh
  • Allowing snapd to refresh old revisions with sudo snap set core refresh.retain=0

Reinstalling Snap Store

If you still can’t get the snap store working, a clean reinstallation often fixes things. Here is the process:

  1. Uninstall snapd: sudo apt purge --autoremove snapd
  2. Delete the snap folders:
    rm -rf ~/snap 
    sudo rm -rf /snap
    sudo rm -rf /var/snap 
    sudo rm -rf /var/lib/snapd
        
  3. Install snapd again: sudo apt update && sudo apt install snapd
  4. Reconnect snap interfaces and services:
    sudo snap disconnect core:pluggable-storage
    sudo snap disconnect core:mount-observe  
    sudo snap disconnect core:system-observe
    sudo snap disconnect core:kernel-module-observe
    sudo snap disconnect core:hardware-observe
    sudo snap disconnect core:home
    sudo snap disconnect core:gsettings
    sudo snap disconnect core:opal
    sudo snap disconnect core:cups-control
    sudo snap disconnect core:browser-support
        
  5. Reconnect interfaces:
    sudo snap connect core:pluggable-storage
    sudo snap connect core:mount-observe
    sudo snap connect core:system-observe  
    sudo snap connect core:kernel-module-observe
    sudo snap connect core:hardware-observe
    sudo snap connect core:home
    sudo snap connect core:gsettings  
    sudo snap connect core:cups-control
    sudo snap connect core:browser-support
        

After reinstalling snapd and reconnecting interfaces, the snap store should be repaired.

Advanced Troubleshooting

For additional troubleshooting, you can try the following:

Check Log Files

View snap logs for errors:

/var/log/syslog
~/.cache/snapd/snap.log

Reset Refresh State

Reset the snapd refresh state:

sudo rm -rf /var/lib/snapd/state.json

Rename Snap Folder

Rename the snap folder and reinstall core snap:

mv /var/lib/snapd /var/lib/snapd.bak
sudo apt install --reinstall snapd

Reinstall Related Packages

Try reinstalling snapd dependencies:

sudo apt install --reinstall libc6
sudo apt install --reinstall squashfs-tools 

Check Available Disk Space

Use df to check for low disk space errors:

df -h /var/lib/snapd/

Change Ownership of Snap Folders

Recursively change ownership of snap folders:

sudo chown -R root:root /var/lib/snapd/
sudo chmod -R 755 /var/lib/snapd/

Conclusion

Repairing issues with the snap store usually involves a mix of refreshing snapd, reinstalling the core snap, deleting cached data, and reconnecting interfaces. For additional troubleshooting, checking log files, resetting state, reinstalling dependencies, and correcting folder permissions may help. In most cases, completely removing snapd and performing a clean reinstallation will fix many snap store problems.