Escaping my own chroot...

r0g aioe.org at technicalbloke.com
Wed Feb 11 00:55:17 CET 2009


I'm writing a linux remastering script in python where I need to chroot
into a folder, run some system commands and then come out and do some
tidying up, un-mounting proc & sys etc.

I got in there with os.chroot() and I tried using that to get back out
but that didn't work so... is my script trapped in there forever now or
is there an un-hacky way to escape?

If it is an OS restriction rather than my ignorance of python is there a
canonical way of dealing with it? Should I maybe fork a process, have it
do the chroot and wait for it to terminate before continuing?

Apologies if this turn out to be OT!


Roger.



More information about the Python-list mailing list