在chroot模式下运行NCM

目录

 

在Chroot模式下运行NCM服务器所涉及的步骤

 

1. 对于挂载分区,请执行以下命令

您尝试chroot进入的Linux系统根分区需要先挂载。要找出内核分配的设备名称,请运行:

# lsblk

然后创建一个用于挂载根分区的目录,并将其挂载:

# mkdir /NCM/test1

# mount /dev/sda1 /NCM/test1

 

 

 

2.为了启用chroot,请执行以下命令:

挂载临时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

 

3.退出chroot环境

要退出chroot环境,请使用以下命令:

#exit

最后,卸载临时文件系统和根分区:

#cd /

#umount --recursive /NCM/test1

 

注意:

如果您在执行proc命令时收到以下错误消息:

加载共享库时出错:libjli.so:无法打开共享对象文件:没有这样的文件或目录

之后请执行以下命令:

mount -t proc none /proc

 

参考文献:

  1. https://wiki.archlinux.org/index.php/change_root#Exit_from_the_chroot_environment

  2. https://superuser.com/questions/487695/java-wont-run-under-chroot-cause-it-can-not-find-shared-libraries

Back to Top