Wednesday, January 6, 2010

Using GRUB to boot a second Win XP hard drive

Following on from my earlier success with GRUB to provide dual boot, (Ubuntu Linux - hd0,4 and Win XP hd0,0 in separate partitions on the same hard drive), I decided to add a third option - that being to boot another Win XP installation (hd1,0) which exists on a second hard drive with one partition and a Windows Master Boot Record. (I had previously only been able to boot this hard drive through switching the BIOS settings for the 1st hard drive, but now that was becoming rather tedious).

I edited the GRUB menu.lst to point to the second Win XP installation  hd1,0 and then makeactive. Sorry too much dispela tru. Dispela lookim - for some unknown reason GRUB would not boot hd1,0 even though testing proved it was being accessed. GRUB would always revert to booting Win XP on hd0,0.

How The Heck Did I Get GRUB to optionally boot the second Win XP Installation?

Well, this fix required some help which I found readily available on http://www.ubuntuforums.org/.  I also found a very good relevant article on Linux Journal. http://www.linuxjournal.com/article/4622
BTW, just confirming GRUB partition numbers are always 1 less than Linux numbering. The conversion for my machine therefore is:
/dev/sda1 = hd0,0 (First Win XP installation)
/dev/sda5 = hd0,4 (Ubuntu Linux installation)
/dev/sdb1 = hd1,0 (Second Win XP installation)
  1. In Linux, back up menu.lst using cp /boot/grub/menu.lst /boot/grub/menu.lst.bak (or similar)
  2. Edit menu.lst using sudo gedit /boot/grub/menu.lst
  3. Change the second Win XP bootstrap loader instructions to read:
  4. title Windows XP #2 (or similar)
  5. rootnoverify (hd1,0)
  6. map (hd0) (hd1)
  7. map (hd1) (hd0)
  8. makeactive
  9. chainloader +1
  10. Save menu.lst and exit.
  11. Windows XP #2 should now boot normally from GRUB
With acknowledgement to the Linux Journal article referenced above, it seems the rootnoverify command is for OS filesystems not specifically recognized by GRUB, so that GRUB will not try to mount the partition. The chainloader command will use the first sector of the partition of device (hd1,0) and attempt to boot whatever it finds there. This is a common means of booting OS'es that install their own boot loaders in the first sector of the partition where they are installed (this is sometimes called the partition boot sector or PBR).

The makeactive command sets the active flag in the partition table for the device specified by the root command, as some operating systems, like Win98, require.

I found a really excellent article at http://www.oculon.org/hijinx/linux/grub.htm which uses mapping in system configuration very similar to mine, without rootnoverify being used. I plan to try menu.lst without the mapping, and with the mapping but with rootnoverify changed back to root. I'll keep this blog posted.

A very useful GRUB resource can be found at https://help.ubuntu.com/community/GrubHowto

So that's How the Heck I Fixed that, and I'm now much happier with the start up options.

ooRoo
Nifty Nev

Monday, January 4, 2010

Reinstall Windows XP from original CD - a painful exercise

My crashed hard drive (mentioned in earlier posts) was in a bad way. Having restored the Master Boot Record and fixed the Boot Sector, Windows XP would only partially boot. This indicated it was not totally 'fritzed' however essential files were missing. I tried initially to work around by copying the missing files from another, good installation of Windows XP. Ultimately that didn't work. I could get to the Windows XP start up logo but that was it. The boot hung with no further clue as to what it needed. With no other alternatives obvious, it was time to do the dreaded reinstall from the original Windows XP CD. I say 'dreaded' because in my case, the reinstall process could not read files from the CD.

How the heck did I reinstall Windows XP from the CD if it couldn't read the CD?

OK, well I had first better clarify things. The Windows XP CD would boot and allow me to start the reinstall. The read problem came later. Well into the reinstall, the process prompted for 'ASMS' on the CD. The default path was :
globalroot\device\cdrom0\i386
With no other path to i386 on the CD-ROM root directory, the work around was:

  1. Boot another installation of Windows XP in a separate machine. (I used my lap top PC)
  2. Remove and hook up the crashed drive via a USB2/SATA interface to the second machine. (These new interfaces are such excellent devices.)
  3. Pop the original installation CD in the CD-ROM on the second machine.
  4. Copy the i386 directory from the CD-ROM to the root directory on the crashed drive. (Assumes of course the file and directory structure on the crashed drive is intact and readable).
  5. Put the crashed drive back in the desk top PC.
  6. Reboot.
  7. The crashed drive will probably now boot and continue with the reinstall. (You probably won't even need the installation CD now).
  8. At each prompt for a file from the CD, simply type the path C:\I386.(Copy and paste will work. You will need it many times, and read the installation files from the hard drive you are restoring).
  9. This will probably bring you to the end of the re-installation without any other dramas, although you might be prompted for certain hardware based drivers such as the video card. Click Yes to move on in each case.

The problem reading the CD-ROM during reinstall appears to be fairly common and there are a lot of entries on Google in relation to files missing during the reinstall. Several work around suggestions have been made but none appear to be as effective as copying the source files onto the destination hard drive as described.

So thats how I fixed my crashed Windows XP. The first thing I did after that was to update and run the virus checker to try to find what destroyed my system in the first place. Boy oh boy - did I ever find some bugs, but that's another story.

Sunday, January 3, 2010

GRUB Bootloader splash screen - How to create and maintain

Having just gotten my GRUB bootstrap loader to work again (see previous post), I thought it would be nice to sex up the GRUB screen. Unfortunately the UBUNTU Linux installation package didn't come with a default GRUB splash screen.
So, How The Heck Did I create a GRUB Bootloader splash screen?
  1. Boot into Linux.
  2. Open a GIMP session.
  3. Create an image 640 x 480 pixles, 14 color depth
  4. This is not a GIMP tutorial, however to reduce colors go Image->Mode->Indexed... and select Generate optimum palette, set the maximum number of colors to 14 and chose a dithering algorithm that looks good. Normally this gives the most coherent coloured areas but the Floyd-Steinberg algorithms are more appropriate for images with many colors.
  5. Save the images as an XPM (for example usplash.xpm). You might want to save a GIMP image also (XCF) in case you want to change it later.
  6. Then compress and save it:
  7. sudo mkdir /boot/grub/images
  8. gzip usplash.xpm
  9. sudo cp usplash.xpm.gs /boot/grub/images
  10. Backup then Edit menu.lst
  11. sudo cp /boot/grub menu.lst /boot/grub/menu.lst.old
  12. sudo gedit /boot/grub/menu.lst
  13. Add a new section below the # Pretty colours field
  14. splashimage (hdX,Y)/boot/grub/images/usplash.xpm.gz (Replace X and Y with the proper numbers, e.g. hd0,4 is the first hard drive (say) /dev/sda, and 4th partition.
  15. Reboot and the new splash screen should be visible as the GRUB background.
More info is available at http://ubuntuforums.org/showthread.php?t=30341&highlight=grub+splash

The splash screen I created (shown below) is pretty simple for the moment, but now I can come back to it any time if I want to tart it up a bit more.


So thats how I managed to create a splash screen and from here on I should be able to maintain it.

Dual boot HDD - using the GRUB bootloader

The old hard drive mentioned in my previous post has two partitions. Windows XP in the first partition and UBUNTU Linux in the second. The problem was that the old Master Boot Record was over-written when I repaired the Windows XP installation. As a consequence, I lost the GRUB bootloader and I could no longer access my Linux partition.

How the heck did I fix the Master Boot Record to give dual boot options?
  1. Reboot the computer using CTRL ALT DEL.
  2. Interrupt the start up sequence to change the BIOS settings. (Hold down the DEL key).
  3. Following the BIOS menu, change the boot sequence so the system will boot first from the CD drive.
  4. Save the settings and exit (F10 key usually)
  5. When the PC restarts, pop the UBUNTU Linux Installation Disc in the CD drive.
  6. At the UBUNTU menu, start a CD only session. (Don't install!!!).
  7. Open a terminal session to initiate GRUB. Enter the following commands:
  8. sudo grub
  9. find /boot/grub/stage1 (Will return the drive and partition numbers in the format hd?,?)
  10. root (hd?,?) (Where Linux root resides, (say) hd0,4 which is /dev/sda, partition 4)
  11. setup (hd?) (Writes the GRUB Bootstrap loader to the Master Boot Record on the nominated hd)
  12. quit
  13. Back up, then Edit the menu.lst file
  14. sudo cp /boot/grub/menu.lst menu.lst.old
  15. sudo gedit /boot/grub/menu.lst
As I have both Windows XP and UBUNTU Linux on the same drive all references in menu.lst should be to hd0 with partition references showing Windows XP at hd0,1 and Linux at hd0,4. Change the menu entries as necessary to suit.

  1. Delete any irrelevant menu references to operating systems other than those installed on the PC.
  2. Change the default start up operating system. This is given by 'default value'. It coincides with the menu line you would like the system to automatically boot into if there is no user input. (Count starts at 0 for the first menu line).
  3. Reboot and test each menu line and automatic boot for correct operation.
  4. If you get stuck, come back in via the CD as above and start again.
So thats how I managed to fix the GRUB Bootloader.

Saturday, January 2, 2010

Windows XP - ntldr is missing

I have an old hard drive with Windows XP installed in the first partition. The problem was that each time I tried to boot, or reboot the system process returned a fatal message, "ntldr is missing" and stopped.

How the heck did I fix that?

  1. Reboot the computer using CTRL ALT DEL.
  2. Interrupt the start up sequence to change the BIOS settings. (Hold down the DEL key).
  3. Following the BIOS menu, change the boot sequence so the system will boot first from the CD drive.
  4. Save the settings and exit (F10 key usually)
  5. When the PC restarts, pop the original Windows XP Installation Disc in the CD drive.
  6. At the prompt to hit any key in order to get the CD boot sequence started, hit ENTER
  7. At the first blue screen prompt, type 'R' to go into the recovery console.
  8. At the next prompt, select the Operating System on the offending hard drive, (with all other hard drives disconnected, there was only the one choice on my system).
  9. When asked for the Administrator password, just hit if it has not been set, otherwise you had better have it written down or remember it because you're going no where without it.
  10. You will now be at a DOS Command screen, located at C:\WINDOWS\SYSTEM32
  11. The recovery disk files on the CD will be visible under D:\
  12. Copy two files from the CD using the following commands:
  13. copy D:\i386\ntldr C:\
  14. copy D:\i386\ntdetect.com C:\
  15. Type EXIT to shut down the recovery session.
  16. Reset the BIOS to boot from the hard drive first
  17. Reboot as normal. 


BINGO! So that's how the heck I fixed that.