Working with Minix 3 on Ubuntu with VirtualBox

In my OS course, we use the Minix operating system. We have various assignments that require us to edit kernel source code, etc. We use virtual machines for doing our work, and my preferred VM software is VirtualBox. There seems to be little info about using Minix with VirtualBox on the net, as Minix is not officially supported by VBox. Nevertheless it can be used fine. I am going to write about my own setup in roughly tutorial form.

First, about my software versions. At the time of this writing, I am using:

  1. the latest stable Ubuntu, which is Jaunty Jackalope, version 9.04, as the host operating system,
  2. the latest stable VirtualBox, which is version 3.0.4, and,
  3. the latest stable Minix 3, version 3.1.3a

It is quite simple to install Virtualbox on Ubuntu.

Installing Minix on VBox

My own VM settings are 128 MB RAM and a 1 GB virtual hard disk.

Installing packages

Packages that are useful for me: flex, gcc, emacs, less, make.


Networking has not been possible to setup. I have tried to get bridged networking to work, so that files can be shared via ssh, but it has not worked yet. I will update if I do succeed. Please post in the comments if you have any tips.

Networking would have been ideal for transferring files both ways between the two OSes, but I am managing with one way transfers for now (Linux to Minix).

Exchanging files between Minix and Ubuntu

I have so far only succeeded in copying files into the guest OS and not vice versa. Since networking has not worked for me, I transfer files via cd images. To transfer single files, create a cd image containing the files in Ubuntu with:

mkisofs -o t.iso <list of single files>

Then, mount the cd image in the VM through VBox’s GUI: Devices->Mount CD ROM. To read the cdrom in Minix, use the isoread, and isodir commands. To copy files from the cd, use a command of the form:

isoread - /dev/c0d2 src.c > src.c

Don’t forget the hyphen after “isoread”.

Copying a whole directory into minix may seem complex using the above method, but the trick is to create a tar file out of the directory we want to copy. We copy the tar archive into minix using the method discussed above and then extract it in the guest.

Getting Minix kernel sources

This initially turned out to be challenging, because though the source code is available in the VM at /usr/src, it can’t be copied to the host for editing using powerful editors in Linux. The source code is available on the Minix cd but it is present in a cd sub-partition that is in the Minix filesystem format. Also, there is no readily available download package on the Minix website.

But there is the SVN repo. The only thing to find is the right revision for the version of Minix we use. Looking the tags folder, helped. To download the sources for my version, I fired off a terminal and typed:

svn checkout

Enter the username as “anonymous” and enter a blank password.

To get rid of the .svn folders (these are not part of Minix source code) inside the sources folder we downloaded, use the following command from inside the folder created by the subversion checkout:

find . -name ".svn$" | xargs rm -rf

Now our sources are ready for editing.

Recompiling the Minix kernel

After we edit sources, we copy the files into Minix’s /usr/src. Then, from /usr/src/ we type:

make world

If everything works, this builds a new kernel and sets it up for booting. Type “shutdown” to shutdown the VM, and from the boot prompt, type “boot d0p0″ to start minix. In the resulting boot menu enter “3”, and we boot into the kernel we just modified! More information about recompiling is here.


About these ads

7 Responses

  1. nice work.

  2. Thanks for the comprehensive info.

  3. “Exchanging files between Minix and Ubuntu”
    September 8, 2009 by imdonatello

    If you are willing to create a msdos floppy drive image under Ubuntu, since VirtualBox will mount a floppy drive image and has mtools command, you can get 2-way transfer of files between Ubuntu and Minix3.

    It requires some mount and umount commands as well as mkdosfs -C and mkdir a empty (new) temporary mount point and use of mount -o loop, using the commands in the correct order.

    Mounting to a non-empty mount point is not a good idea because of probable data loss. I used /mnt/tmp/ as my mount point because there wasn’t anything in the /mnt directory on my Ubuntu system.

    There is probable alternative method of creating floppy image using dd but I didn’t try it with dd.

    Virtual Box:
    VBox has a Settings tab and also the VBox/Minix3 terminal has a Devices menu and both can be used to mount and un-mount the floppy image.

    The first time I mounted the floppy image file I used the VBox Settings tab, but after that I used the Minix Devices menu. I also recall that I disabled 2 of the boot options (Floppy, CD/DVD). So only VBox virtual drive is used to boot Minix3. This might have been to avoid VBox trying to boot the floppy image. Also, I believe I unmounted the floppy image under Minix3 using the Devices tab before using the shutdown command in the Minix3 terminal.

    In Ubuntu you use the cp command to copy files to/from the mount point after mounting the image.

    In Minix3 you use the mtools copy command to copy files to/from drive a: (the floppy image).
    I am not sure if a: is always the drive letter but there is a mtools dir command that tells you the letter.

    Transfer Ubuntu —> Minix3 —> Ubuntu is summarized as:

    1. Under Ubuntu using terminal: create an initial empty msdos floppy image file, followed by mount and copy of files and then umount.

    2. Start VBox and Minix3 as well as use Minix3: Devices —> mount the floppy drive image.
    Then Minix3 mtool copy of files followed by Devices —> unmount of floppy image and shutdown of Minix3 and exit VBox.

    3. Then under Ubuntu you mount the floppy image again and copy files to/from the mount point.

    I am not sure of all the commands but the above is what I remember because I once did it.

    Maybe someone can try it and post their solution.

    Good luck. I hope this helps.

  4. Carl,

    I didn’t try the option because floppy images would be far too small to transfer kernel sources (assuming a lot of files are changed!). Is it possible to make large floppy images?

    • I only used the floppy image to transfer small files for use with the compilers. I didn’t try larger images.


  5. [...] (and RAM, for that matter) I can burn in the name of science! I can even install Haiku, Plan9, MINIX, or ReactOS, just to have a different perspective on all things [...]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: