
Completely removing the Snap package management system from Ubuntu 22.04 or 24.04 is a process that involves several key steps to ensure all components and residual files are eliminated. While Snap offers benefits, some users prefer alternative methods for software installation. Here is a definitive guide to achieving a clean removal.
The first step is crucial: you must remove all installed Snap packages before attempting to remove the Snap daemon itself. Failing to do this will result in errors and an incomplete removal. To see which Snap packages are currently installed on your system, open your terminal and run the command:
snap list
This will display a list of installed Snap packages, including system components like snapd
core and potentially user-installed applications. Identify the applications you installed via Snap. You can typically ignore the core system snaps for now, as they are part of the base snapd
installation which is removed later.
For each application you see listed that you wish to remove, use the following command, replacing package-name
with the actual name from the list:
sudo snap remove package-name
Repeat this command for every Snap application you want gone. Pay attention to the output; it will indicate successful removal or any dependencies. If prompted, enter your user password.
Once you have uninstalled all individual Snap applications, you can proceed to remove the core Snap daemon, snapd
. This service is responsible for managing Snap packages on your system. First, it’s a good practice to stop the service, although the purge command often handles this:
sudo systemctl stop snapd
sudo systemctl disable snapd
Now, uninstall the snapd
package using the Advanced Package Tool (apt
), ensuring all configuration files are purged:
sudo apt autoremove –purge snapd
This command will remove the snapd
package and its dependencies that are no longer needed, along with purging associated configuration files.
Even after purging the package, some directories and files related to Snap’s cache and data might remain. For a truly clean removal, you may want to remove these directories manually. Use caution when using sudo rm -rf
, as this command permanently deletes files without confirmation. Execute the following commands:
sudo rm -rf /var/cache/snapd
sudo rm -rf /var/lib/snapd
sudo rm -rf ~/snap
These commands remove the Snap cache, the main data directory for Snap (where packages and mounting points reside), and the user-specific Snap data directory in your home folder.
Finally, update your package lists to ensure your system recognizes that snapd
is no longer installed and to clean up any potential lingering references:
sudo apt update
After completing these steps, the Snap system should be entirely removed from your Ubuntu 22.04 or 24.04 installation. You have successfully freed your system from Snap confinement and resource usage associated with the service. Restarting your computer is recommended to ensure all changes take effect.
Source: https://linuxblog.io/remove-snap-ubuntu-22-04-lts/