canonical / multipass

Multipass orchestrates virtual Ubuntu instances
https://multipass.run
GNU General Public License v3.0
7.87k stars 651 forks source link

[snap] strict confinement prevents mount/copy access outside of `/home` #1598

Open staffhorn opened 4 years ago

staffhorn commented 4 years ago

Describe the bug multipass mount and multipass copy-files fail for certain source paths.

To Reproduce How, and what happened?

multipass list
Name                    State             IPv4             Image
tatooine1               Running           10.180.176.113   Ubuntu 20.04 LTS
tatooine2               Running           10.180.176.131   Ubuntu 20.04 LTS
tatooine3               Running           10.180.176.240   Ubuntu 20.04 LTS

$ multipass mount /e/multipass tatooine1
Source path "/e/multipass" does not exist
$ ls /e/multipass
clusterup.sh  jupyterhub  k3s.yaml  README.md

Expected behavior What did you expect to happen? The host directory should mount on the instance. This works:

$ /e/multipass$ multipass mount /home/slett tatooine1
$ multipass info tatooine1
Name:           tatooine1
State:          Running
IPv4:           10.180.176.62
Release:        Ubuntu 20.04 LTS
Image hash:     fa1a86cdcf79 (Ubuntu 20.04 LTS)
Load:           0.35 0.24 0.10
Disk usage:     1.2G out of 4.7G
Memory usage:   162.5M out of 3.8G
Mounts:         /home/slett => /home/slett
                    UID map: 1000:default
                    GID map: 1000:default

Logs

Additional info

Name: tatooine2 State: Running IPv4: 10.180.176.131 Release: Ubuntu 20.04 LTS Image hash: fa1a86cdcf79 (Ubuntu 20.04 LTS) Load: 0.07 0.08 0.03 Disk usage: 1.5G out of 4.7G Memory usage: 257.4M out of 3.8G

Name: tatooine3 State: Running IPv4: 10.180.176.240 Release: Ubuntu 20.04 LTS Image hash: fa1a86cdcf79 (Ubuntu 20.04 LTS) Load: 0.07 0.02 0.00 Disk usage: 1.4G out of 4.7G Memory usage: 237.1M out of 3.8G



**Additional context**
Add any other context about the problem here.
This mount worked with the previous version of multipass (1.2.0)
Saviq commented 4 years ago

Hi @staffhorn, with Multipass going confined in v1.3.0, we currently can only support mounts from under /home. A bind mount is a potential workaround while we work on bringing back mounts from anywhere in the system.

As for copy-files, you can pipe the contents in via:

$ cat <source> | multipass copy-files - instance:<target>
staffhorn commented 4 years ago

Thanks for the explanation @Saviq . Knowing the reason, I can work around it until you have a solution.

staffhorn commented 4 years ago

Following up, it seems this is still a problem with the snap installation. Does the issue go away if I build multipass and install on Ubuntu from the github repo?

Saviq commented 4 years ago

Following up, it seems this is still a problem with the snap installation. Does the issue go away if I build multipass and install on Ubuntu from the github repo?

Hey, if you want to maintain it yourself, sure. It is snap confinement that (by design) prevents this.

staffhorn commented 4 years ago

I'll pass, thanks for the caveat.