Saturday, June 9, 2007

Hurd Installation... Its cool

`Installing GNU/Hurd On a Linux System'
------------------------------
------------------------

GNU/Hurd is an advanced kernel that is still under contruction. No official release of the same has been made yet. It works more or less in a network fashion. A micro-kernal like GNU/Mach is the base for the GNU/Hurd. A collection of Hurds together services the requests of the user. This is the main difference from the traditional monolithic kernels like Linux. Hurds communicate with each other using the micro-kernel. Currently there is a working package available for installation, though it comes with a big warning saying that 'Use at your own risk'. Its still unstable and a lot of works are to be done. The only thing that has been ported top the Hurd is the Debian. This means that the Debian packages may be run with Hurd as the Kernel. Again, not all the packages have been ported yet and so you cant expect a smooth GNOME or KDE desktop. The available desktop is 'fvwm', a very old one. It also has a million bugs, it seems...
Installation as explained by the team seems to project that its too dangerous to install the Hurd if you are a newbie. Well, dont go by their words. Have the courage to learn. Its actually quite simple, especially if you already have a Linux running. If you dont have a Linux, better contact Kiran. He and his team has made an installer for the Debian GNU/Hurd K-14 CD. The CD itself is quite an easy and user-friendly one. Here i will explain how to install the GNU/Hurd if you already have a Linux running on your system.

Requirements:
1. A computer with some Linux version.
2. 1 to 2 GB of free hard-disk space.
3. Debian GNU/Hurd installation disk, part 1.
4. Lots and lots of courage.

The most important point to note is that currently Hurd supports approx. 2 GB only. and the File System must be ext2fs. In the Linux box run parted or gparted to do this. Make a partion of size 2GB and ext2 file format. You must be root! Lets say that you are going to install in hda2. Run the following command to make the partion a Hurd's property. It will also make it ext2. (I am not sure wheather this is required)

mke2fs -o hurd /dev/hda2

Now edit the GRUB. This may be done at a later stage, but its better to do it now. Add the following to the menu.lst in the /boot/grub/ if you are running Debian. I think its in /boot/grub/grub.conf in RH systems(?). Add the following to it...


title GNU/Hurd
kernel (hd0,1)/boot/gnumach.gz root=device:hd0s2 -s
module (hd0,1)/hurd/ext2fs.static \
--multiboot-command-line=${kernel-command-line} \
--host-priv-port=${host-port} \
--device-master-port=${device-port} \
--exec-server-task=${exec-task} -T typed ${root} \
$(task-create) $(task-resume)
module (hd0,1)/lib/ld.so.1 /hurd/exec $(exec-task=task-create)
boot

Here it must be noted that the naming convention for the hard-disk is quite different. We normally use a Primary master disk. Its denoted as hd0. A secondary slave will be hd3. The partition is reffered as a slice, denoted by s. Grub uses 0 as the base while this method uses 1,ie, first slice or partion is s1. So hd0,0 is represented as hd0s1.
The root= parameter passed to the kernel is an indication to Mach, the micro-kernel, where the Hurd is situated. Grub need not know where it is. -s is used to enable a single user mode. After installation is complete, we got to remove this.

Now reboot the system. Boot from the Debian GNU/Hurd cd. Do the base-installation after enabiling the swap space and the file-system. No need of partioning again. It seems that some bugs are still there in the parted provided, when run in some systems. Base-install copies the required files to the ext2 FS that was enabled. Now take the CD out and reboot.

Select from the Grub menu, the GNU/Hurd option that we had put.This will boot the system. Now login as root. There is no password and the format is 'login root'. Then run the native-install file.

./native-install

This will install the downloaded packages. The installation is not yet completed. Reboot the system and login again as root and re-run the native-install. Now the most important packages are installed.
NOTE:At this point there is no vim or other editors than 'nano'. Just in case you need one!

Now what you have is a bare system that needs to be configured. There wont be any devices. So...

cd /dev
./MAKEDEV hd2 --> hd2 is CDROM

You may also add devices if there are any other ext2 or iso9600 FS partions.
Dont try to mount it now. It will not work.

Edit the file /etc/fstab using
nano /etc/fstab

/dev/hd0s6 none swap sw 1 1
/dev/hs2 /cdrom iso9660fs ro,noauto 0 0

You can always refer your Linux system to find out which is the swap drive or any other you want.

Simply typing the traditional mount /cdrom will work. Though its better to mount it using the following command so that you get a feel of what Hurd is. Make sure you have created the directory /cdrom using the mkdir command.

settrans -fga /cdrom /hurd/iso9600fs /dev/hd2

This will enable the translator iso9600fs which points to /dev/hd2 device and the translator will be placed at /cdrom. The swap space is enabled by the command

swapon -a

Run /cdrom/upgrade/install.sh. This will install the other packages available in the CD. gui.sh in the same directory will install the GUI. Further installation of the same are in the Cook-book provided in the CD. Also the hurd-install-guide is a good reference at anytime.

One last thing required to be done is changing from single user-mode. Do this by editing the menu.lst file as mentioned earlier. Just remove the -s option. This can be done only in the Linux mode since we didnt install another Grub and the Grub's configuration files are still in the ext3 drive that we cant access from the Hurd (what we need is a ext3 FS translator inside the /hurd/ folder, like the one we have for ext2 and iso9600fs).

HAPPY HACKING...

My first good post to the list!!!

I had done it long back. Forgot to put it in the blog...

Installing the usb modem provided by the Reliance is very easy.

### First, plug-in the modem. Check that the modem has been detected.

cat /proc/bus/usb/devices

It should print something like this..

T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#= 15 Spd=12 MxCh= 0
D: Ver= 1.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=16 #Cfgs= 1
P: Vendor=12d1 ProdID=1001 Rev= 0.00 <---- Required for *modprobing*
S: Manufacturer=Huawei Technologies <---- It may differ depending on modem
S: Product=Huawei Mobile <---- Its what we want.. !
S: SerialNumber=HUAWEI EC3X1
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=128ms
E: Ad=8a(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=0b(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E: Ad=83(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=06(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms


There may be information about other usb devices connected to your system.

### Then, modprobe the driver...

modprobe usbserial vendor=0x12d1 product=0x1001


I think that Debian Etch does all this automatically... you got to just configure the wvdial

### wvdial is the dialer that connects you to the ISP. It can be configured in the following way... (make sure you are root)

vim /etc/wvdial.conf (use your favourite editor)

In the end just add the following...

[ModemReliance]
Modem = /dev/ttyUSB0
Baud = 115200
SetVolume = 0
Dial Command = ATDT
Init1 = ATZ
FlowControl = Hardware (CRTSCTS)

[Dialer myconnection]
Username = You Phone Number Here
Password = Your Password ... usually same as your phone number
Phone = #777
Stupid Mode = 1
Inherits = ModemReliance

Save it and quit the editor..

### For connecting to net just run wvdial in the terminal.

wvdial myconnection

You will get the following (It may not be exacty like this...)

--> WvDial: Internet dialer version 1.55
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT 230400
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Mon May 28 12:05:08 2007
--> Pid of pppd: 24559
--> Using interface ppp0
--> local IP address 220.226.25.101
--> remote IP address 220.224.135.45
--> primary DNS address 202.138.103.100
--> secondary DNS address 202.138.96.2

The last 4 lines mean that you are online.... :-)
***Do not close the terminal***

### Disconnecting is quite easy. Just press ctr + c in the terminal where the wvdial is running. That is just stop the wvdial. You will get the following in the terminal...

Caught signal 2: Attempting to exit gracefully...
--> Terminating on signal 15
--> Connect time 0.9 minutes.
--> Disconnecting at Mon May 28 12:06:02 2007

### You may also configure the application launcher Modem Monitor. Add it to the panel. Right click on it and goto its properties.
Phone Number : #777
User Name: Your phone no.
Password : Your password.

Then in *modem* tab

Modem Port: /dev/ttyUSB0
Dial Type: Tones

I think it will work.