Minix Operating System with a VirtualBox Virtual Machine
Contents
Contents
- VirtualBox Briefly
- Installing Minix in the Virtual Machine
- Minix Briefly
- Minix Superuser
- Adding Minix User Accounts
- Installing Additional Packages from Minix installation Disk (iso file)
- ssh and sftp from host to VirtualBox Minix Guest
VirtualBox Briefly[top]
VirtualBox allows you to create a virtual machine with virtual hard disk, cd drive, and network.
You can then "insert" an Minix installation .iso file into the virtual machine's cd and boot the virtual machine to install Minix on the virtual machine's hard disk.
Minix is then the "guest" operating system running on the virtual machine which is implemented on your physical machine - the "host". The virtual machine and its guest os are embodied as a several files on the host and from the point of view of the host, runs as process(es) on the host machine.
By itself VirtualBox allows you to create a virtual machine, but with no operating system. You need the installation "disk" (iso file). There is a newer version on the minix3 web site, but you should use this earlier version:
minix_R3.1.5-r5612.iso
Get the compressed version (.zip) at this url:
http://condor.depaul.edu/glancast/443class/hw/minix3.1.5.iso.zip
So there are two prerequisite steps in order to get started with Minix.
- Download and install VirtualBox (free) for your host system (if you don't already have it).
- Download the Minix installation compressed iso file and uncompress it.
Now you are ready to create a virtual machine.
In VirtualBox, create a new virtual machine.
Give it a name. E.g., Minix
For the operating system and version, choose Other and other/unknown.
Next choose the memory size and Create new hard disk.
The memory size of 256MB should be sufficient.
Choose VDI type for the virtual hard disk if you are only going to use it with VirtualBox and select dynamically allocated (the default) or fixed size.
2GB should be sufficient for the virtual hard disk.
Click "create" to create the virtual hard disk and then click "create" to create the virtual machine.
Under the Networking category for the new virtual machine, attach Virtualbox Adapter 1.
Bridged networking is best if you want to be able to use ssh and sftp into Minix or out from anywhere.
However, if this doesn't work, attaching Adapter 1 to Host-Only Adapter will allow the host machine to communicate with the virtual machine using ssh or sftp.
(I haven't had success in selecting NAT which in any case would only allow connections going out from Minix to the outside world unless you set up port forwarding.)
Then click on Advanced and select:
PCNet-PCI II (not the default PCNet-PCI III)
Installing Minix in the Virtual Machine[top]
-
Click on the Storage section for the virtual machine and then select the virtual CD icon in the VirtualBox interface. Click on the CD/dvd icon and attach the installation iso file to it (i.e., "virtually insert the installation disk").
-
Next, under the System section of the virtual machine select the device to boot from. The first time, boot from the CD which has the installation disk.
- Start the machine. After it boots, login at the prompt as root (no password)
- Run 'setup' command and select the defaults (just hit enter/return). Select the default, Lance, for the network 'card' to work with your VirtualBox network selection.
-
After setup has finished, shutdown and power off the virtual machine. Type
shutdown
at the Minix prompt. Then close this machine using the Virtual Box menu and select "power off".
Change the System to boot from the hard disk rather than the CD.
Minix Briefly[top]
When you open VirtualBox, you select the virtual machine to use. After selecting the Minix virtual machine, VirtualBox tries to "boot" up Minix in the VirtualBox console window. Since you have already installed Minix and are booting from the virtual hard disk it will give you a choice:
1 Start Minix 3 2 Start Custom Minix 3
Always select choice 2 to have it boot from the most recent operating system image. This matters when you have modified the operating system!!
You see a log of commands being executed during the boot process in the VirtualBox window on your host machine. When booting has finished, a prompt appears, but you may find that typing at the prompt doesn't seem to work. You must first direct input to the virtual machine. You can do this by clicking the mouse in the VirtualBox window or by typing the "host" key shown in the lower right corner of the VirtualBox window. (It is the "right ctrl" key on Windows and the left "command key" on the Mac.)
After interacting with Minix for a while you may want to switch back to the host, but you find that the mouse cursor has disappeared. To switch back to the host (and get the mouse cursor back), type the "host" key again.
In the Minix virtual machine, you can create users, files, install utilities from the install disk (iso file), shutdown the virtual machine (as superuser), etc. Any additions or changes you make or to files, directories, users, etc. will modify the virtual machine and be available the next time you start the virtual machine. However, there are a few things to note:
First, you should be careful about shutting down Minix properly when you terminate the VirtualBox session. You can choose either to "suspend" the virtual machine or to "power off" the virtual machine. If you "power off", you must first properly shutdown Minix (execute the shutdown command as root). If you suspend the virtual machine on exiting VirtualBox, then when you startup VirtualBox again, it should restore the state of Minix processes, etc. at the time of exiting. Suspending seems to work reliably, but once or twice I've had some problems, so I generally shutdown.
Second, it isn't a bad idea to have multiple virtual machines. If you make some change to the Minix kernel that totally messes it up, it is nice to revert to a version that is in a stable state.
Minix Superuser[top]
The Minix installation has a superuser account with empty password. The account name is root, just as for Unix and its variants. You can change the password with the passwd command, but be sure to remember it if you do. You can also create "user" accounts easily with the adduser command. This is a good idea in general, since the root user account is permitted to execute commands without restriction and can inadvertently destroy precious files, etc., that a normal user would be prevented from doing. On the other hand you will need to "become" super user on occasion. For example, when you recompile the Minix operating system components. You can become superuser temporarily from a user account by the su command. At the prompt ($ or whatever the prompt is):
$ su rootor just
$ su
If you have set a password for root, you will be prompted for the root password. After you have finished the operation requiring root privileges, you return back to your ordinary user account by "logging out" of the superuser account. E.g. ctrl-d will log you out of shells based on the bourne shell, or by typing exit. If you type ctrl-d twice in this situation, the second one would log you out of your user account. The you would get the terminal (or console) login prompt and would have to log in again.
Adding Minix User Accounts[top]
Below is the Minix man page (manual page) for the adduser command.
You get this manual page listing at a Minix terminal by the man command. The output can also be redirected to a file or piped as the input to some other program:
1. Output to the Minix screen: $ man adduser 2. Create an output file named, say, adduserPage.txt, Use a pipe to direct the output to the bsfilt command which filters out backspaces, then redirect that output to a newly created file named, say, adduserPage.txt $ man adduser | bsfilt > adduserPage.txt (bsfilt is Minix's version of the typical Unix col command) 3. Copy the file adduserPage.txt to the host machine's clipboard using a program, vmw, which must be obtained separately from the Minix distribution. $ vmw copy <adduserPage.txt
ADDUSER(8) Minix Programmer's Manual ADDUSER(8) NAME adduser - add a new user to the system SYNOPSIS adduser user group home-dir ---- ----- ---- --- EXAMPLES adduser ast other /usr/ast # How user ast could be added adduser bin operator /usr/src # How user bin could be added DESCRIPTION Adduser adds a new user to the system by making new entries in ------- /etc/passwd and /etc/shadow for the new user, creating a new home directory, and copying the contents of the template home directory /usr/ast into it. The user-id of this new user will be the first free number not less than 10. The password is initially empty, the full name must be set, and the shell is the Bourne Shell, /bin/sh . Use passwd , ------ chfn , and chsh to change. ---- ---- SEE ALSO login(1), passwd(1), passwd(5).
Installing Additional Packages from Minix installation Disk (iso file)[top]
The Minix installation disk contains a large number of additional software packages that can be installed in Minix.
-
First, make sure the iso file is "loaded" in the Virtual Machine's CD.
-
Start Minix, login as root, and run the command "packman" (package manager).
-
You will be prompted whether to look on the net for packages as well as the CD. Answering No is sufficient to start with since the packages you need initially are all on the iso disk file.
-
Page through the list of packages and note the number of any package you want to install. You will find it useful to get these packages:
emacs openssh wget less
You might also want zip and unzip:
zip unzipOddly, zip and unzip seem to be in separate packages.
-
When prompted for the package to install enter the number(s) separated by commas and the package(s) will be installed. When prompted to also get the sources, you can answer No. You don't need the sources.
ssh and sftp from host to VirtualBox Minix Guest[top]
Assuming that networking in Minix succeeds, you will need to install the openssh package in Minix in order to be able to use sftp to transfer files between Minix and your host.
After installing openssh, the next time you start the virtual machine, the ssh demon will be started so that minix runs the ssh service. This allows you to use an ssh client on your host machine to log into Minix from your host. E.g you can use an ssh client on the host to login to Minix. You can also use sftp client on the host to transfer files between Minix and the host.