As of Ubuntu 18.04 running lsblk
shows 16 snap loops (2-3 times for each snap). The question is, why are they being listed as results for lsblk, fdisf-l, and blkid?
It creates a lot of clutter from the actual disks drive partitions I need to see, namely /dev/ partitions. I know a purported duplicate of this question exists, but it only asks why three loops are being listed per snap. I want to know why these snaps are being listed in the first place, and the purported duplicate does not answer this (perhaps those marking this as duplicate could help me by explaining why it is a duplicate). Technically, they qualify as file systems (which I neither created nor asked for), but they are getting in the way of the information output for the /dev/ partitions I am interested in. This becomes a problem when fdisk -l outputs a three page+ list filled mainly with snaps.
The output of a recent (1 week old) Ubuntu install and I have not installed any snaps:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 14.5M 1 loop /snap/gnome-logs/37
loop1 7:1 0 2.3M 1 loop /snap/gnome-calculator/170
loop2 7:2 0 86.6M 1 loop /snap/core/4486
loop3 7:3 0 86.6M 1 loop /snap/core/4650
loop4 7:4 0 1.6M 1 loop /snap/gnome-calculator/154
loop5 7:5 0 14.5M 1 loop /snap/gnome-logs/34
loop6 7:6 0 3.3M 1 loop /snap/gnome-system-monitor/36
loop7 7:7 0 2.3M 1 loop /snap/gnome-calculator/178
loop8 7:8 0 13M 1 loop /snap/gnome-characters/101
loop9 7:9 0 3.7M 1 loop /snap/gnome-system-monitor/45
loop10 7:10 0 139.5M 1 loop /snap/gnome-3-26-1604/64
loop11 7:11 0 140M 1 loop /snap/gnome-3-26-1604/59
loop12 7:12 0 3.7M 1 loop /snap/gnome-system-monitor/41
loop13 7:13 0 21M 1 loop /snap/gnome-logs/25
loop14 7:14 0 12.2M 1 loop /snap/gnome-characters/69
loop15 7:15 0 13M 1 loop /snap/gnome-characters/96
sda 8:0 0 298.1G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
└─sda2 8:2 0 297.6G 0 part /
sr0 11:0 1 1024M 0 rom
(supplemental screen capture of above text):
screenshot.jpg
My snap list
shows 6 results:
core
gnome-3-26-1604
gnome-calculator
gnome-characters
gnome-logs
gnome-system-monitor
Meanwhile, gnome-disk-utility shows nothing at all for snaps, only showing my HDD and optical drive.
It won't be very efficient if every installed snap gets listed as a block device (2-3 times each to add). Should I expect future updates to deal with this?
Edit:
fdisk-l
also dumps out a very long list with 16 instances of these "disk loops" (Disk /dev/loop0, Disk /dev/loop1, etc., each with details which I won't show here because it's too long). This can't be intended behaviour, can it?
blkid
also lists 16 loops, as TYPE="squashfs". At least parted -l
works as expected, only outing my actual disk partitions.
I just tested this, and installing more snaps does add more to the lsblk output. Therefore, fdisk, lsblk, blkid could have potentially huge output lists, according to the number of snaps available, and installed.
When you type the command
you will get the output of actual installed snap packages. The reason is when a snap package is updated, the old version is kept (see snapcraft docu).
Citate from snapcraft docu
Explicitly removing a snap from your system will also remove the code and purge the data for all prior versions.
For instance you have got installed more than one versions of gnome-calculator.
In case you only need the newest version, you can use
Using the command
shows you the mounted snaps (loop devices)
If you want to delete the double ones, type
It seems to be an error of the snap code, since all older been kept in the /var/lib/snapd/snaps file.
From the content in your question, your problem is about searching for a way to have control over what you're seeing when you try to view your block devices than how snap uses block devices for its operation.
I agree with your referenced distinction between
fdisk -l
andparted -l
. While fdisk shows a very good detailed output of block devices, it shows too many other things that distract from what you're trying to see.Resolution
You can use filter the lsblk formatted output. This works well to give a clean output like what you get with gnome-disk-utility.
Or as you indicated in your question:
For the
df
command in your question, use:I find this annoying too. It seems if they are not running they should not be mounted or listed. You can run this command to exclude all the loop devices.
$ lsblk -e 7
If you use the snap version of the system monitor, then you will see all file systems used by snap as well as the ones you use.
An easy "fix" is to uninstall Gnome System Monitor from the app store. It is the snap-version.
Then install Gnome System Monitor from the normal repositories using Synaptic package manager. It is the normal version that installs a bunch of files all over you root partition. Nice!
And you will see just what you expect to see when you launch Gnome System Monitor...
I realize this is an older question but since it was near the top of the search results when googling for why
blkid
/fdisk -l
generate lots of "loop" entries, I figured I'd share for the next guy/gal.One option that might work (depending on your requirements) is simply removing snapd. On Linux Mint 19.3 (Ubuntu 18.04 base), snapd is not installed by default and is thus not required. To my understanding, Ubuntu 18.04 is different in that snapd is included out-of-the-box. Under Mint 19.3, installing snapd generates the same "loop" entries in
fdisk -l
andblkid
and runningsudo apt purge snapd
gets rid of them.I have NOT tested this under Ubuntu 18.04 specifically, but assuming that nothing critical would be impacted by removing snapd, then this may be a viable option if you don't actually use snap as a user.
I don't think removing snapd will break anything critical in Ubuntu based on 1, 2 but I did see a note here that you might need to reinstall some default Ubuntu packages that were installed as snaps (
sudo apt install gnome-software gnome-calculator gnome-logs gnome-characters gnome-system-monitor
). I am not sure if this is a complete list / what default packages would be needed under MATE/KDE/xfce/etc. To verify this, I would highly recommend testing in a virtual machine unless you don't care about reinstalling in the event something goes wrong.For Mint 19, I can confirm uninstalling snapd gets rid of the "loop" entries in
fdisk -l
,blkid
,mount
, and probably other commands.To only show mounts excluding loopback you could also simply:
;)