Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Sunday, November 6, 2011

fakeraid -Reinstalling GRUB 2 from LiveCD

Read before all
Two important sources of Grub 2 information are the GNU Grub Manual and on-line information available by running the following command:
Code:
info -f grub -n 'Simple configuration'
Grub 1.99 / Natty: Black Screen, with or without blinking cursor
If your boot in Natty ends up at a blank black screen, or a screen with a blinking cursor, take a look at the following thread. Forum member MAFoElffen has done some great research and has come up with some workarounds that may get your system booted. Here is the thread:
Graphics Resolution- Upgrade /Blank Screen after reboot
Repair Using the Correct CD !
It appears that Grub 1.98 and Grub 1.99 don't get along well. If having to repair a Grub 2 problem using a LiveCD, make sure the OS and CD are for the same release (Natty LiveCD for Natty, Maverick LiveCD for Maverick, etc). This includes running the 'grub-install' command to write to the MBR.
 
[based on this Source]
(with my additions and corrections --cebaehren)

I have a fakeraid RAID1 on MoBo ECS A785GM-AD3 (AMD softRAID)
 The RAID is multibooting 3 OS
Seven, Ubuntu and XP, in this order as primary partitions (read the explanations in the dotted list)
Seven at first partition /dev/dm-1
Ubuntu 10.04: /boot is 2nd primary minipartition (100MB)  /dev/dm-2
XP as third partition /dev/dm-3
Extended partition /dev/dm-4
NTFS partition /dev/dm-5
Swap partition /dev/dm-6
Ubuntu root  /dev/dm-7
Ubuntu /home  /dev/dm-8
----------------------
For more details or for advanced options, refer to the Ubuntu community documentation here:
Grub2 – Reinstalling GRUB 2:
  • Boot the ubuntu LiveCD.
  • Open a terminal – Applications, Accessories, Terminal.
    If you have an fakeraid try first
    sudo modprobe -q dm-mod
    sudo modprobe -q dm-mirror
    sudo /sbin/dmraid -ay
    Note that in an diskmapperRAID
    (not multiplediskRAID!) the RAID device (two or more hard disks in array) is found as a nvidia device with long stupid name:
    You find it in /dev/mapper/nvidia_edabbdgc  
    with first partition as nvidia_edabbdgc1 and counting
    Illogically, when trying to use it it was not recognized at this name
    Use following:
    /dev/dm-0 for the array of disks and
    /dev/dm-1
    for the first partition and so counting for the following parttitions
    that is fdisk /dev/dm-0
  • Determine your normal system partition
    sudo fdisk -l (That is a lowercase L)
  • If you aren’t sure, run `df -Th`. Look for the correct disk size and ext3 or ext4 format.
  • Note that normally you never shall mount more than a partition on a bare mounting point. Normally you must create a mounting point for each partition, prior to mount it at the same directory:
    sudo mkdir /mnt/sdXY
    But for this case and the purpose of recover the bootloader grub 2, we must follow the original advice and mount the root partition directly on /mnt of the liveLinux
  • Mount your normal system partition:
    Code:
    sudo mount /dev/sdXY /mnt (not fakeraid)
    sudo mount /dev/md-Y /mnt (fakeraid)
    sudo mount /dev/md-7 /mnt

    • Note: The partition to mount is normally the partition on which Ubuntu was installed: sda1, sdb5, etc.
      If you have a separate /boot partition, use the device on which the /boot partition is located.
      Grub 2 works best when installed in the MBR of the drive to which BIOS boots. Also remember that you mount the partition (including the number) in this step, but you do not include the partition number when you run the “sudo grub-install” command later.
    • cebaehren note: the kernel or Linux command consider the X as a letter of alphabet for the (considered as) scsi device (sda, sdb, sdc). The partitions starting with 1 (sda1, ... sdb3, sde5, etc)
    • Note: GRUB 2 counts the first drive (not this case in X) as “0″, but the first partition (Y) as “1″
  • Only if you have a separate boot and home partition:
    Code:sudo mount /dev/sdXY (separate boot partition in non fakeraid)
    sudo mount /dev/dm-Y /mnt/boot (fakeraid)
    sudo mount /dev/dm-2 /mnt/boot

    sudo mount /dev/dm-8 /mnt/home
  • Reinstall GRUB 2
    The next command is the one that has changed for Ubuntu 11.04 with GRUB2 1.99
    "In Grub 1.99, introduced with Ubuntu 11.04, Natty Narwhal, a new switch is available which more clearly defines where the grub folder is placed"
    Code:
    sudo grub-install --boot-directory=/mnt/boot /dev/sdX (no fakeraid -new grub!) 
    With older than 1.99rc grub versions:
    sudo grub-install --root-directory=/mnt /dev/sdX (no fakeraid)
    sudo grub-install --boot-directory=/mnt/boot /dev/dm-0
    Note: Substitute the fakeraid device (RAID1) on which Ubuntu was installed /dev/dm-0 
    On normal installations (no fakeraid) sda, sdb, etc. 
    Do not specify a partition number!
    Example: sudo grub-install --root-directory=/mnt /dev/sda (no fakeraid)
    If you become errors, try
    sudo grub-install --root-directory=/mnt --boot-directory=/mnt/boot /dev/mapper/nvidia_edabbdgc 
    
  • Unmount the partition:
    Code:
    sudo umount /mnt
  • sudo reboot
  • perhaps you are confronted to a simble bash terminal of grub 2... Whatever!
    DO NOT FORGET after new start in a terminal do
    sudo update-grub
  • REBOOT otherwise!

No comments: