An Ubuntu Server 14.04 Host hosts an Ubuntu Server 14.04 guest via libvirt/qemu-kvm.
The system runs fine, but - as guest - I have issues writing to a shared folder (
<filesystem>) that drive me nuts. Both machines are relative vanilla installations.
I attached the given folder like this:
[host] $ virsh edit guest-vm-name # ... <filesystem type='mount' accessmode='mapped'> <source dir='/data'/> <target dir='/data'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </filesystem> # ...
From the guest I mount the filesystem as following:
[guest] $ sudo -u www-data mkdir /tmp/mnt [guest] $ sudo mount -t 9p -otrans=virtio,rw,version=9p2000.L /data /tmp/mnt
I use the
www-data user as that will be the efftive user later on, and group and user ids have to match if p9 is used, afaiu. That also means that on the host, /data (which is ext4 partition, LVM on RAID btw) looks like
[host] $ ls -lha /data [host] $ drwxrwxr-x 4 www-data www-data 4.0K Nov 11 08:34 . [host] $ drwxr-xr-x 24 root root 4.0K Nov 7 16:58 .. [host] $ drwxr-xr-x 2 www-data www-data 4.0K Nov 11 08:34 jail # ...
In the guest, if I try to write to anything on the shared filesystem, I get permission errors (irrespective of the used user):
[guest] $ sudo -u www-data touch /tmp/mnt/jail/letmeout touch: cannot touch ‘/tmp/mnt/jail/letmeout’: Permission denied
I can read files though
[guest] $ cat /tmp/mnt/jail/throughthewindow Great Weather!
I tried various things, especially:
- stopped apparmor service and called aa-complain (i hope that was effective)
- set security to none in
- set user and group to root in
/var/log/syslog and dmesg do not show anything suspicous.
Any pointers?! Thanks.