Bug 2229501

Summary: snapd snaps are mounted twice
Product: [Fedora] Fedora Reporter: Thomas <exnihilo>
Component: snapdAssignee: Zygmunt Krynicki <me>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 38CC: go-sig, maciek.borzecki, me, ngompa13
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Thomas 2023-08-06 14:25:06 UTC
Using lsblk -pf or mount or findmnt or whatever else shows each snap mounted twice. For instance with lsblk:

/dev/loop1    squashfs    4.0    0    100%    /var/lib/snapd/snap/bare/5                                               
                                              /var/lib/snapd/snap/bare/5 

In the logs, there's the following:

Directory /var/lib/snapd/snap to mount over is not empty, mounting anyway.

This is since upgrading to F38. After comparing a F37 box, Ubuntu, and my F38 laptop, seems that it's linked to the presence of var-lib-snapd-snap.mount that mounts the directory over itself. This unit is not present on F37 nor Ubuntu.

The unit shows:
# /run/systemd/generator/var-lib-snapd-snap.mount
# Ensure that snap mount directory is mounted "shared" so snaps can be refreshed correctly (LP: #1668759).
[Unit]
Description=Ensure that the snap directory shares mount events.
[Mount]
What=/var/lib/snapd/snap
Where=/var/lib/snapd/snap
Type=none
Options=bind,shared
[Install]
WantedBy=local-fs.target

I tried to look on launchpad (assuming that what LP means) and could find the following of relevance: https://bugs.launchpad.net/snapd/+bug/1962258

This may not be a bug and so necessary to address some issues. But as I could not find documentation on this, wanted to report it. If the mounting over is using bind & shared, I suppose that this would not cause problems?

Snaps already create many loop devices and having each entry twice makes the list even longer :-)

Thanks,

Thomas

Reproducible: Always