[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#516347: debian-installer: guided-with-lvm no longer allows multiple primary partition



Yup, this is biting me too... Sorry for the long stream-of-conscious report here, but I wrote as I worked through this issue and it shows. ;) I don't know what someone may find important or not.

It's an odd bug though. When I create a small /boot partition as the first item in the recipe, it rolls right along.

d-i partman-auto/expert_recipe string mydisk :: \
    64 300 300 ext3                             \
      $primary{ } $bootable{ }                  \
      method{ format } format{ }                \
      use_filesystem{ } filesystem{ ext3 }      \
      options/noatime{ noatime }                \
      label{ boot }                             \
      mountpoint{ /boot }                       \
    .                                           \
    10000 10000 70000 ext3                      \
      $lvmok{ }                                 \
      method{ format } format{ }                \
      use_filesystem{ } filesystem{ ext3 }      \
      options/noatime{ noatime }                \
      mountpoint{ / }                           \
    .                                           \
    512 1024 300% linux-swap                    \
      $lvmok{ }                                 \
      method{ swap } format{ }                  \
    .                                           \
    500 10000 1000000000 ext3                   \
      $lvmok{ }                                 \
      method{ format } format{ }                \
      use_filesystem{ } filesystem{ ext3 }      \
      options/noatime{ noatime }                \
      mountpoint{ /home }                       \
    .

But if I remove the small boot partition and move root to the first primary partition it fails.

d-i partman-auto/expert_recipe string mydisk :: \
    10000 10000 70000 ext3                      \
      $primary{ } $bootable{ }                  \
      method{ format } format{ }                \
      use_filesystem{ } filesystem{ ext3 }      \
      options/noatime{ noatime }                \
      mountpoint{ / }                           \
    .                                           \
    512 1024 300% linux-swap                    \
      $lvmok{ }                                 \
      method{ swap } format{ }                  \
    .                                           \
    500 10000 1000000000 ext3                   \
      $lvmok{ }                                 \
      method{ format } format{ }                \
      use_filesystem{ } filesystem{ ext3 }      \
      options/noatime{ noatime }                \
      mountpoint{ /home }                       \
    .

The failure from the partman logs:

/bin/autopartition-lvm: IN:
/bin/autopartition-lvm: IN: boot
parted_server: Processing flag boot
parted_server: The flag set true.
/bin/autopartition-lvm: IN: NO_MORE
parted_server: Closing infifo and outfifo
parted_server: main_loop: iteration 40
parted_server: Opening infifo
/bin/autopartition-lvm: IN: NEW_PARTITION =dev=hda primary ext3 10001940480-60011642879 beginning 50011000001
parted_server: Read command: NEW_PARTITION
parted_server: command_new_partition()
parted_server: Note =dev=hda as changed
parted_server: Opening outfifo
parted_server: requested partition with type primary
parted_server: requested partition with file system ext3
parted_server: add_primary_partition(disk(117210240),19535040-117212774)
parted_server: OUT: Error


Obviously a disk with 117210240 sectors isn't going to allow a partition ending at sector 117212774. I've been tracing through the code to try and determine where the sectors and sizes are calculated with limited success. The modular partman-* package structure makes it somewhat difficult to track down.


Well, in some cases it looks like the autopartition-lvm is passing around incorrect values for partition sizes and offsets. For example, my failure case passes the following parameters to parted-server's command_new_partition() function.

/home parameters:
type    fs_type range_start-range_end   position  length
primary ext3    10001940480-60011642879 beginning 50011000001

Note that since this partition is being calculated from the beginning, the range_end is really just the end of the disk. If you add 10001940480 (range_start) + 50011000001 (length) you get 60012940481 bytes which is larger than the total size of the disk of 60011642879 bytes.

Note how parted_server.c converts the sizes to disk sectors in the logs:

part_start = 19535040
part_end   = 117212774 <--- more sectors than the disk has

The formula used in parted_server.c for calculating the part_end value is:

1824: part_start = range_start / PED_SECTOR_SIZE_DEFAULT;
1825: part_end = (range_start + length) / PED_SECTOR_SIZE_DEFAULT;

So if there is a bounds check just after this code to keep the part_end value at less than the range_end it should work (see attached patch).

I'll dig some more in the partman-auto-lvm package and see if the calculations are borked there. Based upon the other bug reports claiming this is not an lvm specific issue, I bet the size/offset calculations are being done in some shared resource.

Does anyone know how to force the debian installer to use an unsigned udeb source? I have a local debian mirror for netboot installs, but since deb started using signed installer packages I've found it difficult to replace or override the default installer udebs.

Tony
--- parted_server.c.orig        2009-06-17 17:08:04.000000000 +0000
+++ parted_server.c     2009-06-17 16:34:12.000000000 +0000
@@ -1823,6 +1823,10 @@
         } else if (!strcasecmp(position, "beginning")) {
                 part_start = range_start / PED_SECTOR_SIZE_DEFAULT;
                 part_end = (range_start + length) / PED_SECTOR_SIZE_DEFAULT;
+                // Truncate the partition end to fit the maximum disk size
+                if ( part_end > ( range_end / PED_SECTOR_SIZE_DEFAULT ) ) {
+                  part_end = ( range_end / PED_SECTOR_SIZE_DEFAULT );
+                }
         } else if (!strcasecmp(position, "end")) {
                 part_start = (range_end - length) / PED_SECTOR_SIZE_DEFAULT;
                 part_end = ((range_end - PED_SECTOR_SIZE_DEFAULT + 1)

Reply to: