目录 |
您尝试chroot进入的Linux系统根分区需要先挂载。要找出内核分配的设备名称,请运行:
# lsblk
然后创建一个用于挂载根分区的目录,并将其挂载:
# mkdir /NCM/test1
# mount /dev/sda1 /NCM/test1
挂载临时API文件系统:
# cd /NCM/test1
# mount -t proc proc proc/
# mount --rbind /sys sys/
# mount --rbind /dev dev/
# mount --rbind /run run/
要在chroot环境中使用互联网连接,请复制DNS详细信息:
# cp /etc/resolv.conf etc/resolv.conf
将root更改为bash shell:
# chroot /NCM/test1 /bin/bash
chroot后可能需要加载本地bash配置:
# source /etc/profile
# source ~/.bashrc
要退出chroot环境,请使用以下命令:
#exit
最后,卸载临时文件系统和根分区:
#cd /
#umount --recursive /NCM/test1
注意:
如果您在执行proc命令时收到以下错误消息:
加载共享库时出错:libjli.so:无法打开共享对象文件:没有这样的文件或目录
之后请执行以下命令:
mount -t proc none /proc