Contents |
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
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
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