Subject: Sharing the store between a host and a guest

From: Damien Cassou <[email-masked]>
Date: Fri, 28 Feb 2020 07:50:46 +0100

Hi,

I kept experimenting. I can't manage to install anything in the VM:

$ guix pull
Updating channel 'guix' from Git repository at 'file:///home/cassou/...'
guix pull: error: Git error: failed to mmap. Could not write data:
Invalid argument

The folder at 'file:///home/cassou/...' contains a git clone of Guix
repository and the VM has read-write access to it.

$ mount | grep /gnu/store
/dev/vda1 on /gnu/store type ext4 (ro,relatime)

I don't understand why /gnu/store is mounted read-only. Also, I haven't
done that myself.

$ cat ./build-vm.sh
#!/bin/sh

FILE=$(guix system vm-image ./current.scm --save-provenance --image-size=6G --share=/home/cassou=/mnt/host-home)

cp -f "$FILE" ./image.qcow2

$ cat ./start-vm.sh
#!/bin/sh

qemu-system-x86_64 \
    -nic user,model=virtio-net-pci \
    -enable-kvm \
    -m 4G \
    -device virtio-blk,drive=myhd \
    -drive if=none,file=./image.qcow2,id=myhd \
    -virtfs local,path="/home/cassou",security_model=none,mount_tag="host-home" \
    -virtfs local,path="./share/home",security_model=none,mount_tag="guest-home"

As you can see, I'm not even trying to share the store. Moreover, I
think the --share option passed to `guix system vm-image` above doesn't
do anything. If it is the case, I would expect the command to complain
about the unknown parameter.

Can anyone please give me a clue as to what is happening and why? Is
there a way I can install applications in my VM?

-- 
Damien Cassou

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill