I want to upgrade my server to the new Ubuntu and switch to 64 bit on my main server. This is how I managed to get Ubuntu Lucid (Alpha 3) running on my (test) machine, with RAID1 + BTRFS and 64 bit. It is a running story on how I spend my Saturday afternoon, you might need some decent Linux knowledge to follow my lead.

Here we go.

The following lists sums up my needs and troubles:

  • BTRFS for my main partitions (only / and /boot will be ext4);
  • install Ubuntu Lucid (Alpha3);
  • Lucid’s installer does not support BTRFS;
  • there is no CDROM drive in sight.

The attack plan:

  • use unetbootin to create bootable (usb) hardisk image;
  • format the external disk as vfat! (not ext3 will not work when booting);
  • install minimal Ubuntu image on RAID1 ext4 partitions;
  • leave 2 disks with a large partition for BTRFS;
  • install Ubuntu 10.04;
  • reboot;
  • configure BTRFS;
  • move /var, /usr, n’ stuff over to BTRFS.

0th problem: system will not boot from external disk

First I needed to make my system boot from the external USB hardisk, after fiddling in the BIOS, this was fixed.

Back to installing!

1st problem: external hardisk was not recognized as a CDROM

Fixed by adding: cdrom-detect/try-usb=true to the kernel boot parameters as told [here](https://help.ubuntu.com/community/Installation/FromUSBStick#Boot the Computer From USB)

If you get “Incorrect CD-ROM detected” error on detection stage, reboot, press F6 and then ESC to go to manual boot line editing, and add the option ‘cdrom-detect/try-usb=true’. On Ubuntu 9.10 server edition the install menu will be shown right after reboot. Chose “Help” and then press F6. At the boot prompt type “install cdrom-detect/try-usb=true” and hit enter.

Back to installing!

2nd problem: installer files missing

The installer could not copy some files. Luckily you can switch terminals in the installer with Alt+F2 which drops you in a busybox shell. Go to /var/log/ and check the log files. In there I found that it was borking on, some deb called:

linux/fs-secondary-modules-2.6.32-14-generic....udeb

Which wasn’t there. I did have:

linux/fs-secondary-modules-2.6.32-14-generic....ude

(No closing ‘b’!!). Lets fix that by linking the correct name:

# ln -s .....ude ....udeb
operation not permitted

Of course, it is read-only mounted and a VFAT partition which does not support symbolic links. Plan B (copy it):

#mount -o rw,remount /cdrom
cp fs-secondary-modules-2.6.32-14-g.....ude \
fs-secondary-modules-2.6.32-14-g....udeb

Okay, that worked.

Back to installing!

3rd problem: /dev/md1 is used as swap

This system already had a RAID1 configuration on it, so I had to get rid of that first. Also see this link.

I could not delete that raid partition because it is in use as swap by the installer. WTF? Again the Alt+F2:

swapoff /dev/md1	    # md1 was the culprit

I also tend to find fdisk much easier to partition the disks so I also did this from the command prompt - then let the installer rescan the newly partitioned disks. I went for the following layout (for 2 disks):

/dev/sda1	    /dev/sdb1	combined to form md0 (boot)
/dev/sda2	    /dev/sdb2	combined to form md1 (root)
/dev/sda3	    /dev/sdb3	combined to form md2 (swap)
/dev/sda4	    /dev/sdb4	not used, for BTRFS

Back to installing!

4th problem: grub did not install

Grub failed to install on /dev/sda and /dev/sdb. I tried grub-legacy and grub2 both failed.

When the installer asks “Install in master boot record”, say “no” and specify only /dev/sda. It performs a grub-install /dev/sda which fails for some reason. Time to try it ourself. First where is grub-install located, turns out: /target/usr/sbin/grub-install

Now some more foo, drop to the shell again, and chroot to your new install

# chroot /target

This is with grub2:

grub-probe: error: no mapping exists for `md0`

See this. Next I tried:

grub-install --modules=raid /dev/sda
you are attempting a cross-disk install, but the filesystem
containing /boot/grub does not support UUIDs

Hmm, see here for a bug report.

Still in the chroot I did the following:

mount /proc
grub-install --modules=raid /dev/sda
Installation finished. No error reported.

Okay, that worked. No go back to the installer and choose “Continue without a bootloader”, this will finish up installation.

Back to installing!

5th problem: does not boot

GRUB Loading stage1.5.

GRUB Loading, please wait...
Error 2

Hmm, back to the BIOS and enable my disks again - they were disabled so that I could boot from the external USB hard disk. Reboot and… I’m dropped in a grub2 shell. Back to reading the docs.

Next:

grub> ls
(hd0) (hd0,4) .... (md0) (md1) (md2)    # yes! md devices
grub> insmod linux			    # needed?
grub> insmod raid
grub> set root=(md1)
grub> linux (md0)/vmlinuz-2.6.32-14-generic root=/dev/md1
grub> initrd (md0)/initrd.img-2.6.32-14-generic
grub> boot

The kernel names came from this announcement. So I knew it had to be something like vmlinuz-$version-generic.

6th problem: failed to mount root file system

Somehow I managed to miss type the above grub commands.

ITS ALIVE BOOTS!

I still need to figure out how to make this permanent. Looks like you only have to give update-grub as root when you are logged in. This creates a /boot/grub/grub.cfg to will boot your system. (Turns out that config file was missing).

The BTRFS part comes in a separate blog - this is already too long.