在chroot环境中挂载dev-proc-sys

mount

cd /location/of/new/root
mount -t proc /proc proc/
mount -t sysfs /sys sys/
mount --rbind /dev dev/

按照我的理解,mount -rbind a b相当于把a目录挂载到b目录,这样访问b目录就相当于访问a目录了。

如果运行某命令出现syslog is not available的报错,可以试试:

mount --rbind /run run/

来源:

https://wiki.archlinux.org/title/Chroot#Using_chroot

https://blog.csdn.net/sinat_37322535/article/details/117022038

umount

cd /location/of/new/root
umount proc/
umount sys/
mount --make-rslave dev/
umount -R dev/

run/同理。

来源:https://unix.stackexchange.com/questions/120827/recursive-umount-after-rbind-mount

posted @ 2024-09-28 14:08  寻找繁星  阅读(1)  评论(0编辑  收藏  举报