Bug 379516

Summary: hide loop devices created by snapd
Product: [Frameworks and Libraries] frameworks-solid Reporter: Lukas Ba. <kdeu>
Component: generalAssignee: Lukáš Tinkl <lukas>
Status: RESOLVED FIXED    
Severity: normal CC: bugseforuns, divirtual, greg, gudvinr+kde, KDE, kdelibs-bugs, meven29, nibgonz, pieterkristensen, rafneq, sabayon11, stefan.bruens
Priority: NOR    
Version: 5.33.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: device in loop
Dolphin v17.04.3 showing Loop Devices
baloo settings still showing strange mounts
krusader with loop-devices
the result of `mount` command

Description Lukas Ba. 2017-05-04 18:42:17 UTC
The snapcraft packaging system (https://snapcraft.io/) creates one or more loop devices for each package you install. These should not show up in the devices list of Dolphin, they are not interesting devices for typical users, and clutter up the list. There could be hundreds of those entries, just think of how many packages you have installed with your normal package manager.
You can hide them manually, by right-clicking on each entry, but i don't want to, there are just too many of them.

The loop mounts are all below /var/lib/snapd, it should be possible to formulate a rule that excludes those loop mounts.

Also, the loop devices never disappear after uninstalling a package, which is another bug,
https://bugs.kde.org/show_bug.cgi?id=319998
making this issue more annoying.
Comment 1 Elvis Angelaccio 2017-08-12 14:40:42 UTC
*** Bug 378824 has been marked as a duplicate of this bug. ***
Comment 2 apache 2017-08-30 12:14:10 UTC
Created attachment 107586 [details]
device in loop

I also have this problem. I installed anbox snap. Even after removing snap package entries in Dolphin remained. 

I noticed that snap doesn't have purge option. As you can see in attachment snap leaves some content.

snap remove talks about purge but it doesn't exist
https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1575132

I use Neon user edition Plasma KDE 5.10.5
Comment 3 David Ing 2017-11-03 20:44:33 UTC
Created attachment 108699 [details]
Dolphin v17.04.3 showing Loop Devices

Kubuntu 17.10
Comment 4 David Ing 2017-11-03 20:46:08 UTC
Comment on attachment 108699 [details]
Dolphin v17.04.3 showing Loop Devices

Me, too.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 17.10
Release:        17.10
Codename:       artful

$ plasmashell --version
plasmashell 5.10.5

$ kf5-config --version
Qt: 5.9.1
KDE Frameworks: 5.38.0
kf5-config: 1.0
Comment 5 Raf 2017-12-26 13:30:03 UTC
Nothing new but the same thing is on openSUSE 42.2 with plasma 5.8.6 kframeworks 5.26.0.

Shouldn't this bug be moved to dolphin-general ? Using loop devices is the normal way the snapd works, so maybe it would be better to only hide it somehow in file manager ? (just guessing)
Comment 6 Kai Uwe Broulik 2018-01-23 16:19:48 UTC
Git commit 1384f275ab2f1ad1841753ee163af6d1b0bb952b by Kai Uwe Broulik.
Committed on 23/01/2018 at 16:06.
Pushed by broulik into branch 'master'.

[UDisks] Ignore non-user mounts

This gets rid of all those internal mounts, such as /snap mounts.
The approach is similar to GVFS which ignores everything outside /media, /home/user, and /media/run,
cf. https://github.com/GNOME/gvfs/blob/master/monitor/udisks2/what-is-shown.txt
Explicitly creating a mount in /etc/fstab outside of those directories is still possible and will always show up.
Related: bug 319998

CHANGELOG: Storage devices mounted outside of /media, /run/media, and $HOME are now ignored, as well as Loop Devices whose
backing file is outside of $HOME

Differential Revision: https://phabricator.kde.org/D9895

M  +10   -1    src/solid/devices/backends/udisks2/udisksstorageaccess.cpp
M  +13   -2    src/solid/devices/backends/udisks2/udisksstoragevolume.cpp

https://commits.kde.org/solid/1384f275ab2f1ad1841753ee163af6d1b0bb952b
Comment 7 PK 2018-06-01 13:26:18 UTC
Created attachment 112998 [details]
baloo settings still showing strange mounts

In my opinion things haven't changed to the better yet. Krusader gives me strange mounts and e.g. the baloo settings window does so too. I am using Neon User edition.
Comment 8 PK 2018-09-03 06:52:22 UTC
I hope I will see the results of the patch from Kay Uwe made on January 23rd soon. Up to now I didn't notice any change. There are still strange "loop-devices" in my system (Neon KDE user edition). 
Thanks!
Comment 9 PK 2018-11-01 07:39:08 UTC
Created attachment 116021 [details]
krusader with loop-devices

How can you say "Resolved/Fixed"?? In the systemsettings the gui for Baloo-search still gives a lot of loop-devices (as shown in attachment), Krusader does, the Libreoffice filepicker does and there are more examples. Just to make myself clearer added a new attachment. This time Krusader.
Comment 10 PK 2018-11-01 07:44:06 UTC
Sorry, I am using Neon User Edition. Completely updated. But I'm still puzzled... In comment 6 ( Kai Uwe Broulik 2018-01-23) I read that this bug is really solved but on my system it just isn't. And it's almost a year later....
Comment 11 Michal Kec (MiK) 2019-11-13 20:04:27 UTC
I can confirm PK's observations: Both Krusader and Baloo search settings are still flooded with snap loop devices in current KDE Neon 5.17. Definitely not fixed then.
Comment 12 Méven Car 2020-01-06 16:09:20 UTC
I don't reproduce on Kubuntu 19.10 Plasma 5.17.80 (dev version) and KF 5.66 with krusader, dolphin.
I believe the baloo settings issue is unrelated to the snap/squashfs issue here.

Could you paste the result of `mount` command here ?

Could you paste the version you are running, "System Information" > "Copy information in clipboard" or `kf5-config --version`
Comment 13 Michal Kec (MiK) 2020-01-06 17:36:48 UTC
Created attachment 124936 [details]
the result of `mount` command

Hallo Méven, thanks for taking care. The result of `mount` command is attached.

Operating System: KDE neon 5.17
KDE Plasma Version: 5.17.4
KDE Frameworks Version: 5.65.0
Qt Version: 5.13.2
Kernel Version: 5.4.1-050401-generic
OS Type: 64-bit
Processors: 16 × AMD Ryzen 7 2700X Eight-Core Processor
Memory: 15,6 GiB

I can see the snap devices on both places mentioned above. The Krusader is 2.7.2 "Peace of Mind" BTW.
Comment 14 Méven Car 2020-01-07 18:05:15 UTC
Could you post here the result of 'solid-hardware5 query "[StorageVolume.ignored == false OR StorageAccess.ignored == false]"'

Your bug must be very specific I have a very similar setup but can't reproduce.
Comment 15 Michal Kec (MiK) 2020-01-07 22:06:03 UTC
Hallo Méven, the result of the command is:

[mik@desktop ~]$ solid-hardware query "[StorageVolume.ignored == false OR StorageAccess.ignored == false]"
udi = '/org/freedesktop/UDisks2/block_devices/nvme0n1p2'
udi = '/org/freedesktop/UDisks2/block_devices/nvme0n1p3'
udi = '/org/freedesktop/UDisks2/block_devices/dm_2d0'
udi = '/org/freedesktop/UDisks2/block_devices/dm_2d1'
udi = '/org/freedesktop/UDisks2/block_devices/nvme0n1p5'
udi = '/org/freedesktop/UDisks2/block_devices/loop0'
udi = '/org/freedesktop/UDisks2/block_devices/loop1'
udi = '/org/freedesktop/UDisks2/block_devices/loop2'
udi = '/org/freedesktop/UDisks2/block_devices/loop3'
udi = '/org/freedesktop/UDisks2/block_devices/loop4'
udi = '/org/freedesktop/UDisks2/block_devices/loop5'
udi = '/org/freedesktop/UDisks2/block_devices/loop6'
udi = '/org/freedesktop/UDisks2/block_devices/loop7'
udi = '/org/freedesktop/UDisks2/block_devices/loop8'
udi = '/org/kde/fstab/server:/mnt/audio'
udi = '/org/kde/fstab/server:/mnt/public'
udi = '/org/kde/fstab/server:/mnt/video'
udi = '/org/kde/fstab/server:/var/www'

I hardly believe this could be specific to my setup. I've got the same issue with my older computer last year too. Prior interfering this bugreport I had searched the solution online, but had found only many similar helpless reports. I.e. https://askubuntu.com/questions/1109715/hide-loop-partitions-snaps-in-krusader
Comment 16 Méven Car 2020-01-08 12:19:48 UTC
Well apparently your are running an a version of solid that does not include https://phabricator.kde.org/D9895, somehow.

On Kubuntu 19.10, this command only outputs my main nvme drive with solid-hardware5 (package libkf5solid-bin 5.62.0-0ubuntu1)

On kde-neon VM I have, with solid-hardware I have a similar output as you do, but not the bug (the loop devices in the places panel).
But with solid-hardware5 (compiled locally), I have what I expect (only main harddrive) like with kubuntu.

I wonder if there is a packaging issue for solid in kde-neon.
I am puzzled.
Comment 17 Michal Kec (MiK) 2020-01-10 17:51:45 UTC
Hallo Méven, thank you for your valuable input! I believe this can be just a packaging issue. How can I help to find it out?

Since I just installed libkf5solid-bin 5.65.0-0xneon+18.04+bionic+build28, the result of the command is:

[mik@desktop ~]$ solid-hardware5 query "[StorageVolume.ignored == false OR StorageAccess.ignored == false]"
udi = '/org/kde/fstab/server:/mnt/public'
udi = '/org/kde/fstab/server:/mnt/audio'
udi = '/org/kde/fstab/server:/mnt/video'
udi = '/org/kde/fstab/server:/var/www'
udi = '/org/freedesktop/UDisks2/block_devices/dm_2d1'
udi = '/org/freedesktop/UDisks2/block_devices/dm_2d0'
udi = '/org/freedesktop/UDisks2/block_devices/nvme0n1p3'
udi = '/org/freedesktop/UDisks2/block_devices/nvme0n1p2'
udi = '/org/freedesktop/UDisks2/block_devices/nvme0n1p5'

So far so good. It turns out there are two commands with two different outputs now. First the command solid-hardware5 here. Then the command solid-hardware I've used in the previous comment (including all loop devices). Maybe my Krusader uses the wrong one? How can I check or even control that? What is the role of "solid" and why do I have installed two versions?

I've uninstalled the old solid-hardware command, part of the kde-runtime package (which seems to contain only KDE4 related binaries and dependencies). I've even rebooted, but Krusader still shows all loop devices. Maybe I could try to uninstall package libsolid4 to make Krusader to use libkf5solid5 instead. That package has 17 more dependencies including kdelibs5-plugins, thus I'm not sure if that won't brake the system.
Comment 18 Méven Car 2020-01-11 13:43:41 UTC
I guess you have not reinstalled your system since you encountered the bug.
It may be beyond my knowledge.

Could do some digging ?
Find out what `ldd /usr/bin/solid-hardware5` returns.

On my kubuntu system (should be quite similar on kde-neon):

$ ldd /usr/bin/solid-hardware5
        linux-vdso.so.1 (0x00007fff5bfcd000)
        libKF5Solid.so.5 => /usr/lib/x86_64-linux-gnu/libKF5Solid.so.5 (0x00007fc86acd6000)
[...]

Then for where libKF5Solid.so, can use `apt-file -F search` to find the packages this comes from (you may need to install apt-file)
For me the command would be :
$ apt-file -F search /usr/lib/x86_64-linux-gnu/libKF5Solid.so.5
libkf5solid5: /usr/lib/x86_64-linux-gnu/libKF5Solid.so.5

You can check the right one is used (the one from your 5.65 version package). (apt show libkf5solid5 for instanec)

Another idea would be to run "ls -l `find /usr/lib -name libKF5Solid*`" to see if you have multiple solid versions installed.

If this is inconclusive, it may be worthwhile looking into the sources of the libkf5solid5 package and check the code is current and not lagging behind for whatever reason: apt source libkf5solid5
then check in src/solid/devices/backends/udisks2/udisksstorageaccess.cpp that 104 correspond to the patch https://cgit.kde.org/solid.git/commit/?id=1384f275ab2f1ad1841753ee163af6d1b0bb952b.
Comment 19 Michal Kec (MiK) 2020-01-11 16:54:28 UTC
Hallo Méven, I can confirm all your findings. See details below. 

(In reply to Méven Car from comment #18)
> Find out what `ldd /usr/bin/solid-hardware5` returns.
        linux-vdso.so.1 (0x00007ffa94214000)
        libKF5Solid.so.5 => /usr/lib/x86_64-linux-gnu/libKF5Solid.so.5 (0x00007ffa93af6000)
        libQt5Core.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 (0x00007ffa933a8000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ffa9301f000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffa92c2e000)
        libQt5Xml.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Xml.so.5 (0x00007ffa929f2000)
        libQt5Widgets.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5 (0x00007ffa9218b000)
        libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007ffa91f6d000)
        libQt5DBus.so.5 => /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5 (0x00007ffa91cde000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ffa91abf000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007ffa918a2000)
        libicui18n.so.60 => /usr/lib/x86_64-linux-gnu/libicui18n.so.60 (0x00007ffa91401000)
        libicuuc.so.60 => /usr/lib/x86_64-linux-gnu/libicuuc.so.60 (0x00007ffa9104a000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffa90e46000)
        libpcre2-16.so.0 => /usr/lib/x86_64-linux-gnu/libpcre2-16.so.0 (0x00007ffa90bcf000)
        libdouble-conversion.so.1 => /usr/lib/x86_64-linux-gnu/libdouble-conversion.so.1 (0x00007ffa909be000)
        libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007ffa906a7000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ffa90309000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ffa900f1000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ffa93fee000)
        libQt5Gui.so.5 => /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5 (0x00007ffa8f907000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ffa8f6ff000)
        libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007ffa8f4b2000)
        libicudata.so.60 => /usr/lib/x86_64-linux-gnu/libicudata.so.60 (0x00007ffa8d909000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007ffa8d697000)
        libGL.so.1 => /usr/lib/x86_64-linux-gnu/libGL.so.1 (0x00007ffa8d40b000)
        libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007ffa8d1d9000)
        libharfbuzz.so.0 => /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0 (0x00007ffa8cf3b000)
        libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007ffa8ccb7000)
        libGLX.so.0 => /usr/lib/x86_64-linux-gnu/libGLX.so.0 (0x00007ffa8ca86000)
        libGLdispatch.so.0 => /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007ffa8c7d0000)
        libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007ffa8c51c000)
        libgraphite2.so.3 => /usr/lib/x86_64-linux-gnu/libgraphite2.so.3 (0x00007ffa8c2ef000)
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007ffa8c0c9000)
        liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007ffa8bead000)
        libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007ffa8bb92000)
        libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007ffa8b85a000)
        libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007ffa8b645000)
        libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007ffa8b41d000)
        libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007ffa8b219000)
        libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007ffa8b013000)
        libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007ffa8adfe000)


> Then for where libKF5Solid.so, can use `apt-file -F search` to find the
> packages this comes from (you may need to install apt-file)
libkf5solid5: /usr/lib/x86_64-linux-gnu/libKF5Solid.so.5


> You can check the right one is used (the one from your 5.65 version
> package). (apt show libkf5solid5 for instanec)
Package: libkf5solid5
Version: 5.66.0-0xneon+18.04+bionic+build29
Priority: optional
Section: libs
Source: solid
Maintainer: Neon CI <neon@kde.org>


> Another idea would be to run "ls -l `find /usr/lib -name libKF5Solid*`" to
> see if you have multiple solid versions installed.
lrwxrwxrwx 1 root root     21 pro 14 13:18 /usr/lib/x86_64-linux-gnu/libKF5Solid.so.5 -> libKF5Solid.so.5.65.0
-rw-r--r-- 1 root root 959992 pro 14 13:18 /usr/lib/x86_64-linux-gnu/libKF5Solid.so.5.65.0


> If this is inconclusive, it may be worthwhile looking into the sources of
> the libkf5solid5 package and check the code is current and not lagging
> behind for whatever reason: apt source libkf5solid5
> then check in src/solid/devices/backends/udisks2/udisksstorageaccess.cpp
> that 104 correspond to the patch
> https://cgit.kde.org/solid.git/commit/
> ?id=1384f275ab2f1ad1841753ee163af6d1b0bb952b.
Checked. The patch is present.

It seems that solid-hardware5 is fine. Maybe just Krusader don't use it.
Comment 20 Méven Car 2020-01-11 17:58:52 UTC
So nothing suspicious from the last batches of searches.

You can check krusader dependencies : `apt show krusader`, if libkf5solid5 is not there that means in might be compiled statically with an old version or maybe is does have not the right version...
On my system krusader uses `libkf5solid5 (>= 4.97.0)`.

It seems it concerns your particular setup, so maybe we can mark this bug as closed.
Comment 21 PK 2020-01-11 18:19:22 UTC
I use Kubuntu Focal Fossa 64 bit. I did
sudo snap install jami --edge
Both Krusader and the baloo-interface are flodded with strange mounts. I wouldn´t close this bug.
Comment 22 Michal Kec (MiK) 2020-01-11 22:19:13 UTC
`apt show krusader` indeed lists libkf5solid5 among the dependencies.

I had uninstalled libsolid4 and any package related to KDE4. Still no change.

Since the issue affects multiple computers and users, I agree with PK.
Comment 23 Méven Car 2020-01-30 12:20:09 UTC
Git commit 3d5719e76a57b09b1335bbb5b6b6d6e44ac90332 by Méven Car.
Committed on 30/01/2020 at 12:19.
Pushed by meven into branch 'Plasma/5.18'.

KCM/baloo Display full mount point in list of excluded mount points

Summary: CCBUG: 379516

Test Plan: {F7865140}

Reviewers: #plasma, ngraham

Reviewed By: ngraham

Subscribers: ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26478

M  +1    -1    kcms/baloo/filteredfoldermodel.cpp

https://commits.kde.org/plasma-desktop/3d5719e76a57b09b1335bbb5b6b6d6e44ac90332
Comment 24 Stefan Brüns 2020-03-20 18:40:27 UTC
(In reply to Michal Kec (MiK) from comment #22)
> `apt show krusader` indeed lists libkf5solid5 among the dependencies.
> 
> I had uninstalled libsolid4 and any package related to KDE4. Still no change.
> 
> Since the issue affects multiple computers and users, I agree with PK.

If krusader does not use the information provided by solid (from KF5.x), it is krusaders fault. Please file a bug report for krusader.

For the Baloo KCM, this is a confirmed bug, but there is no dedicated bug report for it. Please file a separate bug report. This bug report is about "frameworks-solid", as you can see from the "Product" field.

As confirmed by the output of solid-hardware5 (which is the current version, contrary to solid-hardware, which is the EOLed KDE4 version), the bug is no longer present in solid. Thus closing.
Comment 25 Michal Kec (MiK) 2020-03-20 21:37:04 UTC
Thank you for your results, Stefan!
Here's the bug 294162 for Krusader.
Comment 26 Méven Car 2020-11-25 11:16:56 UTC
*** Bug 422385 has been marked as a duplicate of this bug. ***