How To Remove Snap Packages From Ubuntu
How to Remove Snap Packages from Ubuntu
Snap packages are a popular way to install software on Ubuntu due to their ease of use and compatibility across distributions. However, some users prefer to remove Snap packages and even Snap itself for various reasons, such as performance concerns or a preference for traditional package managers like apt
. This guide will walk you through the steps to uninstall Snap packages and optionally remove Snap entirely from your Ubuntu system.
Step 1: Uninstall Snap Packages
Before removing Snap, you’ll need to uninstall all the Snap packages you have installed.
1.1 List Installed Snap Packages
To see the Snap packages currently installed on your system, use:
snap list
This will display a list of all installed Snap packages.
1.2 Remove a Specific Snap Package
To remove a specific Snap package, run the following command, replacing package-name
with the name of the Snap you want to uninstall:
sudo snap remove package-name
Example:
sudo snap remove firefox
1.3 Verify the Removal
After uninstalling a package, run snap list
again to confirm that it has been removed.
Step 2: Remove Snap Itself (Optional)
If you’ve decided you no longer want Snap on your system, follow these steps to completely remove it.
2.1 Uninstall All Snap Packages
Ensure all Snap packages have been removed. You can do this manually as shown in Step 1, or use the following command to remove them all at once:
snap list | awk 'NR>1 {print $1}' | xargs -L1 sudo snap remove
2.2 Stop and Disable Snap Daemon
To stop the Snap service, run:
sudo systemctl stop snapd
sudo systemctl disable snapd
2.3 Remove Snap Directories
Delete the Snap-related directories:
sudo rm -rf /var/cache/snapd /snap
2.4 Uninstall Snap Package Manager
To remove Snap itself, run:
sudo apt purge snapd
2.5 Clean Up Configuration Files
Finally, delete any leftover Snap configuration files:
rm -rf ~/snap
Step 3: Prevent Snap From Reinstalling (Optional)
To prevent Snap from being reinstalled during future system updates, follow these steps:
3.1 Block Snap Installation
Create a preference file to block Snap:
sudo nano /etc/apt/preferences.d/no-snap.pref
Add the following lines to the file:
Package: snapd
Pin: release a=*
Pin-Priority: -10
Save and exit the file.
3.2 Update APT
Run the following command to update the package manager:
sudo apt update
Alternatives to Snap Packages
If you’ve removed Snap, you can still install software using other package formats:
APT: Use
.deb
packages via theapt
command (default for Ubuntu).Flatpak: A popular alternative to Snap for sandboxed applications.
AppImage: A portable application format that doesn’t require installation.
By following these steps, you can fully remove Snap packages and the Snap system from your Ubuntu machine. Whether you prefer traditional package managers or want to explore other options, you now have the tools to customize your setup.
Let us know if you encounter any issues or need further assistance!
Comments
Post a Comment