Friday, May 29, 2009

Install linux without CD/USB/Floppy !

As part of a bigger project (a digital photo-frame) I have been trying to repurpose an old P3 laptop of mine that has not seen use in a few years. It had a semi-working install of Fedora Core 4 on it and I wanted to install something newer, faster and something where I could get software easily.

Heres the catch, the laptop's CD drive went bust a long time ago and being a 2001 model it has no USB boot capability. All it had was a functioning internet connection (ethernet). After a week of searching and understand how Grub boots linux I successfully installed Xubuntu on the machine !

Background:

Will keep this as simple as possible. Grub use a config file /etx/grub.conf that contains the commands used during bootup. what we need is a paragraph starting with title and contaisn the name of the distro being booted. ANything can be written here.

The next two lines below it are the locations of the Kernel and the Initrd files. These are what linux always boots first and are the key to installing a new system. They specify the location of the root partition on the hard drive for example: (hd0,0) meaning hard drive 0 and partition 0. Heres a sample of a paragraph:
title Red Hat Linux (2.4.18-0.12)
root (hd0,0)
kernel /vmlinuz-2.4.18-0.12 ro root=/dev/hda3
initrd /initrd-2.4.18-0.12.img

Now all we need are the 2 files ( the kernal and the initrd file of the system we wish to boot ).

Proceedure:

  1. First and foremost get the two files ( the kernal and the initrd file ) of the system you want to install. Two ways of doing this: if you have the distro's image (iso file ) just go into that and find them files.
  2. Place both files into the /boot folder in your root directory.
  3. Open up /etc/grub.conf in your faveroute text edditor.
  4. Add a paragraph in it. Heres what it should look like:
title My Linux installer of choice
kernel (hd0,0)/boot/your_linux_kernel_filename
initrd (hd0,0)/boot/your_initrd_img_filename

Now simply reboot the computer. When the Grub menu shows at startup simply select your newly added choice. A simple installation menu should start up and all you have to do is follow the instruction. The distro will eventually start the installation by downloading necessary components from a provided mirror.

NOTE: I know Ubuntu can automatically find mirrors to install from but I had issues with Fedora where I had to manually enter a mirror. In that case go here and select the mirror for the distro required. Make sure that the url you provide is of the os and should look like this: .../blabla/fedora/linux/core/10/i386/os/

Closing notes:

Im glad to have the laptop working again. The installation went smoothly and I was able to format the entire disk meaning the kernel and initrd files i had booted from were wiped out but during the install they were on the ram so it dint cause any issues. Make sue that the install goes uninterupted though, failing in the middle can be catastrophic.

I hope this helps. I took help for this from this website. It is more comprehensive and also explains how to do this from Windows if required.

Thursday, May 28, 2009

Fedora core 10 crashing at boot (Kernal issue)

FC10 seems to have this issue sometimes where upon bootup it hangs after:

Creating root device.
Mounting root filesystem.
mount: error mounting /dev/root on /sysroot as ext3: No such file or directory
Not sure what is happening here but I found a quick fix.
  1. Edit the grub line for FC10 being booted up
  2. Edit the kernel parameters
  3. add at the end scsi_mod.scan=sync
Should boot up just fine now.

Tuesday, February 24, 2009

Creating an ad-hoc wi-fi network on Linux

A simple how-to on ad-hoc networking.

First of all the basics, ad-hoc networks are not are slightly different from regular networks. In its simplest form an ad-hoc network possesses no DHCP server i.e. each computer has a static I.P. address and to talk to another computer it simply attempts to contact the other I.P address. No need of a switch in the middle to act as a mediator.

Now for a computer to be on the same ad-hoc network the following must be set:
  1. Wifi mode should be in ad-hoc
  2. The Essidof the network should be the same (duh ?)
  3. They should be on the same channel
a quick setup would involve the following 3 lines:

ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc essid testing channel 5
ifconfig wlan0 192.168.10.10 up


Here "wlan0" is my wireless card, replace it what you have ( Type in "iwconfig" if you are certain what it might be ). The essid is named "testing", type anything creative here ( its the name of the wireless network and is visible by all so dont be too creative ). The channel# can be anything that wont be affected by local interference ( eg a local wifi router ). Lastly bring up the wifi card and choose an I.P address for it.

Do the same thing on the other computers except change the I.P address ( for eg make the next computer 192.168.10.11 ) and this way your ad-hoc network can grow.

P.S. make sure the computers are on the same cell. Type "iwconfig" and see the entry under "Cell". It should be the same for all computers on the network.

In the case that the computer misbehaves and doesnt connect to the network, destroy the network manager:
killall NetworkManager

Monday, February 23, 2009

Opening and Closing ports in Ubuntu

Took me a while to figure it out so i figured I should share it with everyone. Ubuntu has something called UFW ( Uncomplicated firewall) which can be activated at any time and told to open/close ports.Some of the basics:

sudo ufw enable

sudo ufw allow 53/tcp
sudo ufw allow 53/udp

sudo ufw status

These basic commands can be used for opening ports. See the link for more details (including how to open ports for services automatically )