Creating Custom Operating System Images¶
What is an Operating System ID (OSID) versus an Image ID?¶
In order to make the best use of custom operating system images, it is important to understand the difference between these two concepts.
An Image ID is a descriptor for a disk image. This can be an image of an entire disk, a partition of a disk, or a set of partitions of a disk. By supporting multiple partitions, we can technically support different operating systems within the same disk image. These are referred to as combo images. The Image ID points to a real file that is stored in the directory
/proj/YourProjectName/images. Other critical information is associated with the Image ID, such as what node types are supported by the images and what operating systems are on each partition. You can view the Image IDs on the List ImageIDs page, which is in the Experimentation drop down menu on the testbed web interface.
An OSID describes an operating system which resides on a partition of a disk image. Every Image ID will have at least one OSID associated with it. In typical testbed usage, the Image ID and OSID will be the same since we usually do not put multiple operating systems on a single image. You can view the OSIDs on the List OSIDs page, which is in the Experimentation drop down menu on the testbed web interface.
Standard Testbed Images¶
We provide a number of supported testbed images here at DETERLab. These images can be viewed by looking at the Operating System ID list.
Most new operating system images that we support are whole disk images, which is different from the more traditional scheme of using partition 1 for FreeBSD and partition 2 for Linux. To view what nodes a particular operating system image runs on and what sort of partition scheme it uses, please refer to the Image ID list page.
The supported testbed images are listed in the Operating System Images documentation page.
Custom OS Images¶
If your set of operating system customizations cannot be easily contained within an RPM/TAR (or multiple RPM/TARs), then you can create your own custom OS image. DETERLab allows you to create your own disk images and load them on your experimental nodes automatically when your experiment is created or swapped in.
Once you have created a custom disk image (and the associated ImageID/OSID descriptor for it, you can use that OSID in your NS file. When your experiment is swapped in, the testbed system will arrange for your disks to be loaded in parallel using a locally written multicast disk loading protocol.
Experience has shown that it is much faster to load a disk image on 10 nodes at once, then it is to load a bunch of RPMS or tarballs on each node as it boots. So while it may seem like overkill to create your own disk image, we can assure you it is not.
The most common approach is to use the New Image Descriptor form to create a disk image that contains a customized version of a standard Linux or the FreeBSD image. All you need to do is enter the node name in the form, and the testbed system will create the image for you automatically, notifying you via email when it is finished. You can then use that image in subsequent experiments by specifying the descriptor name in your NS file with the
tb-set-node-os command. When the experiment is configured, the proper image will be loaded on each node automatically by the system.
Creating Your Custom Image¶
A typical approach to creating your own disk image is using one of the default images as a base or template. To do this:
Create a single-node Linux or FreeBSD experiment. In your NS file, use the appropriate
tb-set-node-oscommand, as in the following example:
tb-set-node-os $nodeA FBSD-STD tb-set-node-os $nodeA Ubuntu-STD
After your experiment has swapped in (you have received the email saying it is running), log into the node and load all of the software packages that you wish to load. If you want to install the latest version of the Linux kernel on one of our standard disk images, or on your own custom Linux image, be sure to arrange for any programs that need to be started at boot time. It is a good idea to reboot the node and make sure that everything is running as expected when it comes up.
- If you are creating a Windows-based image, you must "prepare" the node. The final thing to do before grabbing the image is to login on the console, drop to single user mode, and run the
preparescript. This is described in detail in the custom Windows images section of the Windows page.
- Note the physical (
pcXXX) name of the machine used!
- Create an image descriptor and image using the New Image Descriptor form.
- Wait for the email saying the image creation is done.
- Now you can create a second single-node experiment to test your new image. In your NS file, use
tb-set-node-osto select the OSID that you just created. Be sure to remove any RPM or tarball directives. Submit that NS file and wait for the email notification. Then log into the new node and check to make sure everything is running normally.
If everything is going well, terminate both of these single-node experiments. If not, release the experiment created in the previous step, and then go back and fix the original node (
pcXXXabove). Recreate the image as needed:
create_image -p <proj> <imageid> <node>
Once your image is working properly, you can use it in any NS file by using the
tb-set-node-oscommand. If you ever want to reload a node in your experiment, either with one of your images or with one of the default images, you can use the
os_loadcommand. Log into
os_load -p <proj> -i <imageid> <node>
This program will run in the foreground, waiting until the image has been loaded. At that point you should log in and make sure everything is working okay. You might want to watch the console line as well (see the Node Console section). If you want to load the default image, then simply run:
Hints When Making New OS Images¶
- Please, never try to create an image from a node or type that begins with the letter b, e.g. bpc183 or bpc2133. These nodes are located in Berkeley which is physically located 400 miles away from the
After you have created an image, load it back and watch what happens through the serial port.
Consider creating a two node experiment, one to create the image and the other to load it back.
There is a command called
os_loadavailable on the
users% which os_load /usr/testbed/bin/os_load users% os_load -h option -h not recognized os_load [options] node [node ...] os_load [options] -e pid,eid where: -i Specify image name; otherwise load default image -p Specify project for finding image name (-i) -s Do *not* wait for nodes to finish reloading -m Specify internal image id (instead of -i and -p) -r Do *not* reboot nodes; do that yourself -e Reboot all nodes in an experiment node Node to reboot (pcXXX)
While the second node is reloading, watch its progress in real time using the console command from the
users% console pc193
If you think you've got a good image, but it flounders while coming up, create another experiment with an NS directive that says "Even if you think the node has not booted, let my experiment swap in anyway." This may allow you to log in through the console and figure out what went wrong. An example of such a directive is:
tb-set-node-failure-action $nodeA "nonfatal"
Create whole disk images on a smaller machine rather than a single partition image.
Updating your Custom Image¶
Once you have your image, it is easy to update it later by taking a new snapshot from a node running your image. Assuming you have swapped in an experiment with a node running your image and you have made changes to that node, use the DETERLab web interface to navigate to the descriptor page for your image:
- Use the Experimentation drop down menu, and choose List ImageIDs to see the entire list of Images you may access.
- Find your custom image and click on it.
- In the More Options menu, click on Snapshot Node ...
- Fill in the name of the node that is running your image, and click on Go.
- As in the above instructions, wait for the email saying your image has been updated before you try and use the image.