I’m looking at reproducing this with the new details right now.
EDIT: I failed reproducing this. Here is what I tried. I used snapd 2.35.4 from Ubuntu Cosmic:
snap 2.35.4+18.10
snapd 2.35.4+18.10
series 16
ubuntu 18.10
kernel 4.18.0-8-generic
There I created an application with the following definition:
name: app
version: 1
apps:
app:
command: bin/app
layout:
$SNAP/api/tmp:
bind: $SNAP_DATA/rails/tmp
$SNAP/api/log:
bind: $SNAP_DATA/rails/log
$SNAP/api/vendor:
bind: $SNAP_DATA/rails/vendor
$SNAP/api/Gemfile:
bind-file: $SNAP_DATA/rails/Gemfile
$SNAP/api/Gemfile.lock:
bind-file: $SNAP_DATA/rails/Gemfile.lock
I made a dummy bin/app
shell script that just prints ok
. Apart from bin/app
and meta/snap.yaml
there were no other files present in the snap.
Running the application I get ok
and a working layout. I can then run snap run --shell app
to explore the environment.
zyga@fyke:$ snap run --shell app
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
zyga@fyke:$ cd $SNAP
zyga@fyke:/snap/app/x1$ find
.
./api
./api/vendor
./api/tmp
./api/log
./api/Gemfile
./api/Gemfile.lock
./meta
./meta/snap.yaml
./bin
./bin/app
Looking at $SNAP_DATA, I see:
zyga@fyke:/snap/app/x1$ cd $SNAP_DATA
zyga@fyke:/var/snap/app/x1$ find
.
./rails
./rails/Gemfile.lock
./rails/tmp
./rails/Gemfile
./rails/vendor
./rails/log
Lastly I can inspect the mount namespace but this requires more privileges so I leave the confined shell (exit) and inspect the mount namespace using the nsenter command.
zyga@fyke:/var/snap/app/x1$ exit
exit
zyga@fyke:$ sudo nsenter -m/run/snapd/ns/app.mnt
root@fyke:/# cat /proc/self/mountinfo | tail -n 6
2130 2257 0:56 / /snap/app/x1/api rw,relatime - tmpfs tmpfs rw,mode=775,uid=1000,gid=1000
2067 2130 8:1 /var/snap/app/x1/rails/Gemfile.lock /snap/app/x1/api/Gemfile.lock rw,relatime master:1 - ext4 /dev/sda1 rw,errors=remount-ro
2131 2130 8:1 /var/snap/app/x1/rails/Gemfile /snap/app/x1/api/Gemfile rw,relatime master:1 - ext4 /dev/sda1 rw,errors=remount-ro
2132 2130 8:1 /var/snap/app/x1/rails/log /snap/app/x1/api/log rw,relatime master:1 - ext4 /dev/sda1 rw,errors=remount-ro
2133 2130 8:1 /var/snap/app/x1/rails/tmp /snap/app/x1/api/tmp rw,relatime master:1 - ext4 /dev/sda1 rw,errors=remount-ro
2134 2130 8:1 /var/snap/app/x1/rails/vendor /snap/app/x1/api/vendor rw,relatime master:1 - ext4 /dev/sda1 rw,errors=remount-ro
As you can see /snap/app/x1/api
is a tmpfs populated with the objects from $SNAP_DATA
(in this case /var/snap/app/x1/
).
Can you tell me what I am missing in this test?