12.04 preseeded install with RAID and LVM

I am trying to set up a preseed install (Ubuntu 12.04.03 64-bit) with the following partitioning recipe, but it's just not working and I'm not sure why.

Please, Obi-Wan, you're my only hope.

The -1 in the sizes were originally 1000000000 so I tried changing to -1 but it made no difference.

d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-auto/purge_lvm_from_device  boolean true

d-i partman-auto/disk string /dev/sda /dev/sdb
d-i partman-auto/method string raid

d-i partman-auto-lvm/new_vg_name string vg_sys
d-i partman-auto-lvm/guided_size string max

d-i partman-auto/choose_recipe select raid-lvm
d-i partman-auto/expert_recipe string                      \
      raid-lvm ::                                          \
        512 10 512 raid                                    \
          $primary{ } $lvmignore{ } $bootable{ }           \
          method{ raid }                                   \
        .                                                  \
        8192 20 -1 raid                                    \
          $primary{ } $lvmignore{ }                        \
          method{ raid }                                   \
        .                                                  \
        1024 100 1024 ext4                                 \
          $defaultignore $lvmok{ } lv_name{ root }         \
          method{ format } format{ }                       \
          use_filesystem{ } filesystem{ ext4 }             \
          mountpoint{ / }                                  \
        .                                                  \
        4096 100 4096 linux-swap                           \
          $defaultignore $lvmok{ } lv_name{ swap }         \
          method{ swap } format{ }                         \
        .                                                  \
        1024 100 2048 ext4                                 \
          $defaultignore $lvmok{ } lv_name{ tmp }          \
          method{ format } format{ }                       \
          use_filesystem{ } filesystem{ ext4 }             \
          mountpoint{ /tmp }                               \
        .                                                  \
        4096 100 8192 ext4                                 \
          $defaultignore $lvmok{ } lv_name{ var }          \
          method{ format } format{ }                       \
          use_filesystem{ } filesystem{ ext4 }             \
          mountpoint{ /var }                               \
        .                                                  \
        2048 100 4096 ext4                                 \
          $defaultignore $lvmok{ } lv_name{ usr }          \
          method{ format } format{ }                       \
          use_filesystem{ } filesystem{ ext4 }             \
          mountpoint{ /usr }                               \
        .                                                  \
        2048 110 16384 ext4                                \
          $defaultignore $lvmok{ } lv_name{ home }         \
          method{ format } format{ }                       \
          use_filesystem{ } filesystem{ ext4 }             \
          mountpoint{ /home }                              \
        .                                                  \
        512 1000 -1 ext4                                   \
          $defaultignore $lvmok{ } lv_name{ deleteme }     \
          method{ lvm }                                    \
        .

d-i partman-auto-raid/recipe string                              \
    1 2 0 ext4 /boot  /dev/sda1#/dev/sdb1                    .   \
    1 2 0 lvm  -      /dev/sda2#/dev/sdb2                    .

# the 'deleteme' LV soaks up the leftover space in the VG
d-i preseed/late_command string in-target lvremove -f vg_sys/deleteme

d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish

d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman-lvm/confirm boolean true
d-i partman-md/confirm boolean true
d-i partman-md/confirm_nooverwrite  boolean true

d-i partman/mount_style select label

d-i mdadm/boot_degraded boolean false

Here's the error I'm getting:

image of irritating failure

The disks are dual 50GiB (to be precise, 53,687,091,200 bytes).


Solution 1:

I think your mistake is here:

d-i partman-auto/choose_recipe select raid-lvm
d-i partman-auto/expert_recipe string                      \
      raid-lvm ::                                          \

You use partman-auto/choose_recipe when you are going to use a factory predefined recipe. If you are not, then make your own recipe using partman-auto/expert_recipe,specifying multiraid, not raid-lvm.

Your config file should be then

d-i partman-auto/expert_recipe string                      \
      multiraid ::                                         \

my conclusions came from reading this and this.

Solution 2:

I ended up here because I was getting the exact same errors:

Error: No recipe specified in partman-auto-raid/recipe

Along with:

Available disk space (XXX) too small for expert recipe (2200008705)

Here is the relevant bit of my BAD preseed file:

d-i partman-auto/method string raid
d-i partman-auto/disk string /dev/sda /dev/sdb

d-i partman-auto/expert_recipe string                        \
     multiraid ::                                            \
              1 1 1 free                                     \
                      $gptonly{ }                            \
                      $primary{ }                            \
                      $bios_boot{ }                          \
                      method{ biosgrub }                     \
              .                                              \
              4096 1000 4096 linux-swap                      \
                      $gptonly{ }                            \
                      $primary{ }                            \
                      method{ swap } format{ }               \
              .                                              \
              141101 1000 141901 raid                        \
                      $gptonly{ }                            \
                      $primary{ }                            \
                      method{ raid } format{ }               \
              .                                              \
              1 2000 -1 ext4                                 \
                      $gptonly{ }                            \
                      $primary{ }                            \
                      method{ format } format{ }             \
                      use_filesystem{ } filesystem{ ext4 }   \
              .                                              \                                
# Last you need to specify how the previously defined partitions will be
# used in the RAID setup. Remember to use the correct partition numbers
# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported;
# devices are separated using "#".
# Parameters are:
# <raidtype> <devcount> <sparecount> <fstype> <mountpoint> \
#          <devices> <sparedevices>

d-i partman-auto-raid/recipe string 1 2 0 ext4 / /dev/sda2#/dev/sdb2 .

The problem, annoyingly enough was that I left a trailing backslash on the end of the last line of the expert recipe. It should have been this:

              1 2000 -1 ext4                                 \
                      $gptonly{ }                            \
                      $primary{ }                            \
                      method{ format } format{ }             \
                      use_filesystem{ } filesystem{ ext4 }   \
              .                                                                              

Hope this helps somebody!

Solution 3:

You don't mention if you're using a 32- or 64-bit distribution here, but I thought that number reported in your error is pretty weird, "2200008705". Where would that come from? Well, take that number and subtract the largest value for a 32-bit unsigned int (2147483647), and you get 52,525,058, which looks an awful lot like the exact size of your 50GB disks, no?

Looking at section 5 of partman-auto-recipe.txt, which is about using very large sizes for whatever partition you want to fill all free space, it says:

Do not use higher than 1000000000 numbers because the shell arithmetic
is limited to 31 bits (on i386).

In your question, you said that before you set the values to -1, they were set to 10000000000, which is one place/zero too many when compared to their suggestion for a max value. Perhaps you overflowed a value somewhere, and that's why your recipe didn't initially work before you changed it to -1?