This is a simple python script that runs a command inside of user-mode-linux. This allows you, for example, to run binaries that require a different linux version than the host operating system.
You will need a UML kernel and root filesystem. I have successfully used linux-2.4.22-8um/linux and root_fs.rh-7.2-full.pristine.20020312.bz2, running on host operating systems of either Red Hat 6.x, 7.x, or 9.x vintage. It also works on Fedora.
You can also use a smaller root filesystem, such as root_fs.rh-7.2-server.pristine.20020312.bz2, but you will need to install python (1.5 or higher) for the inner job wrapper.
Here are the steps taken by the job wrapper to run the command in user-mode-linux:
/afs
are treated this way.
The following command will run 'free' inside of the UML kernel.
Be patient while UML boots up and shuts down, or use the --echo
option to see what is happening during the pauses.
uml_job_wrapper free
You can control various UML parameters, such as memory/swap size using environment variables or command-line options. Example:
uml_job_wrapper --mem=100M free
See uml_job_wrapper --help
for additional usage information.
A complete UML package, including the wrapper script, a UML kernel, and a UML filesystem may be found here: uml_rh7.tgz.
Using linux-2.4.22-8um, an application (OSCAR) has been observed to consistently fail with mem>=300M. The failure happens after 12+ hours and often causes the UML tracing thread and the application to enter some sort of rapid interaction that causes the rate of context switches to become very high and no further progress is made by the job. When strace is used on the tracing thread, it appears to be delivering SEGFAULT signals to the application. Setting mem=200M (with 200M swap) allows the application to run to completion. A similar problem seems to happen in skas mode. In both cases, it is suspicious that with the memory over the limit of what works, the UML kernel displays something like the following message when booting up: "Kernel virtual memory size shrunk to 217055232 bytes".