Changing the root directory is useful when you need to repair a Debian install from a Live CD or a another working system, or for maintaining another system, or updating it, or installing packages on it, while you get on with other work.
First you mount the system's partition. Then you need to mount dev, proc and sys of the running system so that the mounted system can communicate with the computer's devices -as these are only loaded at start up.
"/etc/resolv.conf" is made by the network manager you use and the mounted system will not have the file, so it needs to be copied over if you intend to access the network from the mounted system.
plus if /var is on another partition, you will need to mount it, e.g.
check mounts with `mount`
then change to the root of that system so you can run commands in it..
The other partition's system is then mounted and you can run whatever maintenance that's needed.
To finish, you exit the chroot environment with `exit`
then unmount the filesystems with
To use aptitude in a chroot environment, and the error occurs "Could not open lock file /var/lock/aptitude No such file or directory" , do
Chroot using scripts
run these as root user, to chroot to any Linux OS and then unmount afterwards..