Snap Folder

Has there been any discussion about moving the snap folder somewhere other then the home folder. I for one do not like it in the home folder.

Gort

Snaps aren’t in the home folder.

Read the documentation and you’ll find the following:

Effective location of Snaps

  • /var/lib/snapd/cache working cache
  • /var/lib/snapd/snaps installed Snap versions
  • /var/lib/snapd/snapshots/ Snap snapshots

Where Snaps appear to be, but aren’t

  • When Snaps are installed, they’re downloaded as SquashFS archives (to locations as above) and then are mounted in /snapÂą

What about the folder in your home

  • Snaps also can have user data, which is stored in two places:
    1. $HOME/snap/<snap_name>/common
    2. $HOME/snap/<snap_name>/<revision>


¹ To be clear, you can mount anything anywhere. I can mount an external drive to my home, but it doesn’t mean it’s taking up space in the drive my home lives on.

See:

3 Likes

This is not correct, snaps are never unpacked, they stay fully intact as compressed filesystem images and are stored in /var/lib/snaps/snaps from where they get loop mounted into /snap…

~/snap contains all user application-data for the respective snaps (~/snap/<snap name>/current (being a symlink to the currently running revision of the snap) for all data that needs to roll back and forward with the app (configs etc) when using snap refresh or snap revert and ~/snap/<snap name>/common for everything persistent (caches, databases etc))

1 Like

Then you should probably change the documentation, because it says:

The snap file is uncompressed and mounted as a read-only filesystem under /snap

Right, that is indeed incorrect… Note, when scrolling to the bottom of the page there is a “help improving this documentation” link :wink: (for the next time, I’ll care for this one :slightly_smiling_face:)

Edit: heh, I only noticed now that your link was the same :slight_smile:

1 Like

Can’t believe that feature’s still experimental after all these years.

I enable it on all of my systems

The following is not anywhere in the documentation.

Please edit this, it’s just wrong.

They’re mounted in /snap, not $HOME/snap.


It’s accurate. You and @ogra are somewhat talking past each other.

The data in the squashfs is compressed so it has to be uncompressed to be used. That does not mean it has to be taken out of the snap and placed on disk as one might “unpack” a zip or tar.gz file.

@wxl says they’re uncompressed, which they are, it’s just that it’s done on-demand, not ahead of time.

@ogra changes verbiage to use the word “unpacked” which (to me) feels like a different phrase.

The docs are right. They might benefit from having one word like “on-demand” or a short sentence like “They are not unpacked en-masse, then written to disk, but rather on-demand in-memory.”

I’d have worded it like:

They are stored on disk, loop mounted to /snap and their content is uncompressed to ram at runtime when required …

but I’ll leave it to graham to decide how it is worded best, the current text is way to misleading IMHO

1 Like

Thanks everyone for the discussion here, and I totally agree (embarrassingly), that the wording in Data locations - doc - snapcraft.io is totally misleading. I’ve now updated the second point discussed above to say the following:

  1. The snap file is stored in /var/lib/snaps/snaps. It is then loop mounted to /snap from where its contents become readable by the system. See The snap format for further details on what is included in a snap.
4 Likes

Hi, @degville :slight_smile:

You wrote:

" (…)
2. The snap file is stored in /var/lib/snaps/snaps (…)"

Hmm… I believe that should be /var/lib/snapd/snaps instead. Am I right?

3 Likes