Snap is a software deployment and package management system that was originally developed by Canonical for the Ubuntu Linux operating system. Snap packages bundle dependencies and auto-update which makes them easy to install and manage. However, Snap has received criticism over its performance, overhead, and lack of full system integration on Linux distributions like Ubuntu.
If you want to completely remove Snap and Snap packages from an Ubuntu installation, it is possible but requires multiple steps. This involves removing the core Snap system, uninstalling Snap software, and cleaning up residual configuration files and folders. Proceed carefully, as removing Snaps can affect installed software functionality.
Why Would You Want to Remove Snap
There are a few key reasons why a Linux administrator or user may want to completely remove Snap from Ubuntu:
- Improve performance – Snap packages can consume more RAM and be slower than native apt packages in Ubuntu. Removing Snaps may improve overall system performance.
- Reduce overhead – Snap requires background services to run and auto-update packages. Removing it eliminates this overhead.
- Avoid dependency issues – Poor Snap integration can cause dependency problems on some systems when using apt and Snap packages together.
- Security concerns – Snap’s auto-updating model has raised security concerns for some organizations. Removing it fully reduces possible attack surface.
- Prefer alternatives – Some administrators prefer to use Flatpak over Snap or native packages and wish to standardize on an alternative containerized package manager.
In summary, Snap removal allows you to fully leverage traditional Debian/Ubuntu package management, while also potentially improving performance, security, and stability on your systems.
How to Fully Remove Snap
Removing the core Snap components and all Snap application packages from Ubuntu requires multiple steps. Here is how to fully remove Snap from an Ubuntu system:
Step 1 – Remove Snapd
Snapd is the background service that manages Snap installs, updates, and runs Snap apps on Ubuntu. To remove Snapd, open a terminal window and use:
sudo apt purge snapd
This will uninstall the snapd package and remove the snap systemd service that runs in the background.
Step 2 – Remove Remaining Snap Packages
Next you need to remove any remaining Snap application packages on your system. This can be done by running:
sudo snap list --all | awk '/disabled/{print$1}' | xargs sudo snap remove
This will generate a list of all installed Snap packages, then pipe it to xargs to remove each one. Double check there are no remaining Snaps with:
snap list
All Snaps should now be uninstalled.
Step 3 – Remove Snap Configuration Files
Snap creates configuration files and folders on Ubuntu that need to be removed. This includes:
- /var/lib/snapd/
- /snap/
- ~/.snap/
To remove these residual Snap files and folders, run:
sudo rm -rf /var/lib/snapd/ sudo rm -rf /snap/ rm -rf ~/.snap/
This will delete all remaining Snap configuration data from the system.
Step 4 – Remove Snap Variables and Services
Finally, clean up Snap-related environment variables, services, and mount points:
sudo update-environment sudo systemctl disable --now snapd.socket sudo ln -sf /var/lib/snapd/snap /snap sudo rm -rf /var/lib/snapd sudo reboot
This will remove Snap from starting on boot, clear up the /snap folder, and restart the system.
How to Verify Snap Removal
To verify that Snap has been completely removed from Ubuntu, you can check a few things:
- snap list – Should return command not found
- snap – Should return command not found
- ps aux | grep snapd – Should return no running processes
- dpkg -l | grep snapd – Should return no installed snapd package
- Check that /var/lib/snapd, /snap, and ~/.snap folders are gone
If all of these checks pass, Snap should be completely removed from your Ubuntu environment.
Reinstalling Snap After Removal
If you change your mind later and need to reinstall Snap, you can do so with:
sudo apt update sudo apt install snapd
This will reinstall the snapd package and restore the Snap system. You would then need to manually install any desired Snap application packages again as well.
Conclusion
Removing Snap from Ubuntu takes a bit of work but can be done through removing the core snapd component, uninstalling snap packages, and cleaning up configuration files. This allows you to eliminate Snap if you wish to standardize on apt or Flatpak packages instead.
Keep in mind that removing Snap may impact application functionality if software dependencies rely on Snap packages. Make sure to check for core system impacts before fully uninstalling Snap. Otherwise, the steps outlined above provide a reliable way to completely remove Snap from an Ubuntu Linux installation.