chroot fails with mount point passed to subprocess.Popen?

newton10471 newton10471 at
Mon Mar 22 14:26:45 CET 2010


I'm trying to use subprocess.Popen() to do a Linux chroot to a mount
point passed in as a parameter to the following function:

def getInstalledKernelVersion(mountPoint):
    linuxFsRoot = mountPoint + "/root"
    print "type of linuxFsRoot is %s" % type(linuxFsRoot)
    installedKernelVersionResult =
    return installedKernelVersionResult

and it dies with the following:

type of linuxFsRoot is <type 'str'>
chroot: cannot change root directory to /storage/mounts/
mnt_3786314034939740895.mnt/root: No such file or directory

When I explicitly set linuxFsRoot = "/storage/mounts/
mnt_3786314034939740895.mnt/root", it works fine.

I also tried this to concatenate the mountpoint + /root, and it failed
in the same way:

linuxFsRoot = ("%s/root") % mountPoint

Anyone know what might be happening here?

Thanks in advance,

Matt Newton

More information about the Python-list mailing list