Adding a shared folder into VM

Hey,

I want to share the /var/cache/distfiles directory between the host and virtual machine. Sharing folders between the host and containers works as expected but when I try to share a directory between host and VM, I’m getting the following output:

┌─[doskanoness@spacev7-lapek] - [~] - [2021-10-09 07:30:40]
└─[0] <> lxc init gentoo-vm gentoo                                                                                                                                            ⚡[..........]
Creating gentoo
┌─[doskanoness@spacev7-lapek] - [~] - [2021-10-09 07:34:21]
└─[0] <> lxc profile add gentoo binserver                                                                                                                                     ⚡[..........]
Profile binserver added to gentoo
┌─[doskanoness@spacev7-lapek] - [~] - [2021-10-09 07:34:31]
└─[1] <> lxc start gentoo                                                                                                                                                     ⚡[..........]
Error: Failed to start device "distfiles": Failed to setup virtfs-proxy-helper for device "distfiles": Required binary "virtfs-proxy-helper" couldn't be found
Try `lxc info --show-log gentoo` for more info
┌─[doskanoness@spacev7-lapek] - [~] - [2021-10-09 07:34:40]
└─[1] <> lxc start gentoo                                                                                                                                                     ⚡[..........]
Error: Failed to start device "distfiles": remove /var/lib/lxd/devices/gentoo/disk.distfiles.var-cache-distfiles-: device or resource busy
Try `lxc info --show-log gentoo` for more info
┌─[doskanoness@spacev7-lapek] - [~] - [2021-10-09 07:36:24]
└─[0] <> lxc profile show binserver                                                                                                                                           ⚡[..........]
config:
  limits.cpu: "12"
  limits.memory: 8GB
description: ""
devices:
  distfiles:
    path: /var/cache/distfiles/
    shift: "true"
    source: /var/cache/distfiles/
    type: disk
name: binserver
used_by:
- /1.0/instances/gentoo

Any ideas?

Error: Failed to start device "distfiles": Failed to setup virtfs-proxy-helper for device "distfiles": Required binary "virtfs-proxy-helper" couldn't be found

That’s the real issue here. What distribution are you running LXD on?

Ideally you’d want to get virtfs-proxy-helper on your system, if that’s not possible, a workaround would be to set migration.stateful=true on the instance which has the side-effect of disabling virtfs and only support (the much slower) 9p.

What distribution are you running LXD on?

Gentoo. I’ve ZFS on the root

a workaround would be to set migration.stateful=true on the instance

┌─[doskanoness@spacev7-lapek] - [~] - [2021-10-09 08:21:41]
└─[130] <> lxc config set gentoo3 migration.stateful true                                                                                                                     ⚡[..........]
┌─[doskanoness@spacev7-lapek] - [~] - [2021-10-09 08:21:48]
└─[0] <> lxc start gentoo3                                                                                                                                                    ⚡[..........]
Error: Failed to start device "distfiles": Failed to setup virtfs-proxy-helper for device "distfiles": Required binary "virtfs-proxy-helper" couldn't be found
Try `lxc info --show-log gentoo3` for more info

Still can’t mount /var/cache/distfiles directory