Run a few Python commands from a temporary filesystem when the rootfs is halted

Frederick Grose fgrose at
Sat Apr 23 02:52:51 CEST 2011

Forwarded conversation
Subject: Run a few Python commands from a temporary filesystem when the
rootfs is halted

From: *Frederick Grose* <fgrose at>
Date: Fri, Apr 22, 2011 at 7:54 PM
To: tutor at

With Bash, when one needs to halt the current root filesystem, to pivot to a
new filesystem, one can copy some of the command files and their
dependencies to a temporary file system and execute from that code base.

Is there a way to accomplish the same within a Python script?

Or must I chain Python and Bash together for this?


From: *Steve Willoughby* <steve at>
Date: Fri, Apr 22, 2011 at 7:59 PM
To: tutor at

I'm not sure those words mean what you think they mean, or I'm missing what
you're trying to do here.  halting the root filesystem? pivot? code base?

You're not trying to talk about jail/chroot, perhaps?

Steve Willoughby / steve at
"A ship in harbor is safe, but that is not what ships are built for."
PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C
Tutor maillist  -  Tutor at
To unsubscribe or change subscription options:

From: *Frederick Grose* <fgrose at>
Date: Fri, Apr 22, 2011 at 8:14 PM
To: tutor at

The particulars are that I've rebuilt a Fedora LiveOS filesystem image from
a currently running instance (incorporating the filesystem changes in the
device-mapper overlay into a new base filesystem image file).

I'd like to halt the active rootfs, switch to its mirror, copy over the
halted filesystem image file with the refreshed version, and then switch


From: *Steven D'Aprano* <steve at>
Date: Fri, Apr 22, 2011 at 8:22 PM
To: tutor at

This is way off-topic for a Python tutor list. This is about learning the
Python programming language, not the intricate corners of (I assume) Linux
system administration.

I would imagine that it would be very, very difficult in Python, because you
would need somehow to end the *current* Python process and start up a *new*
Python process running from executables on the new file system, without
manual intervention.

I strongly suggest you take this question to the main Python list,
python at, which is also available as a news group comp.lang.python,
and show the bash code you are trying to duplicate. There's no guarantee
you'll get an answer there either, but it's more likely than here.

Good luck!


The Bash code I'm trying to simulate is from Douglas McClendon's

After copying /sbin/dmsetup and its dependencies to
/dev/shm/zyx-liveinstaller (/dev/shm is mounted on a tmpfs), the following
code is executed:

LD_LIBRARY_PATH=/dev/shm/zyx-liveinstaller \
    /dev/shm/zyx-liveinstaller/dmsetup \
    --noudevrules --noudevsync \
    suspend "${liveos_root_dev}"
LD_LIBRARY_PATH=/dev/shm/zyx-liveinstaller \
    /dev/shm/zyx-liveinstaller/dmsetup \
    --noudevrules --noudevsync \
    resume "${liveos_root_dev}-sub"
LD_LIBRARY_PATH=/dev/shm/zyx-liveinstaller \
    /dev/shm/zyx-liveinstaller/dmsetup \
    --noudevrules --noudevsync \
    resume "${liveos_root_dev}"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list