7.5 SNAP Removal

20230720

A suggested sequence to completely remove the use of snaps from your system is shared as a script below. Whilst I quite like snaps and have not done this. The script is based on a python script from https://github.com/shawshaenk/desnapper/blob/main/desnapper.py.

#!/bin/bash

APPS=`snap list | awk 'NR > 1 {print $1}'`
read -p $'Snaps currently installed:\n\n'"${APPS}"$'\n\nRemove all of them (yes|No): ' ANSWER

# Convert the answer to lowercase.

ANSWER=${ANSWER,,}

# Remove the apps if user confirmed

if [[ "$ANSWER" == "y" || "$ANSWER" == "yes" ]]; then
    
    echo "REMOVING THEM ALL"

    # Iterate over the APPS. The suggestion is to do this twice.

    for app in $APPS; do

        if [[ ! "$app" == "snapd" ]]; then
            echo killall $app
            echo sudo snap remove --purge $app
        fi  

    done

    echo 'sudo snap remove --purge snapd'
    echo 'sudo rm -rf /var/cache/snapd/'
    echo 'sudo apt autoremove --purge snapd gnome-software-plugin-snap -y'
    echo 'sudo rm -rf ~/snap'
    echo 'sudo apt-mark hold snapd'
    echo 'sudo apt install gnome-software -y'

fi


Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0