View Full Version : [ubuntu] 12.04 Upgrade - Raid Array Still Using Old Kernel & Grub

October 8th, 2012, 04:27 AM
Setup 10.10 on this Dell way back when using the alternate install CD and mdadm to create mirroring with dual 2TB drives.

I recently decided to upgrade to 12.04. Everything seemed fine but had a few light crashes and issues with some software.

I then realized even though I upgraded to 12.04 my kernel version is still the old 2.6.38-15-generic-pae and Grub was till 1.99~rc1-13ubuntu3. It has something to do with my raid array.

Tried to update Grub thinking that would be a start but the array is still using the old version.

Can anyone tell me how to get this Raid array upgraded to the latest Kernel and Grub without data loss? I don't have an alternate storage source large enough for the data I have on this array. I'm just not that proficient with Linux but love it.

I attached screen shots.

Thank you in advance. Steve

October 8th, 2012, 09:29 AM
It looks to me like you have two installations, knowingly or not.

Look at the second image. One ubuntu entry is on top, and then the 3.2.0 kernel (the kernel from 12.04) is below the memory test entry, which is where grub2 puts other OSs found on the machine.

So, there is one ubuntu with 2.6.38 as principal, and another with 3.2.0 on /dev/sda3.

I think you should investigate this, but if you only want to make the 12.04 primary OS, simply boot the 3.2.0 entry below the memory test, and once booted execute in terminal:
sudo grub-install /dev/sda

That will make grub2 from 12.04 to install on the MBR of the disk and be the main one. So the 12.04 will become the default OS on top of the boot menu.

October 8th, 2012, 12:46 PM
Thanks darkod

I did see in grub where it listed the newer kernel on both sda3 and sdb3.

I was too scared to boot with either due to the mirroring.

My thought was if I chose to boot the latest kernel on sda3 for example that it would destroy the array if data was written to the disk because I would only be working on sda3 (not being mirrored).

Do you think if I booted from sda3 with the latest kernel the array will still be fine and in sync between both disks?

October 8th, 2012, 01:35 PM
I didn't notice that for sdb3. It seems your main install is not aware of the raid on sda3/sdb3.

It might be better to do it this way:
Boot the ubuntu shown now as main one, install the mdadm package, assemble the raid and then use the correct raid device to mount the root partition and install grub2, like:

sudo apt-get install mdadm
sudo mdadm --assemble --scan
sudo mount /dev/mdX /mnt
sudo grub-install --root-directory=/mnt /dev/sda
sudo grub-install --root-directory=/mnt /dev/sdb

I hope that should do it. Make sure you use the correct md device for root.

October 10th, 2012, 08:50 PM
I included a screen shot in the GUI. It seems the system DOES recognize the Raid1 array so I hesitate to re-install mdadm (unless I need a newer version?).

I decided to try booting from sda3 in Grub (showing the 3.x kernel) and received an error stating

error: File not found
error: You need to load the Kernel first
Press any key..

If I could just get Grub and the new Kernel to use md0 I think it would fix this.

October 10th, 2012, 09:00 PM
If mdadm is recognized even better. But that pictura shows md1, you say md0 is your root? Is it also recognized?

If it is, simply do:
sudo mount /dev/md0 /mnt (unless it's already mounted)
sudo grub-install --root-directory=/mnt /dev/sda
sudo grub-install --root-directory=/mnt /dev/sdb

I think both systemas have to be the same version for this to work, otherwise you might need to do it from live mode.

October 10th, 2012, 10:19 PM
Your right Darko md1 is / and md0 is swap

The first command to work but I got the error below trying to install grub on /sda though

sudo grub-install --root-directory=/mnt /dev/sda
/usr/sbin/grub-setup: warn: This GPT partition label has no BIOS Boot Partition; embedding won't be possible!.
/usr/sbin/grub-setup: error: embedding is not possible, but this is required for cross-disk install.

October 10th, 2012, 10:34 PM
I didn't know your disks have gpt table. On gpt disk you have to make a small 1MB partition with no filesystem, that will have the bios_grub flag.

This is because grub2 doesn't fit on the MBR of a gpt disk so it needs the small partition to save its file there.

But I'm not sure how you can add the partition now when all the system is set up and the disks are partitioned.

Are both disk gpt? If /dev/sdb has msdos table, installing grub2 on it will work.

October 10th, 2012, 11:31 PM
Thanks so much for your help Darko.

I've been beating my head on the case of this system for a week and my patience is shot. At this point I'm giving up and will just use the system as is rather than risk data loss.

I can live with a few minor crashes and quirks but my main objective was to get Virtualbox going again for XP. I'm handicapped needing a few programs in that environment, otherwise I've made the leap. After the upgrade Virtualbox died. All attempts to re-install it fail because of the old kernel I'm stuck with.

Hard lesson learned - always be prepared to start from scratch after clicking the upgrade button.

Thanks again, Steve

October 11th, 2012, 09:06 AM
The main problem seems to be that you have two ubuntu installations and you are using grub2 from the installation that you don't consider "primary".

If you are willing, grub2 can be easily installed from live mode. Just get the live cd of the same version (12.04), boot it into live mode, and in terminal try the commands from post #4, they still apply. Use /dev/md1 since we now know that's the root.

Running from live mode it is not touching anything on the HDDs, and the first command to install mdadm is only for inside the live mode since the cd doesn't contain that package.

Reinstalling grub2 with those commands and mdadm array should work just fine.

After you get grub2 from the raid on your MBR, you have the correct bootloader from the primary system. And it will boot the latest kernel provided the upgrade went well.