Booting Ubuntu 9.10 - Part 2 (The Koala Reborn)

Sunday, November 8, 2009

Booting Ubuntu 9.10 - Part 2 (The Koala Reborn)

ALERT!!! This is not a guide... read fully before applying any of these.. or check guide at the end...

Karmic KoalaContinued... Part 1 (The Downfall)

Recap

Installed Ubuntu 9.10 Karmic Koala fresh. Setup is fast. Setup installed GRUB2, not supported by my machine. System not booting. Tried installing LILO again using Ubuntu 8.04 Live CD. Got Windows bootloader running.

So, that was the story of the downfall...

Following is my HDD configuration...

- /dev/sda1 - fat32 - Windows XP
- /dev/sda5 - ext3 - /boot
- /dev/sda6 - fat32 - Another Windows XP ;)
- /dev/sdb11 - ext4 - /
- /dev/sdb12 - ext4 - /home
I searched all over the net for a solution. One thing that really helped me was pppoeconf. I am having broadband on DSL, so just execute pppoeconf, give username and password, and you have internet. So, I will boot using Live CD and first thing I do is setup the net (it will be gone once I reboot).

Found lots of versions of lilo.conf in the net. Tried all. It was writing to MBR, but was not getting updated. Sometimes it does get updated, then it shows some error during bootup ('No partion active').

I think the issue was this... LILO needs the bootloader to be in the first 10 GB of the HDD. I had the root partition (/) in another HDD. I had already installed LILO for 8.04. I think from 8.10, the size of the kernel may have got bigger and LILO needs all that withing 15MB, or it won't boot. LILO can't find the /boot and / was in another HDD.

So, I installed Ubuntu 8.10 (I don't have 8.04 CD). First time, the setup didn't even finish, just exited (I wonder why?). I ran setup again and it installed old grub. On next boot, got Error 18 again.

Found one alternative to restore Windows bootloader. Just run Partition Magic and "set active" the Windows partition. The MBR will then start loading that partition on boot. I had a bootable CD with Partition Magic. I even tried setting the /boot partition as active. Then there was no bootloader altogether.

Then I came across this article on converting GRUB to LILO. It was done from Live CD. Tried it lots of times, but didn't get hold of how it works. Then I understood, the method was used to get the lilo.conf according to the system config. We need /proc and /dev to run liloconfig.

Also, the entries in /etc/fstab must not map to UUIDs, need good old /dev/sda mappings. The article was for system with NO seperate /boot partition. I modified for /boot as separate. Here is the code...
sudo mkdir /mnt/ubuntu
sudo mount /dev/sdb11 /mnt/ubuntu/ # /dev/sdb11 is where / is
sudo mount -t proc none /mnt/ubuntu/proc
sudo mount -o bind /dev/ /mnt/ubuntu/dev
sudo mount /dev/sda5 /mnt/ubuntu/boot # /dev/sda5 is where /boot is
sudo chroot /mnt/ubuntu /bin/bash # makes /mnt/ubuntu as the root
What it does is, it mounts the / and /boot partition and creates the lilo.conf from the partitions. I know it is generating the lilo.conf right, but machine didn't boot. ...reference link...

I was stuck. No solutions left... :(

Then I read somewhere about NTLDR booting GRUB. I didn't like the idea, but thought will give it a try. Found out a good article. The steps in short...
- Windows is booting fine
- Install Ubuntu
- Boot using Live CD
- Generate lilo.conf
- Modify lilo.conf to write the bootloader to the ext3 partition instead of the MBR
- Install LILO
- Copy the first 512 bytes of the ext3 partition (the boot sector) to a file (eg. ubuntu.lnx)
- Mount the Windows partition, copy ubuntu.lnx to Windows partition
- Reboot into Windows
- Copy the ubuntu.lnx file to C:
- Add an entry into BOOT.INI
- Reboot, there will be an item for Ubuntu. ...reference link...

I tried it and voila, got Ubuntu booted. :)

The lilo.conf file... you can keep this for your use... it has only bare minimum options...
# The location to install LILO (/dev/sda to install to MBR)
boot=/dev/sda5

# Map generated by LILO
map=/boot/map

# Don't know, doesn't matter
install=/boot/boot.b

# Whether to prompt during bootup
prompt

# Bootup menu timeout (in deciseconds, 50 = 5 seconds)
timeout=50

# Mode
lba32

# Default OS to boot
default=Ubuntu

# Image for Ubuntu
# Modify to match the name of vmlinuz and initrd in /boot
image=/boot/vmlinuz-2.6.31-14-generic
label=Ubuntu
initrd=/boot/initrd.img-2.6.31-14-generic
read-only
# The partition for root (/)
root=/dev/sdb11

# Option for Windows
# The partition where Windows is installed
other=/dev/sda1
label=Windows
The thing was, when the machine boots up, Windows boot menu comes with Windows and Ubuntu, when u select Ubuntu, LILO menu comes with Ubuntu and Windows again :)

But story don't end here...

I wondered whether GRUB will also work this way. I booted again using Live CD, installed GRUB to /boot (/dev/sda5). Created the file and added one more entry to BOOT.INI. Tried, but GRUB shows Error 18.

I stopped and was going for lunch. Then it just came to me. If LILO is in /etc/sda5 and if I set that partition as active, won't it boot??? I came back after lunch and activated the ext3 partition using Partition Magic. It was in the extended partition, I converted that to primary. On reboot, it showed the Error 18 from GRUB. So, it is booting from ext3 directly.

I went back using Ubuntu 8.10 Live CD, against installed LILO to /boot. One thing I forgot to mention is, the /boot partition must be ext3, LILO don't support ext4. Rebooted and LILO was in control... that was great :)

Now I have Ubuntu 8.10 booting with LILO. Now I need to install 9.10 Karmic. I started setup from Ubuntu 9.10 CD. During partitioning option, kept /boot intact, formatted / as ext4. Didn't install bootloader. I knew the chances are lean, but just tried.

Rebooted, started booting and stopped into initramfs prompt. The version of initrd and vmlinuz are 2.6.27-7 for the bootloader but 2.6.31-14 in /boot. So, it won't boot.

Booted again using Ubuntu 9.10 Live CD, coz the 8.10 CD can't use ext4. There was no lilo. So, I installed lilo. Then I executed the code to mount / and /boot and chroot. Now, I need to run lilo. When you do chroot, you can't execute commands from the Live CD. But, there is no lilo bundled with the installation. I tried apt-get, lilo is not listed anywhere in the apt sources. I had the APTonCD package backup image in my Windows partition. I tried using .deb file, it said it needs mbr. And mbr was not in the APTonCD disk.

So, no lilo. Then I thought, why do I need to chroot. It is needed to generate lilo.conf. But I already have the lilo.conf, so no need. I modified lilo.conf to install to /dev/sda5. Executed sudo lilo -v. It showed some error and failed. I checked /boot and it was having Windows files. What happened was, when I converted the ext3 partition to primary, it became /dev/sda3 and the second Windows partition became /dev/sda5.

I modified lilo.conf to install to /dev/sda3. Executed sudo lilo -v. Success.

Rebooted, LILO came up and started booting. But stopped in the middle, saying waiting for the /boot, / and /home partitions. The problem was, those were mapped in /etc/fstab using UUIDs. So I went back into the Live CD, modified /etc/fstab (for the installation, not that of Live CD) and came back. Rebooted and Ubuntu 9.10 Karmic Koala was up and running... :)

Now I needed to install all the packages I had backed up using APTonCD. There was a problem with the disk. APTonCD generated an ISO image with my packages. It was only 1.5GB. So, I edited the ISO image and added backup of my home folder also. But, now APTonCD can't restore the packages from the APTonCD disk, because of additional directories. (Actually it can restore, the thing was, the home backup has root permissions, APTonCD couldn't access them, it showed error and I just dropped the idea. I thought about it later and ran APTonCD as root, and it worked.)

So, I had lots of .deb files in the APTonCD disk. What I did was I executed sudo dpkg -i *.deb. It started working and after sometime told me, can't install due to too much errors. I said OK, I will deal with you later. But, when I rebooted, X won't come up, stays at the shell login prompt.

So, I had to install again. This time, I didn't change anything, just left the bootloader and /boot as such. Moral: always use synaptic for managing debian packages.

- End of Story - Total Time Spent : 15+ hours -

And now on to the most hilarious part... !!!

While I was writing this, I was confused whether it is liloconf or liloconfig. I tried out, but lilo was not installed. When I installed it, look what I got...

WARNING: You have a large kernel+initrd and large-memory is not set in lilo.conf.
WARNING: Do NOT reboot or LILO may fail to boot.
WARNING: Please read /usr/share/doc/lilo/README.Debian


Got it? The size of initrd + vmlinuz was above 8 MB... that was the reason the bootloader written to MBR couldn't find LILO. I checked README.Debian and here is what I got...

If this machine has a recent BIOS without the 15MB limitation, you can
add the 'large-memory' option to /etc/lilo.conf to instruct LILO to use
more memory for passing the initrd to the kernel.


The limitation is for BIOS older than 2001. So, I added the line and installed to MBR, now it is booting from MBR. One line, one single line was worth hours? :)

Prologue / Guide (only for LILO)

- Install Ubuntu
- Use seperate partition for /boot
- Keep the filesystem for /boot as ext3
- DONT install bootloader
- Boot using Live CD
- Configure internet
- Mount / somewhere
sudo mount /dev/sdb11 /mnt/somewhere
- Edit fstab and remove the UUID mappings
 sudo vi /mnt/somewhere/etc/fstab
- Install lilo
 sudo apt-get lilo
- Copy the above given lilo.conf file to /etc
- Mount the boot partition (/boot) to /boot
 sudo mount /dev/sda5 /boot
- Modify /etc/lilo.conf
- Add 'large-memory' option to /etc/lilo.conf
- Execute lilo
 sudo lilo -v
- Enjoy :)

Karmic Koala ... how is it?

Yeah it is better... takes less RAM and Swap... boots faster... file access is faster... I love it :)

Thanks for spending time with me... I hope this was useful... I learned a lot... any doubt, just ask...

See also... » Ubuntu 9.10 Karmic Koala on the move

» Install Firefox 3.5.1 Official Release in Ubuntu

» VLC 1.0.0 in Ubuntu

» Sudo without Password in Ubuntu

» Internet Explorer in Ubuntu

» Torrent in Ubuntu

» Mounting FAT32 Partitions with Full User Permission in Ubuntu

» Yahoo Messenger! in Ubuntu


ATOzTOA : Latest Headlines


0 comments:

Post a Comment