# Running NCM in 'chroot' mode | Network Configuration Manager Help ## Running NCM in chroot mode ### Contents - [Mounting the partition](https://www.manageengine.com/network-configuration-manager/help/running-ncm-in-chroot-mode.html#Mounting_partition) - [Enabling chroot mode](https://www.manageengine.com/network-configuration-manager/help/running-ncm-in-chroot-mode.html#Enabling_chroot) - [Exiting chroot mode](https://www.manageengine.com/network-configuration-manager/help/running-ncm-in-chroot-mode.html#Exit_chroot) - [Reference](https://www.manageengine.com/network-configuration-manager/help/running-ncm-in-chroot-mode.html#Reference) ## Steps involved in running your NCM Server in Chroot Mode ### 1. For Mounting partition execute the below commands The root partition of the Linux system that you are trying to chroot into needs to be mounted first. To find out the device name assigned by the kernel, run: ``` # lsblk ``` Then create a directory for mounting the root partition to, and mount it: ``` # mkdir /NCM/test1 # mount /dev/sda1 /NCM/test1 ``` ![Mounting partition](https://lh3.googleusercontent.com/Kb8adGCfM1nd4oa5RkbpWmi3gDHHki5Mam8c1WH5aGL9p0PzDYKVz7358IeiqqEyDx1e1mYYv4dXmsSKjVjPZHOS3MYhbwOHoXFgqISBJtlwUnsp0qvF_rAGcCDPTo4pefKNTfAq) ### 2. For enabling chroot execute the below commands Mount the temporary API filesystems: ``` # cd /NCM/test1 # mount -t proc proc proc/ # mount --rbind /sys sys/ # mount --rbind /dev dev/ # mount --rbind /run run/ ``` To use an internet connection in the chroot environment copy over the DNS details: ``` # cp /etc/resolv.conf etc/resolv.conf ``` To change root into a bash shell: ``` # chroot /NCM/test1 /bin/bash ``` After chrooting it may be necessary to load the local bash configuration: ``` # source /etc/profile # source ~/.bashrc ``` ![Enabling chroot](https://lh4.googleusercontent.com/P5n6QbzL-fSKKOipWaQgN89iQG2PojyPCI8yvQRbwoqCLgqkTbPFh8wUHJ4FF2C4J4ZPN0NfHYp8w__GbdtxzkbH8k7qEi6fH59DrQdauAsvZtP049cE110_Ug1L-R46N3lXCHE-) ![Enabling chroot](https://lh6.googleusercontent.com/q_ewob0ZPS_N27-Uhc-j1gtoS9P5dCJ_sTM-QpLEwox7i4o50_0_sgI_TXJfIX7rznpquQWORALHVrqJsqnELbfSDEhKKbmcNVX_WMtl8-K6RCYCLxxeaj2WXSYFQp6V49O4gwvI) ![Enabling chroot](https://lh4.googleusercontent.com/YVOrCV4J_-gTw5GY2-_L6m7f9W1KGV6KIqMH7FBEESkqgfgQR8Dg1tdqWgNjfmjgSMcDJvO81uzo0tc_MAIQymWDT_4I9snbtiPcR-AuU1h8rW3HIgV0Sf9IQajPh82VjO9HAtDU) ### 3. Exit from the chroot environment To exit the chroot environment, use the following command: ``` #exit ``` Last, unmount the temporary filesystems and the root partition: ``` #cd / #umount --recursive /NCM/test1 ``` **Note:-** If you get the below error message while executing proc command: ``` Error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory ``` Then, execute the following command: ``` mount -t proc none /proc ``` ### Reference:- 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