How To Remove Snap Packages From Ubuntu 

Remove Snap Packages From Ubuntu

So, what the heck is Snap in Ubuntu? Snap is a system for packaging and distributing software applications. Think of it as a way to bundle an app with all its necessary files, libraries, and dependencies so it can run smoothly on any computer that supports snaps.

Compared to traditional packages like deb or rpm or other formats like flatpak and app images, snap packages tend to occupy more disk space and take a lot of time to load.

Anyway, let’s go ahead and purge the snap from Ubuntu. 

Backup System (Optional)

Before removing snap packages from Ubuntu it’s recommended to backup your system using time shift just to be on the safer side.

Now, install time shift, a backup tool that allows capturing the snapshot of the system. Back up the entire root system & user directories.

sudo apt install timeshift

    Check Snap List

    To see the list of snap packages installed on your system. Type snap list and you will see all of them. We are going to delete all these snap packages one by one in order.

    Removing Snaps In Order

    Before removing snaps packages from Ubuntu, ensure there is no app running in the background except the terminal.

    Now let’s go ahead and start deleting the Firefox by typing the below command.

    sudo snap remove firefox

    Then remove gtk-common-themes, gnome, snap desktop integration, snap store, firmware updater, and bare packages.

    sudo snap remove gtk-common-themes
    sudo snap remove gnome-42-2204
    sudo snap remove snapd-desktop-integration
    sudo snap remove snap-store
    sudo snap remove firmware-updater
    sudo snap remove bare

    After deleting these packages you need to delete core snap.

    sudo snap remove core22

    Then lastly type this command to remove snapd. 

    sudo snap remove snapd

    Once everything is deleted, type snap list and you will see no snaps are installed. 

    Remove Snap Daemon

    Type run the below command to stop the snapd service.

    sudo systemctl stop snapd

    Then run the below command to disable it.

    sudo systemctl disable snapd

    And lastly, run the below command to mask the snapd. This prevents the snapd service from being started or enabled on your system. 

    sudo systemctl mask snapd

    Then type the below command to purge snapd using apt

    sudo apt purge snapd -y

    Type the below command to mark the snapd package as being held, which prevents it from being upgraded automatically by the apt package manager. 

    sudo apt-mark hold snapd

    Remove Snap package Directories

    Now go ahead type the below commands to delete the snap package directories. 

    sudo rm -rf ~/snap
    sudo rm -rf /snap
    sudo rm -rf /var/snap
    sudo rm -rf /var/lib/snapd

    Prevent Snap From Reinstalling

    It’s time to prevent Snap from reinstalling. To do so, go ahead and type the below command to create a preference file.

    sudo nano /etc/apt/preferences.d/nosnap.pref

    Then add these lines exactly as you see over here. 

    Package: snapd
    Pin: release a=*
    Pin-Priority: -10

    Once it’s done save the changes with CTRL + O and CTRL + X to exit

    Then type the below command to update the apt source list. 

    sudo apt update

    That’s it we have successfully removed all snap packages from Ubuntu.

    Installing Firefox as DEB

    Lastly, let’s go ahead and install the Firefox browser as a deb package.

    Go ahead and run this command to create an apt keyring.

    sudo install -d -m 0755 /etc/apt/keyrings

    Then run this command to import the Mozilla apt repository signing key. 

    wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null

    Then run this command to add Mozilla signing keys to the apt source list. 

    echo "deb [signed-by=/etc/apt/keyrings/packages.mozilla.org.asc] https://packages.mozilla.org/apt mozilla main" | sudo tee -a /etc/apt/sources.list.d/mozilla.list > /dev/null

    Now run this command, to configure apt to prioritize packages from the Mozilla repository. 

    echo '
    Package: *
    Pin: origin packages.mozilla.org
    Pin-Priority: 1000
    ' | sudo tee /etc/apt/preferences.d/mozilla

    And lastly, type the command to update the apt source list and install the Firefox deb package. 

    sudo apt-get update && sudo apt-get install firefox

    This is how you can install the Firefox deb package on Ubuntu. Compared to Snap, DEB packages are much better and load faster. 

    ADD Gnome Software Store

    If you notice after deleting snap packages from Ubuntu, there will be no App Store to install GUI applications. To fix this issue, you can run the command inside the terminal to install the vanilla gnome software center. 

    sudo apt install --install-suggests gnome-software

    Restart ubuntu to affect the changes..

    Reinstall Snap

    If in case you want your snap packages back on Ubuntu, open Timeshift and restore the backup. 

    Conclusion

    That’s pretty much it. This is how you completely remove snap packages from Ubuntu. Let me know what you think about it and if you have queries for future videos, do post in the comment section down below. Thanks for watching. 

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Previous Post

    How to Dual Boot Arch Linux and Windows 11 (2024)

    Next Post

    24 Things TO DO After Installing Ubuntu 24.04 LTS

    Related Posts