Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to setup and install Ubuntu on a RAID 1 setup. I have two disks, sdb and sdc. I've been following this guide

https://help.ubuntu.com/community/Installation/SoftwareRAID

which more or less works for getting everything set up and Ubuntu installed. The problem is at the end of the installation, it tries to install GRUB. By default it tries my "first disk", which gives a "fatal error". I've tried installing it on a specific partion, e.g. sdb1 as well as RAID devices, e.g. md0, md1, etc.. Nothing seems to work.

The actual error is

Unable to install GRUB in /dev/sdb

Executing 'grub-install '/dev/sdb' failed.

This is a fatal error.

Then I'm taken back to the main install menu. If I choose "Install the GRUB boot loader on a hard disk" option, I can pick the partition, but entering sdb2 or md1 gives the same error.

So I went ahead an just didn't install GRUB, which means now I presumably have a working Ubuntu installation, but I can't boot it. I've tried booting from the LiveCD to install GRUB, but I can't chroot into my system because it doesn't seem to recognize that my disk is a Linux disk. There's an error about it being a RAID partition.

So basically I would really like to know how you know to which device to install GRUB at installation, or at the very least, how to install it on to my system now.

I suppose I should also mention that sda is a Windows 7 installation that I would like to keep around and be able to access at boot.

Thanks for any help.

share|improve this question
    
Without saying what the error was, we can't help. Installing to sda (and possibly sdb and sdc as well) is the correct thing to do. To access the raid from the livecd you need to install the mdadm package: sudo apt-get install --no-install-recommends mdadm –  psusi May 15 '11 at 21:34
    
Sorry about that, I've edited my post to include the error message. The reason I was trying to install on something other than sdb, sdc is that I read this thread which seemed to say that I should find the correct partition under /dev/mapper. But when I drop to the shell in the installer, nothing appears in /dev/mapper other than control. –  Kris Harper May 15 '11 at 22:33
    
That is for fakeraid, not software raid. –  psusi May 16 '11 at 13:46
1  
Are you using an MSDOS or GPT partition table? If you are using GPT, you must create a bios_boot partition. –  psusi May 16 '11 at 13:47
    
I managed to get it working by creating three partitions on each drive, RAIDing two sets together for the filesystem and swap and leaving the last two unRAIDed. Then I selected /boot as a mount point for one of them, and picked that one when installing GRUB. This seems to work. My only concern is that GRUB isn't installed on the other drive, so if I have a drive failure, I may not be able to boot. Perhaps I can fix this by installing GRUB on the other drive, despite the fact that that partition isn't set as a /boot mount point? –  Kris Harper May 18 '11 at 0:26

4 Answers 4

I can't help with installing grub now but what i did to get my RAID running is i followed this instruction:

How To Install Ubuntu 8.04 With Software RAID1 | HowtoForge - Linux Howtos and Tutorials and install grub on every raid partition (not swap).

This will be helpful when one HDD fails there's still a working grub.

share|improve this answer
    
When I create my first partition (for the filesystem), I can't set that partition to be bootable. The option is there, but if I select it, it just flickers and says "bootable flag: no". I went ahead and installed it anyway, but I still got the same error when it came to install GRUB. –  Kris Harper May 16 '11 at 0:32
    
Hmm i didn't hear about such kind of behavior before. What's the exact configuration you used to set up your raid. –  K. Hendrik May 16 '11 at 0:48
    
I have three disks, sda is Windows 7. The others, sdb and sdc are blank when I start. When I get to the partition manager, I make a new partition on each drive for the filesystem. Your linked guide says to set this as "physical volume for RAID", rather than "Ext4 filesystem", so I did that. But this means I can't set the bootable flag. I made the rest of the drive swap and did the same on the other drives. –  Kris Harper May 16 '11 at 1:04
    
It seems to me you don't follow the instructions all the way. After you created the raid volumes you have to map them into a raid after that you assign the file system e.g. ext4 after that you can assign the bootable flag. You need to create 2 raid partitions on each drive one for swap one for /. –  K. Hendrik May 16 '11 at 1:37
    
Well I did that eventually. But your guide says "Make the partition bootable" before creating the software RAID, and the installer won't let me do that. I went through with the installation and created the RAID, then assigned / and swap to the two RAID devices. But there's still an error when it tries to install GRUB. –  Kris Harper May 16 '11 at 2:50

Many of the answers here are just plain incorrect, telling you to disable BIOS RAID! The correct solution is at this blog entry. I'll summarize it below.

At the stage of the install where it is attempting to install GRUB it will detect as

/dev/mapper

This is incomplete! That's why the GRUB install fails.

You need the actual name of the RAID array to install to. So during that step, press ctrl+alt+F2 to drop to a busybox terminal, then enter

ls -l /dev/mapper

Pick out the name of your array from the list shown, then press ctrl+alt+F1 to switch back to the install (you can switch back and forth as much as you like with no problems) and enter it in the field as

/dev/mapper/{your array name}  

then GRUB installs perfectly and you're ready to go, with a proper BIOS RAID array intact.

share|improve this answer
2  
What if ls -l /dev/mapper shows nothing but "control" as its contents? –  Brian Bauman Oct 25 '12 at 7:11
    
I'm not sure. I suspect you don't have BIOS RAID aka "fake" RAID at that point then? –  Jeff Atwood Oct 25 '12 at 18:12
    
I complete the partitioning and installation as per usual, and the installation then fails at GRUB installation. I'm not sure why the RAID wouldn't be initiated at that point, since the installation was specifically to the three raid arrays I built - raid1 /, raid0 swap, and raid1 /home. –  Brian Bauman Oct 25 '12 at 22:49
    
It is worth mentioning that I was erroneously using fakeRAID and software RAID interchangeably. My first attempt was based around using the BIOS raid, but advice from this thread recommended that I use Linux software RAID instead, which is what I've been trying to make work since then. Will try your advice using BIOS fakeRAID again and report back. –  Brian Bauman Oct 26 '12 at 13:13
    
Ah yes - now reminded of why I abandoned that approach a few months back - Ubuntu only detects 800GB or so of the BIOS RAID. Having to space out a build over months makes it easy to forget things! –  Brian Bauman Oct 26 '12 at 13:54
up vote 7 down vote accepted

My problem turned out to be that I had GUID partition table since my drives were 2TB each. The method I originally tried to follow didn't assume this, and so installing GRUB didn't work.

Instead, you should make a small (1MB) partition on each disk and RAID them together and set it as a GRUB boot partition (I'm not sure of the actual name). Set up your other RAID partitions (e.g. swap and /) and then the GRUB installer should find the boot area just fine.

(On Debian this is called a reserved BIOS boot area.)

share|improve this answer

A slight variation on @root45's recipe got me going (on an Ubuntu-only system). I didn't make the bootable partition part of the Raid array.

I created a small bootable GRUB partition (I chose the partition editor's option: "use is 'bootgrub'" or something similar) and did not make it part of the Raid device along with the swap and data (/) partitions.

You can rewrite the Grub2 data to the 'bootgrub' partition at any time .... as indeed the installation process will, on your behalf, when given the choice after all your selected packages have been installed; or at any time later if corrupted with grub-install /dev/sda changing the 'sda' to the device of the partition you used in 'step one' above to be 'used as "bootgrub"'.

If you choose to cause the installing of the many packages in a LAMP server, for example, it can be quite a while after partitioning before you get asked about writing the Grub2 data to the hard disk ... and the defaults it offered at that time caused an error until I supplied my "bootgrub" partition's device ... and all went OK and I have a viable system now.

share|improve this answer

protected by Community Oct 24 '12 at 13:52

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.