Ubuntu Lucid 10.04 on a RAID 0 array

This is a follow-up to a previous post on getting Ubuntu to work on a RAID 0 array. As usual, I make no guarantees that this will work for you. Be sure you have backups before you attempt this.

The good news: installation of Ubuntu 10.04 (using the alternate installer) to my RAID 0 array was able to finish without any problems, unlike in 9.10 where it stopped at the GRUB installation step. The bad news is that upon rebooting, I was greeted by a GRUB Error 15.

Fortunately this can be fixed by manually installing GRUB.

  1. Boot the Ubuntu 10.04 alternate installer CD. Select Rescue a broken system.
  2. Follow the dialogs, making sure you Yes to the activate RAID devices prompt, until you get to the Enter rescue mode dialog. Select your root partition and on the next dialog, choose Execute a shell in your-selected-root-partition
  3. Enter the following in the command line:

        # update-grub
        # grub-install your-RAID-0-device
        # exit
        

    Where your-RAID-0-device is where your RAID 0 array is mapped (/dev/mapper/isw_abc_RAID in my previous post). The second line installs GRUB on the MBR.

  4. Select Reboot the system and you should be able to boot into your Ubuntu 10.04 installation.

Let me know if this works for you.

Dual-booting Windows 7 and Ubuntu Karmic 9.10 on a RAID 0 array

I’ve been running a Windows XP-Ubuntu Jaunty setup on a single RAID 0 array for months without any problems. Now that I have some free time, I went ahead and updated my setup, documenting the steps here in case I decide to do this again tomorrow. (As a friend remarked, reformatting is a favorite pastime.)

Warning: Back up your data before attempting this procedure. I can’t guarantee that this will work for you. I got this running on my PC, which has Intel ICH9R RAID “FakeRAID” capability. Indeed, I copied most of the steps from the Ubuntu Community Documentation FareRaidHowto. Go ahead and read it first.

Assumptions

  • you already have Windows 7 installed on a partition in the RAID 0 array
  • you’re using the Ubuntu 9.10 alternate installer
  • you’ve backed up your data!

Steps

There are many. I advise you to read and try to understand all the steps first before proceeding with your installation.

  1. Start installing Ubuntu 9.10.
    Set your language, configure your network, partition your disk, create your user account, etc. Ubuntu 9.10 should be able to detect your RAID 0 array and ask you if you want to use it (say yes), so you should not encounter any problems. Until…

  2. Installation stops at the GRUB installation step.
    You’ll know when you see the Ubuntu installer main menu, with the Install the GRUB boot loader on a hard disk entry highlighted. Don’t press anything yet!

  3. Manually install GRUB onto the Ubuntu installation.
    Ubuntu 9.10 comes with GRUB version 2, which uses a new “BASH-like (configuration) syntax.” Sounds pretty cool, but I still need to learn it. For now I’ll use the old GRUB and my old configuration.

    1. Switch to the second console by pressing CTRL-ALT-F2.
    2. “Log in” to your new but incomplete Ubuntu installation (which is in /target) by entering the following in the command line.

      # mount --bind /dev /target/dev
      # mount -t proc /proc /target/proc
      # mount -t sysfs /sys /target/sys
      # cp /etc/resolv.conf /target/etc/resolv.conf
      # chroot /target
      
    3. Now you’re in. Install GRUB, and replace GRUB version 2’s files in /boot/grub with GRUB’s files.

      # apt-get install --purge grub
      # cp /usr/lib/grub/x86_64-pc/* /boot/grub/
      
  4. Install GRUB on the MBR.
    Let’s say your RAID 0 array is mapped to /dev/mapper/isw_abc_RAID.

    1. First, get the drive geometry.

      # fdisk -l /dev/mapper/isw_abc_RAID
      

      Look for the line saying something like 255 heads, 63 sectors/track, 19458 cylinders, and write it down.

    2. Now you’re ready for GRUB. Open the GRUB shell.

      # grub --no-curses
      
    3. Specify your RAID 0 array as the (hd0) device since we’re installing to the MBR.

      grub> device (hd0) /dev/mapper/isw_abc_RAID
      
    4. Set the drive geometry.
      This step probably isn’t required, as GRUB may have correctly acquired your drive’s geometry. I needed to do this for my setup, though.

      Use the geometry values from the fdisk command you issued earlier. Note the syntax for the geometry command: it’s geometry drive cylinder head sector. Be careful not to mix up the values.

      grub> geometry (hd0) 19458 255 63
      
    5. Find the boot directory partition.
      Get the drive (partition) where the GRUB boot images are installed.

      grub> find /boot/grub/stage1
      

      Write down the output of the find command. Let’s assume it’s (hd0,2).

    6. Set GRUB’s root partition.
      We pass the device reported by the find command to the root command.

      grub> root (hd0,2)
      
    7. And finally, install the GRUB boot loader on the MBR.

      grub> setup (hd0)
      
    8. Exit the GRUB shell.

      grub> quit
      
  5. Configure GRUB.
    You should be back on the Linux shell prompt. Quit the GRUB shell if you haven’t already.

    1. Generate an initial /boot/grub/menu.lst GRUB configuration file.
      # update-grub
      
    2. Edit /boot/grub/menu.lst (I used nano). Using the GRUB boot device you acquired via the find command, change the line

      # groot=(hd0,0)
      

      to

      # groot=(hd0,2)
      
    3. At this point you should also add the Windows 7 boot entry. Remember to insert this before the ### BEGIN AUTOMAGIC KERNELS LIST line or after the ### END DEBIAN AUTOMAGIC KERNELS LIST line.

      title        Windows
      rootnoverify (hd0,1)  # use the correct partition for Windows!!!
      makeactive
      chainloader  +1
      
    4. Save your changes and then run update-grub again to generate the updated GRUB configuration file.

      # update-grub
      
  6. Generate a new initramfs that loads the dmraid kernel module.

    # echo dm-raid4-5 >> /etc/initramfs-tools/modules
    # update-initramfs -u
    
  7. Edit /etc/modules to load the dmraid kernel module at boot.

    # echo dm-raid4-5 >> /etc/modules
    
  8. You’re done! “Log out” from the Ubuntu installation.

    logout
    
  9. Switch back to the first console by pressing CTRL-ALT-F1 and finish the installation by selecting Continue without boot loader from the menu.

After the computer restarts you should be able to boot into your new Ubuntu installation. Congratulations!

Booting into Windows 7, however, will fail with a BOOTMGR is missing message. Didn’t you wish you did that backup?

No need to panic, though. Just boot your Windows 7 installation CD, click Repair your computer and it should detect the problem. Press Repair and restart.

Upon restarting, Windows 7 still fails to boot. Once again boot up the Windows 7 installation CD and click Repair your computer, and this time you’ll have access to the System Recovery Options dialog. Select Use recovery tools… and the Windows 7 entry from the list of operating systems. Click the Next button.

On the next dialog, select the Startup Repair link. Click Finish on the last dialog. After rebooting, Windows 7 should start correctly.

Feel free share your experiences in attempting this guide. Corrections are very much welcome as well. Good luck!

Globe Tattoo on Ubuntu Jaunty 9.04

Update: Confirmed that the device Just Works in Ubuntu Karmic 9.10. No need to install udev-extras and fiddle with udev rules.


Globe Tattoo mobile internet service is officially supported in Windows and MacOS X, but it should work in a Linux installation with a recent kernel.

My Tattoo unit is marked Huawei E1552 HSDPA USB Stick. Ubuntu Jaunty 9.04 recognized it as a HUAWEI Mass Storage/MMC Storage device. According to this web page:

Several new USB devices (especially high-speed wireless WAN stuff, there seems to be a chipset from Qualcomm offering that feature) have their MS Windows drivers onboard; when plugged in for the first time they act like a flash storage and start installing the driver from there. After that (and on every consecutive plugging) this driver switches the mode internally, the storage device vanishes (in most cases), and a new device (like an USB modem) shows up. The WWAN gear maker Option calls that feature “ZeroCD (TM)”.

The web page then explains how to install a tool (USB_ModeSwitch) to help perform the “mode switch” in Linux. I prefer to work within the distro’s official repositories, however, and fortunately, Ubuntu provides a similar tool, modem-modeswitch, in the udev-extras package.

Here’s what I did under Ubuntu 9.04 for my Huawei E1552 Globe Tattoo device:

  1. install the udev-extras package

    sudo apt-get install udev-extras
  2. create a file called /etc/udev/rules.d/62-option-modem-modeswitch.rules, and paste this line:

    ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd"
  3. restart udev

    sudo /etc/init.d/udev restart

Now plug-in the Tattoo device. If you’re watching /var/log/messages, you should see the kernel detecting the device as a mass storage device, then disconnecting the device, then finally detecting it as a USB GSM modem. (Interestingly, lsusb reports the device to be a Huawei E620 USB Modem.)

If your device isn’t detected properly, try changing the values for idVendor and idProduct in Step 2 above. Use lsusb -v to find the values for your device. Also make sure that the rules file you saved in /etc/udev/rules.d/ has a higher number prefix than the similary-named rules file in /lib/udev/rules.d/.

You should then create a mobile broadband network connection via the NetworkManager applet. I changed the APN to http.globe.com.ph, following this post.

Sometimes when I try to connect, the modem will properly authenticate but then hang up. I just keep trying to connect until I am prompted for the password (globe). Connection usually succeeds after that. Still, I feel my connection is too slow. I have no way of determining if I’m connected to HSDPA or 3G or GPRS. Maybe someone out there can find out.