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

http://wiki.minix3.org/en/UsersGuide/RunningMinixOnVirtualBox

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

Installing packages

http://wiki.minix3.org/en/UsersGuide/InstallingBinaryPackages

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

Networking

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 https://gforge.cs.vu.nl/svn/minix/tags/r3_1_3a

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.

/r3_1_3a

Editing files on remote servers via multihop-ssh on emacs

Suppose you need to access you department’s computer from outside the institute. The usual solution would be to use ssh. But what if you can access your department’s computer only via a different computer in your institute? Multiple ssh would be the usual way:

aditya@donatello:~$ ssh clac.edu
aditya@clac.edu's password:
aditya@clac.edu:~$ ssh adi@malhar
adi@malhar's password:
adi@malhar:~$

This is the situation at my institute where, we have access to one central departmental server via ssh, from which we can access computers in our labs.

I found that a single command is sufficient to achieve this:

ssh -t clac.edu -t ssh adi@malhar

Ssh prompts for the password twice, first for clac.edu and then for adi@malhar.

This is however not usually sufficient. We want to edit files remotely too. Being an emacs fan, I heard how tramp is a great component of emacs that lets you access files on remote hosts via ssh. I use it pretty often. But the usual way of using tramp to access files through multihop ssh did not work for me. Tramp would just wait for 60 secs and then say that login failed. Perhaps they might work for you.

After a little more investigation, I found that OpenSSH can do wonderful things. Let’s say we want to access a file on the host malhar in the example above. OpenSSH can be configured to access malhar by proxying through clac.edu. The settings are reasonably simple. Just open ~/.ssh/config and enter the lines:

Host malhar
ProxyCommand ssh clac.edu nc malhar 22

This requires that the server at clac.edu have a program called netcat installed. Luckily in my case, the server did.

Once this was setup, tramp is able to access files on malhar. I press C-x f (the emacs key combo to open a file) and enter /ssh:adi@malhar:textfile.txt and then tramp prompts for a password twice. First enter the password for clac.edu and then for adi@malhar, and we’re in. Awesome!

Dump MySQL table into CSV

I needed to dump MySQL tables into CSV for use with WEKA. A little google search helped. I found this. I am copying the command here for my reference:

SELECT * INTO OUTFILE ‘result.csv’
FIELDS TERMINATED BY ‘,’ OPTIONALLY ENCLOSED BY ‘”‘
LINES TERMINATED BY ‘\n’
FROM my_table;

Thank you, Terminally Incoherent! I love MySQL too!

Getting WiFi to work on Intel PRO/Wireless 3945ABG in Ubuntu Hardy

I have a brand new Elcot Laptop (Acer TravelMate 5720), which came with Suse Enterprise and Ubuntu Hardy preinstalled. I prefer Ubuntu, but I found that it does not detect my wireless card. My wireless device is Intel PRO/Wireless 3945ABG.

If you have the same setup you can simply follow the steps that I did. To check what wireless device you have, run:

sudo lshw -C network

To get your card running, create a file in /etc/modprobe.d called iwl3945. Paste the following into it:

alias wlan0 iwl3945
options iwl3945 disable_hw_scan=1 hwcrypto=1

Now, you need to install the package linux-backports-modules-hardy-generic. To do this, you need to enable the Hardy Backports repository in Synaptic and then install it. If you are not sure how to do this, you can find instructions with screenshots here.

Reboot and your device should be working along with the wifi LED. You should be able to connect to unencrypted networks using this setup. A different network manager is needed connect to encrypted networks called wicd. To install wicd, follows these instructions. You should be all set now!

NOTE: All this information is also available in many scattered discussions in the Ubuntu Forums.

Best buys this season: The ELCOT Student Laptop

The Electronics Corporation of Tamil Nadu has started this year’s sale of inexpensive laptops with preloaded Linux (SUSE Linux Enterprise) for students studying in Tamil Nadu. There have been many press releases, for example, see this one. The laptop is said to be procured from Dell or Acer.

The high capacity version of the ELCOT laptop is priced at Rs. 31,717 and is really cheap! To be really convinced of this, I checked out the Dell site for their price on an equivalent configuration. This is really easy, because they have a nice customise feature on their site. So I went here and chose options to make the configuration equivalent to ELCOT’s config here. The results are astounding! The Dell price turns out to be Rs. 55317! The big price addons were 7000 rupees for the 320 GB upgrade, from 160 GB and the 3 years international support which added another (approx.) 8000 rupees. Of course, since Dell has not rolled out its preloaded Linux version in India (Dell sells with Ubuntu preloaded, in the US), the price above includes the price of Microsoft’s operating system.

Students are going to make a killing in this sale! Hurry! Last date for registrations in this first phase is July 15.

Edit: Elcot has extended the last date, as expected. The new last date is 31 July.

Edit 2: Elcot has further extended the last date! The new last date is 15 August.

Edit 3: Elcot has further extended the last date! The new last date is 31 August. And, I’m bored of updating this.

Edit 4: Elcot has finally closed the student laptop scheme 2008.

Download day Announced!

Download Day 2008

17th June 2008

That’s the official release date that has been announced for Firefox 3 on the Mozilla Developers blog! So lets get ready to implement our pledges and download the best browser out there!

EDIT: 15th June’s “The Hindu” newspapers features an article about Ubuntu and Firefox, how they rock and why they are great for Linux newbies!

Lets spread Firefox!

Download Day 2008

Download Day 2008 will soon be unveiled and hundreds of thousands of people will prepare to download Firefox 3! The higher the number of people who download, the higher the chances of setting a Guinness World Record. Read more about it by clicking the image above.

Though, Firefox is being pushed as a great browser (and it no doubt is), let us not forget that it is also like any software subject to bugs. There does seem to be a sort of careless piece of confidence running around (“If I use Firefox, I am pretty much secure from viruses”, “Firefox is very secure”, etc), and this is very wrong. Let’s be alert and know that Firefox like any other piece of software is not infallible and is actually far from it. So don’t spread Firefox for the wrong reasons! Don’t let people think that they are invulnerable because they use Firefox! People should learn that it is always part of their responsibility to remain alert and not get complacent with security.

The Hardy Heron flys out!

Well, this is just a note. I’m sure everyone already knows! See the features!

YABBA DABBA DOO!

Ubuntu Hardy Heron is almost out!

The release candidate is available! Keeping with its trend to stay on the edge, the release candidate comes with Firefox 3 beta 5 (the last beta version had Beta 4)! Four days to go for the final release, and we at NITT are already getting ready to download the repositories for local usage (we don’t have an internet connection though we have a lan in many places). I am sure there must be lots of Indian colleges out there who would be doing similar things because of the lack of a high bandwidth internet connection.

I am posting the script to automatically start the download of Ubuntu Hardy Heron when the release is available on 24 April 0530 hours IST:

function download { echo "Starting the download of Gutsy Gibbon Repos" debmirror ~/ubuntu/hardy-i386 --host=in.archive.ubuntu.com --root=ubuntu/ --nosource -m --passive --method=http --progress --ignore-release-gpg --section=main,universe,multiverse,restricted --arch=i386 --dist=hardy -proxy=http://10.0.0.111:3128 & } while [ 1 -eq 1 ] do if [ 1208995200 -le `date +%s | bc` ] #1208995200 is the time stamp for the release date in my time zone (IST) then download break else echo sleeping sleep 1000 fi done

This is a bash shell script. Run it using the command “bash ./downloadScript.sh”, where “downloadScript.sh” is the name of the file containing the above code.
You can put this line in your /etc/rc.local to make it run every time the computer starts. The download will always commence from where it was left off the last time!

Here is a neat preview video of the beta release:

Need to access your home computer from outside?!?

Yes! Its definitely possible. Even if your home computer is behind a router that gets its IP dynamically each time it boots! I used think it was impossible and all these difficulties actually make the comp more secure. But thats bull. Ignorance is not bliss!

Let me explain. The setup at my house is via a BSNL Router that gives my computer a dynamic IP (each time it boots – which is the same each time though) and also receives an external IP (for itself) from BSNL’s DHCP servers I guess. The router IP-masquerades on the internet. So to make it possible to access my home computer and its files via SSH (my favourite remote access tool), I need to configure my router to forward ports. What this means is that, the router is configured to forward all IP packets that are addressed to a particular port (number 22 here – for SSH) are forwarded to my computer.

For some reason the router I have, cannot be configured to forward only particular ports (if any of you would like to help me, my router’s model is UT300R2U – don’t point me to portforward.comthey’ve got the damn thing wrong about my router). So I had to settle for configuring it to forward all ports to my computer (a DMZ if you are familiar with the term). This is considered a touch insecure as all traffic is dropped on my computer.

So now that that is done, my router is configured to forward all ports. But I want only SSH to be allowed. I am being careful!! So i enabled my firewall and allowed only a few ports. Don’t expect me to tell which ones!

There is still one problem of course. When I am outside how the hell am I going to know the IP address of my home computer?! Well, there is, as there always is, a solution. I signed with a free DNS service provider that gave me tool, which when installed on my computer, updates the DNS server with my newly assigned IP address. This service provider is none other than dyndns.com. I can now access my home computer with the name donatello.homelinux.org!

All this has of course greatly improved my knowledge of practical networks and the internet. Some things still puzzle me. Clearly the external IP addresses that BSNL assigns to its routers do not follow any IP standard, otherwise, whatmyipaddress.com would not say that my location is some place in the US. But how does it manage to keep so many distinct IP addresses for itself on the net? It is estimated that there are about 3 million BSNL broadband subscribers in India! Now thats a lot of IPs!