![如何在 chroot 中运行 lxc](https://linux22.com/image/155714/%E5%A6%82%E4%BD%95%E5%9C%A8%20chroot%20%E4%B8%AD%E8%BF%90%E8%A1%8C%20lxc.png)
我正在尝试在 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"
答案1
安装 cgroupfs-mount 并运行它似乎足以挂载所有需要的 cgroupfs 挂载。
apt install cgroupfs-mount
/usr/bin/cgroupfs-mount