Installing Minix 3 using VirtualBox in Linux
This article will help you set up Minix 3 using VirtualBox on a Linux host for development and enable SSH between Minix and the host machine.
But why, but why??
Minix is a microkernel. Unlike Linux, which is monolithic, Minix is an operating system designed to be reliable. Being a microkernel, it maintains good separation between kernel space and user space. The Minix kernel is only 6,000 lines of code, compared to millions in the Linux kernel.
This makes Minix a perfect system to study for understanding operating systems. Andrew Tanenbaum has a book covering Minix and operating systems in depth, so if you are an undergraduate looking for an operating systems project, it is not a bad idea.
Tested with Ubuntu 13.04 and Arch Linux.
Downloading Minix 3
Download Minix 3 from the official website.
Official download page
Note: I used Minix version 3.2.1 (~256 MB). Minix 3.1 versions have some issues with VirtualBox installation, so please use a version > 3.2.
Creating a new VirtualBox Image
- Make sure VirtualBox is installed on your system.
- Open VirtualBox and click the New button (top left).
- Select the type and version as “other”, name the image “minix”.
- Click next, allocate RAM (512 MB).
- Create a virtual hard disk (preferably VDI, dynamic size, 1 GB).
Installing Minix 3
- Assuming you have downloaded and decompressed a MINIX 3 ISO image, attach the ISO file to VirtualBox:
- In VirtualBox, select minix on the list on the left.
- In the menu on the right, press CD/DVD-ROM.
- In the next menu, tick Mount CD/DVD Drive, and select ISO Image File.
- Browse, select the .iso Minix image we downloaded earlier and press OK.
- Now boot the newly created virtual image by clicking the Start button.
- Select Option 1 for installation and press ENTER.
- When the login prompt appears, log in as root, pressing Enter when prompted for a password.
To start installation type:
setup
After this and all other commands, be sure to type ENTER (RETURN). When the installation script ends at a screen with a colon, hit ENTER to continue.
Select keyboard type
When you are asked to select your national keyboard, do so. This and other steps have a default choice, in square brackets. If you agree with it, just hit ENTER. In most steps, the default is generally a good choice for beginners. The us-swap keyboard interchanges the CAPS LOCK and CTRL keys, as is conventional on UNIX systems.
Create or select a partition for MINIX
You will first be asked if you are an expert in MINIX disk partitioning. If so, you will be placed in the part program to give you full power to edit the Master Boot Record (and enough rope to hang yourself). If you are not an expert, press ENTER for the default action, which is an automated step-by-step guide to formatting a disk partition for MINIX.
Select a disk
An IDE controller may have up to four disks. The setup script will now look for each one. Just ignore any error messages. When the drives are listed, select one and confirm your choice.
If you have two hard disks and you decide to install MINIX to the second one and have trouble booting from it, see Installation Troubleshooting.
Select a disk region
Now choose a region to install MINIX into. You have three choices:
Select a free region Select a partition to overwrite Delete a partition to free up space and merge with adjacent free space For choices (1) and (2), type the region number. For (3) type:
delete
then give the region number when asked. This region will be overwritten and its previous contents lost forever.
Confirm your choices
You have now reached the point of no return. You will be asked if you want to continue. If you do, the data in the selected region will be lost forever. If you are sure, type:
yes
and then ENTER. To exit the setup script without changing the partition table, hit CTRL-C.
Reinstall choice
If you chose an existing MINIX partition, in this step you will be offered a choice between a Full install, which erases everything in the partition, and a Reinstall, which does not affect your existing /home partition. This design means that you can put your personal files on /home and reinstall a newer version of MINIX when it is available without losing your personal files.
Select the size of /home
The selected partition will be divided into three subpartitions: root, /usr, and /home. The latter is for your own personal files. Specify how much of the partition should be set aside for your files. You will be asked to confirm your choice.
Select a block size
Disk block sizes of 1-KB, 2-KB, 4-KB, and 8-KB are supported, but to use a size larger than 4-KB you have to change a constant and recompile the system. Use the default (4 KB) here.
Wait for files to be copied
Files will be automatically copied from the CD-ROM to the hard disk. Every file will be announced as it is copied.
Select your Ethernet chip
You will now be asked which (if any) of the available Ethernet drivers you want installed. Network settings can be changed after installation. Since we are using VirtualBox, select “AMD LANCE” (option 8) as your Ethernet driver. VirtualBox can emulate AMD LANCE and it has nothing to do with your computer’s network card.
Restart
When the copying is complete, MINIX is installed. Shut the system down by typing:
shutdown -h now
You can now remove the ISO image from the virtual machine so it does not boot into the installer again. When you boot up again, you will be running MINIX.
Enabling SSH
Enabling SSH in Minix and on the host is a good option for development on the guest Minix system. To enable SSH in the guest Minix system, you need to install OpenSSH in both Minix and on your host machine.
Making VirtualBox listen on a particular port (Port forwarding)
We will change some settings in VirtualBox using VBoxManage (a command-line tool for tweaking VirtualBox settings). Choose a port number above 1024 for the host, since VirtualBox requires administrative rights to listen on lower ports (here we use 2222). Also, using port 22 will just loop back to your own system.
In your host terminal, run:
VBoxManage modifyvm "minix" --natpf1 "guestssh,tcp,,2222,,22"
“guestssh” is just a name for the port forwarding rule. “minix” is the name of the VirtualBox image.
Set a password for root account in Minix
In Minix, set a password for the root user using:
passwd
Now enter a desired password for the root account.
Installing OpenSSH in MINIX
Restart VirtualBox, boot into Minix, and install OpenSSH.
Method 1, using pkgin (internet / ftp access required)
You can install OpenSSH using pkgin.
Update pkgin:
pkgin update
Install OpenSSH:
pkgin install openssh
Method 2, using the installation ISO as a source (no internet required)
Many packages are available directly from the CD. This can be helpful in some circumstances, and is generally faster than downloading from the online repository.
To install packages from the CD, you can use pkgin_cd. This command uses the CD-ROM as the package repository. It is a wrapper for pkgin and therefore supports the same commands.
While the virtual image is running, attach the ISO disk. Click the Devices menu in the VirtualBox window, select the Minix installation ISO, and load it (this will be used as the package source). If you cannot see the Add CD/DISK option under the Devices menu, you may be missing the Guest Additions extension for VirtualBox.
To install OpenSSH, type:
pkgin_cd install openssh
Starting SSH daemon
Once OpenSSH is installed, start the SSH daemon in Minix (starting SSH will create your keys):
sh /usr/pkg/etc/rc.d/sshd start
Make sure the SSH daemon is running in Minix:
ps -ax | grep ssh
Back on the host terminal
Check if SSH is running on your host:
ps aux | grep ssh
If not, install and enable SSH (depending on your distribution):
Ubuntu / Debian:
sudo apt-get install openssh-server
sudo start ssh
Arch Linux:
sudo pacman -S openssh-server
sudo systemctl start sshd
To SSH into Minix from the host, run:
ssh -l root -p 2222 localhost
Enter your Minix password.
Links:
Users Guide