Install GRUB2 to a RAID array

You should only need to run:

grub-install --no-floppy --recheck /dev/md0

but this occasionally fails (GRUB2 is buggy…). Manually install onto each component disk with:

sudo grub-setup -r '(md0)' /dev/sda
sudo grub-setup -r '(md0)' /dev/sdb

grml from GRUB 2

grml ISOs can be loaded, without modification, from GRUB 2. This makes for an excellent on-disk "recovery partition" of sorts.

For grml's 64-bit "medium" ISO, put the following at the end of /etc/grub.d/40_custom:

menuentry "grml-rescue system from harddisk" {
  loopback loop (hd0,1)/grml-medium.iso
  linux    (loop)/boot/grml64medium/linux26 isofrom=/dev/sda1/grml-medium.iso boot=live quiet vga=791 noeject noprompt
  initrd   (loop)/boot/grml64medium/initrd.gz
}

and then place the ISO image at /boot/grml-medium.iso.

Based on information from: Boot an ISO via GRUB2

Alternatively, you can install the grml-rescueboot or grub-imageboot packages which handle the above for you.

Loading bootable ISOs for Lenovo BIOS updates

Copied from a thread on the ThinkPads support forum.

Reporting success on a Thinkpad X301. I never booted into Vista with this laptop, I installed Debian onto it as soon as I got it. Here is what I has to do to get Zender's BIOS onto an X301 with GNU/Linux:

First, get the BIOS file .zip that Zender has made, then unzip to see the 2 files. You only need the $01BD000.fl1 file with md5sum a8ac101a3c5a64584219b612848933bc (this is for version 6EET40WW 3.00 of Zender's hacked BIOS).

Second, get the BIOS Update Bootable CD image from Lenovo's website here: http://www-307.ibm.com/pc/support/site.wss/MIGR-70466.html The filename will be 6euj30uc.iso and my md5sum reports 22f48f4115b8ec02eab0eb1bfdffcbba. This ISO, if mounted or burned, appears to be empty (no files on the ISO9660 filesystem). This confused me at first, but then I found....

Now, check out some good info on http://www.thinkwiki.org/wiki/BIOS_update_without_optical_disk where they explain that this CD image is of BootMediaType=4 which has something to do with hard disk emulation as specified in the "El Torito” bootable CD image standard. You are going to need to use the isobar that has been ported to GNU/Linux linked to on the Thinkpad wiki to extract the FAT32 hard disk filesystem image on the ISO file.

So: download http://colimit.googlepages.com/isobar.c and compile it using "gcc isobar.c -o isobar" (Ubuntu users, make sure to have the package build-essentials for gcc). Now you can get that FAT32 disk image with "./isobar 6euj30uc.iso -o bios.img" and then you can mount the resulting FAT32 disk image with "sudo mount bios.img /mnt -o loop" which will mount it at the /mnt directory.

Now, you can swap out Zender's modified BIOS with the one in Lenovo's boot disk. Looking through /mnt shows us a 'flash' subdirectory and within that a '6eet40ww' directory. In there are Lenovo's .fl1 BIOS files. Replace Zender's BIOS with the one there... "sudo cp $01BD000.fl1 /mnt/flash/6eet40ww/" worked for me.

You can unmount the bios.img now that you have replaced the hacked BIOS: "sudo umount /mnt" Now we are ready to boot off of this thing!

After reading the aforementioned page on the thinkpad wiki, I decided it would be easiest to boot directly from GRUB as I already had it installed. I installed the syslinux package (using "sudo apt-get install syslinux") and copied the memdisk file it contained into the /boot directory with "sudo cp /usr/lib/syslinux/memdisk /boot/" and then the modified BIOS image to the same directory with "sudo cp bios.img /boot/".

Now, we need to modify GRUB configs to add a boot entry for this. There are two slightly different ways of doing this depending on if you run GRUB 1 (legacy) or the newer GRUB 2. I will include instructions for both, as they are somewhat similar.

GRUB 1:

Edit menu.lst with superuser privileges using the command "sudo gedit /boot/grub/menu.lst" and add the following lines towards the end:

title BIOS update
root (hd0,0)
kernel /memdisk
initrd /bios.img

Save, exit, and boot from the "BIOS update" option in the GRUB menu and follow the (simple) steps.

GRUB 2:

Edit grub.conf with superuser privileges using the command "sudo gedit /boot/grub/grub.conf" and add the following lines towards the end:

menuentry "BIOS update" {
root (hd0,1)
linux /memdisk
initrd /bios.img
}

Depending on your distribution, you may need to modify the permissions of grub.conf to give root write permissions, for example using this command: "sudo chmod 744 /boot/grub/grub.conf" Save, exit, and boot from the "BIOS update" option in the GRUB menu and follow the (simple) steps.

Now you should have a flashed BIOS. I noticed it would not work when you first reboot. You must go into the BIOS setup and then hit F10 for saving and rebooting once more. The error went away after that, and installing a new Atheros chipset card in the Mini PCI Express slot worked beautifully. Hurray for the ath9k driver in my Thinkpad X301!

Hope this helps any GNU/Linux users with other thinkpads, especially the X300 and X301. I found it pleasant to boot from GRUB and not have to deal with CDs at all.

*NOTE*: The first time I tried this, it hung booting from GRUB at the "loading PC DOS" line. This means you have a bad memdisk file. I was using the one from the syslinux package in Ubuntu jaunty which froze. I switched to the memdisk file from the Debian unstable package and it worked. Look around for a different memdisk file if you freeze at that step.


CategoryCheatSheet

SamatsWiki: CheatSheet/Grub (last edited 2011-08-22 01:57:56 by SamatJain)