chroot fails with mount point passed to subprocess.Popen?
newton10471
newton10471 at gmail.com
Mon Mar 22 09:26:45 EDT 2010
Hi,
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 =
subprocess.Popen(['chroot',linuxFsRoot,'rpm','-q','kernel-xen'])
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