Debian

如何在 chroot 中執行 lxc

  • June 24, 2019

我正在嘗試在 chroot 中執行 lxc 。

$ lxc-start -n instrument --logfile=/dev/stdout
lxc-start 20190619141851.659 ERROR    lxc_cgfs - cgroups/cgfs.c:cgfs_init:2359 - cgroupfs failed to detect cgroup metadata

我嘗試掛載(目標路徑是我的 chroot):

/bin/bash -c "sudo mount --bind /proc ${target}/root/proc/"
/bin/bash -c "sudo mount --bind /sys ${target}/root/sys/"
/bin/bash -c "sudo mount --bind /dev ${target}/root/dev/"
/bin/bash -c "sudo mount --bind /dev/pts ${target}/root/dev/pts"

/bin/bash -c "sudo mount --bind /sys/fs ${target}/root/sys/fs"

安裝 cgroupfs-mount 並執行它似乎足以掛載所有需要的 cgroupfs 掛載。

apt install cgroupfs-mount
/usr/bin/cgroupfs-mount

引用自:https://unix.stackexchange.com/questions/525857