Accessing zfs files form host

,

Is there a way to access the chroot of a system from the host?

$ lxc storage ls
+---------+-------------+--------+--------------------------------------------+---------+
|  NAME   | DESCRIPTION | DRIVER |                   SOURCE                   | USED BY |
+---------+-------------+--------+--------------------------------------------+---------+
| default |             | zfs    | /var/snap/lxd/common/lxd/disks/default.img | 23      |
+---------+-------------+--------+--------------------------------------------+---------+
$ lxc ls i3
+------+---------+------+-----------------------------------------------+-----------------+-----------+
| NAME |  STATE  | IPV4 |                     IPV6                      |      TYPE       | SNAPSHOTS |
+------+---------+------+-----------------------------------------------+-----------------+-----------+
| i3   | RUNNING |      | fd42:74bf:7b0f:f323:216:3eff:fe91:a764 (eth0) | VIRTUAL-MACHINE | 0         |
+------+---------+------+-----------------------------------------------+-----------------+-----------+

The qemu process is running as:

/snap/lxd/19647/bin/qemu-system-x86_64 -S -name i3 -uuid fac68ea8-4392-4e20-b498-7a94878f7453 -daemonize -cpu host -nographic -serial chardev:console -nodefaults -no-reboot -no-user-config -sandbox on,obsolete=deny,elevateprivileges=allow,spawn=deny,resourcecontrol=deny -readconfig /var/snap/lxd/common/lxd/logs/i3/qemu.conf -pidfile /var/snap/lxd/common/lxd/logs/i3/qemu.pid -D /var/snap/lxd/common/lxd/logs/i3/qemu.log -chroot /var/snap/lxd/common/lxd/virtual-machines/i3 -smbios type=2,manufacturer=Canonical Ltd.,product=LXD -runas lxd

So I would expect the chroot to be in:

$ ls /var/snap/lxd/common/lxd/virtual-machines/i3

But it seems to be empty.

How can the process access the ‘chroot’ from this empty folder and is there a way to access the chroot from the host for debugging purposes?

nsenter --mount=/run/snapd/ns/lxd.mnt bash will get you a shell that can go look at this in there, not that you’re going to see much inside the qemu chroot.

1 Like

Okay thanks for the supper fast help!

Trying to debug a vm without console access and no lxd-agent installed so it’s a first step :grinning_face_with_smiling_eyes: