Image of the Raspberry Pi 5

Raspberry Pi 5 Desktop Mini PC: Avoid snap pollution

I’m not a heavy user of snaps particularly on the Raspberry Pi 5. I find that installing software with Flatpak is a better solution than snap in most instances even though both are wasteful of disk space. But occasionally it’s useful to use a snap.

After installing a few snaps, df output gets overridden with /dev/loop entries. Here’s an example.

df output

A snap is a SquashFS file carrying content alongside metadata to tell the system how it should be manipulated.

What’s the easiest remedy to clean up df’s output besides avoiding snaps altogether?

I can exclude squashfs with the -x flag. And use the -h option to make the output human readable.

$ df -hx "squashfs"

Exclude squashfs

Another solution is to use an alternative to df. There are quite a few alternatives to df featured in this roundup. My favourite is dysk which can be installed with cargo, Rust’s package manager. First install cargo.

$ sudo apt install cargo

Now let’s try to build dysk with the command:

$ cargo install dysk

Building dysk fails

dysk fails to build because the version of rustc installed with the Raspberry Pi OS is too old.

It’s suggested re-running cargo install with --locked.

$ cargo install dysk --locked

Build failed with locked option

That didn’t help.

Let’s remove the old version of rustc and cargo we’ve got.

$ sudo apt remove rust cargo

Let’s install the current version of Rust. Issue the command:

$ curl https://sh.rustup.rs -sSf | sh

Install current version of Rust

Select option 1 by pressing enter.

Current version of Rust now installed

I’ve now installed the current version of Rust on my Pi 5.

$ rustc --version

rusc --version

Let’s try compiling dysk again.

$ cargo install dysk

Building dysk with cargo

Success, dysk is now installed on my system.

Issue the command:

$ dysk

Here’s example output from dysk. In my opinion the output is much neater than with df.

dysk output

Let’s go the whole hog and use an alias, so I can just type df. I’m going to use the -s label flag in my alias.

Add the following line to ~/.bashrc using a text editor such as nano.

alias df='dysk -s label'

Log out of the shell or type: $ source .bashrc

Now when I type df, I get the output.

Using an alias

This article was written on a Raspberry Pi 5 (16GB RAM) provided by SunFounder, a company focused on STEAM education with products like Open-source robots, Arduino & Raspberry Pi Kits, display screens, and other smart devices.


All articles in this series:

Raspberry Pi 5 Series
Hardware
iRasptek Starter KitAll the kit you need to get started with the Pi 5
Pironman 5 Case ReviewTransform the Pi 5 into a beautiful desktop mini PC
Passive Cooling the Pi 5Passively cool your Pi 5 the right way. Silent yet cool
BenchmarkingBenchmarking the Pi 5 against an Intel N100 mini PC
OverclockingLet's increase the clock speed of the BCM2712 SoC
Power ConsumptionCompare the power consumption of the Pi 5 with Intel Mini PCs
2.5Gbps NetworkingImproving the wired performance of the Pi 5
WiFiImprove WiFi performance of the Pi 5
Desktop PCIs the Pi 5 good value compared to an Intel N100 Mini PC?
Configuration
raspi-configUseful text-based tool to configure the Pi 5
PiGroGUI tool that streamlines the process of managing the Pi 5
Increase Swap Memory SizeIncrease the swap size from 512MB to 2GB
ZRAM swapdriveSimple script to use a ZRAM swapdrive instead of a swapfile
Software
Installing SoftwareDifferent ways to install software on the Pi 5
df snap pollutionReplace df with dysk
Ollama GUIRunning Large Language Models on the Pi 5
Many software articles are planned. Stay tuned!
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Read our Comment FAQ before commenting.

6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
More Linux
More Linux
1 month ago

This way you don’t solve the pollution of snaps, but you only hide it by polluting your system even more with Rust and dysk.

Your blog would have been so much better if you had explained that you can display the list of installed snaps with the command: snap list

Next you can remove the snap packages one by one from this list with the command: sudo snap remove <package>

The core packages you need to remove in this order:
sudo snap remove snap-store
sudo snap remove gtk-common-themes
sudo snap remove gnome-42-2204/201
sudo snap remove core24
sudo snap remove core22
sudo snap remove core18

Get rid of the annoying /dev/loop mount points using the command:
sudo umount /var/snap

Getting rid of the whole snap stuff with this command:
sudo snap purge snapd

Your df view is now free of those annoying /dev/loop mountpoints and that without reinstalling rust and dysk which only camouflage it.

Pete Smith
Pete Smith
1 month ago

I just installed dysk on my desktop. It makes the output so much clearer.