I've recently started deving on a M1 mac, and I wanted to get a simple linux system virtualized. Multipass seemed like a great idea, until I was struggling to forward ports.
So I created a very simple qemu machine, modeled off the way multipass emulates their instances here it is:
qemu-system-aarch64 \
-machine virt,highmem=off \
-accel hvf \
-name ubuntu-qemu \
\
-cpu cortex-a72 \
-smp 4 \
\
-m 4096 \
\
-drive file=edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on \
-drive file=ubuntu-os.qcow2,if=virtio \
\
-nographic \
\
-net nic,model=rtl8139 \
-net user,hostfwd=tcp::2222-:22 \
\
-fsdev local,id=projects,path=/Users/cdf/Projects,security_model=none \
-device virtio-9p-pci,fsdev=projects,mount_tag=projects
This starts up a very simple ubuntu machine, works great I can forward ports.
the only thing I can't get right is how to share a folder as you can see above I'm trying:
-fsdev local,id=projects,path=/Users/cdf/Projects,security_model=none \
-device virtio-9p-pci,fsdev=projects,mount_tag=projects
on the instance, I have created an entry in /etc/fstab
to mount projects
projects /home/cdf/projects 9p trans=virtio 0 0
and this seems to be working... to a point
I can access the share, however I can't write changes to the share:
cdf@ubuntu:~$ ll ./projects
ls: ./projects: Network dropped connection on reset
ls: ./projects/.: Network dropped connection on reset
ls: ./projects/yoco: Network dropped connection on reset
ls: ./projects/cdf: Network dropped connection on reset
total 4
drwxr-xr-x 4 503 dialout 128 Mar 24 07:26 ./
drwxr-xr-x 14 cdf cdf 4096 Mar 26 18:37 ../
drwxr-xr-x 4 503 dialout 128 Mar 24 07:27 cdf/
I also wanted to make the owner and group cdf
like multipass mounts do. I'm not too sure what to do to get the mount to work properly, can anyone help me?