How to remove all the firefox (and other) cruft in /snap etc.?

Chris Green cl at isbd.net
Fri Dec 22 13:54:20 UTC 2023


On Fri, Dec 22, 2023 at 11:20:55AM +0000, Sorin Srbu via ubuntu-users wrote:
> On Fri, 2023-12-22 at 09:31 +0000, Chris Green wrote:
> > On Fri, Dec 22, 2023 at 07:52:01AM +0000, Sorin Srbu via ubuntu-users
> > wrote:
> > > On Thu, 2023-12-21 at 20:11 +0000, Chris Green wrote:
> > > > Having removed snapd from my [x]ubuntu system I had hoped it
> > > > would be
> > > > really gone, but apparently not, there's loads of stuff in /snap
> > > > and
> > > > in the udev rules (/etc/udev.d/snap.firefox.rules) that haven't
> > > > gone.
> > > > 
> > > > Surely if I purge firefox it should take all this junk with it.
> > > > 
> > > > How can I safely clear it out?
> > > 
> > > Hello,
> > > 
> > > IIRC, there are parts of the apt-system that uses snapd.
> > > Removing snapd might bork your system.
> > > 
> > I removed snapd several versions ago and have had no problems at all.
> > It's just the junk below /snap I was wondering about getting rid of
> > as
> > well.
> > 
> 
> Ah, I see. I was a bit too worried to proceed when I saw the apt stuff.
> It might have been nothing though.
> 
To actually get rid of all that junk in /snap it's a bit more
complicated!  You have to reinstall snapd and then use 'snap' to
remove all the snap stuff.

So, 'apt reinstall snapd' and reboot the system (to get snapd started
and configured).  Then 'snap list' shows you all the installed snap
packages.  In my case it was just leftover bits of firefox and its
dependencies.  Go through 'snap remove [--purge] <nam>' for each, they
have to be done in the right order as some depend on others but it's
fairly clear how.

There's a bug when you remove firefox, it can't remove one bit because
it's on a read-only filesystem, you have to umount it manually.

Finally 'snap remove --purge snapd' (yes, it can remove itself!) after
which 'apt purge snapd' leaves things reasonably cleaned up.  :-)  It
even removes the /snap directory.


-- 
Chris Green



More information about the ubuntu-users mailing list