Snap mount namespace updating/caching behaviour


I noticed that some things in the snap mount namespace don’t seem to get updated when the underlying files are modified. The specific case where I noticed this is related /etc/resolv.conf

I was looking into the issue reported here: Slack snap won't install: "cannot create writable mimic over /etc: cannot open file /etc/passwd: permission denied"

I noticed that, at least with the slack snap, once it’s been started, it seems to somehow cache the contents of /etc/resolv.conf.

If I do:

snap run --shell slack
cat /etc/resolv.conf

Initially it’s the same as the standard system, but if I update the contents of the file in the system and then check from the snap point of view, it doesn’t get updated. Not even if I make sure there are no instances of that snap running, and shell into it again. It only seems to update if I reboot the system.

The specific snap I mentioned does have some layout for /etc, but nothing specific to /etc/resolv.conf

How does this work ? Is there some caching going on somewhere ? Is this an implementation decision at snapd level, or just normal for Linux mount namespaces ? Is this configurable somehow at the snapcraft definition level ?

Cheers, Just

Sorry to “bump”, but I am quite curious about this, and someone must know :slight_smile:

Cheers, Just

FYI I finally found the answer to this. It turns out to be an issue with the particular snap, for slack.

So, it seems nothing strange within the snap layers after all :slight_smile:

Cheers, Just