1
On a Debian Jessie machine I have a rootfs image which I chroot in this way:
mount myimage.img /mnt/myimage
cp /usr/bin/qemu-arm-static /mnt/myimage/usr/bin/
mount --rbind /dev /mnt/myimage/dev
mount -t proc none /mnt/myimage/proc
mount -o bind /sys /myimage/sys
chroot /mnt/myimage
on exiting I do the opposite:
rm /mnt/myimage/usr/bin/qemu-arm-static
umount /mnt/myimage/sys
umount /mnt/myimage/proc
umount /mnt/myimage/dev
umount -l /mnt/myimage
But when I try to open a new terminal in my host machine I get the following error:
Execution of the child process failed
getpt failed: file or directory not exists (translated from Italian)
Perhaps I'm forgetting something?
I see nothing obviously wrong, though I would use the full path to
myimage.img
, because the current directory may not set when the command is executed. Are you using~/.bashrc
or~/.bash_login
for the start-up commands? I presume the commands work when you type them manually. – AFH – 2016-06-07T15:36:49.693You're right about the absolute path, it's a development dir with both scripts sticked there, but it's better to use full path. I use those commands in a /bin/bash script, but the behavior is the same even if I type them manually. – Mark – 2016-06-07T15:39:32.660
If you type them one at a time, which command fails? – AFH – 2016-06-07T15:40:55.583
I don't see any error. But after the last umount I cannot open a new terminal in my Debian machine. I need to reboot, exiting and logging in again it's not enough. – Mark – 2016-06-07T15:45:48.267
Looking in more detail,
mount --rbind /dev /mnt/myimage/dev
will replace the/dev
directory with whatever is in the/dev
directory in your image: do you have all the terminal definitions there? – AFH – 2016-06-07T17:54:55.937I have them (I guess you're talking about the tty* devices). But unmounting /mnt/myimage/dev should not restore the initial state? – Mark – 2016-06-07T18:04:29.627
Yes, it would, but if the shell doesn't start there is nothing to execute the logout commands. Do you have the usual utilities in
/bin
(includingbash
) in yourmyimage.img
file system? – AFH – 2016-06-07T22:20:51.717