cfdisk complains about auto-resize generated setup

Bug #107023 reported by Ian Jackson
6
Affects Status Importance Assigned to Milestone
parted (Ubuntu)
Invalid
Undecided
Unassigned
util-linux (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

Binary package hint: partman-auto

I did the following using the feisty i386 d-i rc cd 20070415:

1. Install in the most normal way with erase whole disk.
2. Install again, in Dutch, selecting auto-resize

After I had finished the partition tables were set up in a way that made cfdisk complain. The machine has a single 80GB IDE disk.

I will attach a typescript showing the complaints from cfdisk and some warnings from fdisk.

Tags: iso-testing
Revision history for this message
Ian Jackson (ijackson) wrote :
Revision history for this message
Colin Watson (cjwatson) wrote :

Partitions not being in disk order seems like an intrinsic property of resizing a big partition near the start and adding multiple partitions in the middle, unless you think it's a good idea to renumber existing partitions. I'm therefore not concerned about the fdisk error.

I'm not sure what the cfdisk error means. It doesn't obviously seem to be borne out by the output from the other tools.

Revision history for this message
Colin Watson (cjwatson) wrote :

This is the sanity check in cfdisk that's being tripped:

    for (i = 0; i < num_parts && p_info[i].last_sector < first; i++);

    if (i < num_parts && p_info[i].id != FREE_SPACE) {
         if (last < p_info[i].first_sector)
              *errmsg = _("logical partitions not in disk order");
         else if (first + offset <= p_info[i].last_sector &&
                  p_info[i].first_sector + p_info[i].offset <= last)
              *errmsg = _("logical partitions overlap");
         else
              /* the enlarged logical partition starts at the
                 partition table sector that defines it */
              *errmsg = _("enlarged logical partitions overlap");
         return -1;
    }

I must admit that I'm finding this a bit inscrutable. It's either a bug in libparted or in cfdisk, but I have no idea which. Opening two bug tasks for that.

Revision history for this message
Adam Niedling (krychek) wrote :

Feisty is not supported anymore.

Changed in parted:
status: New → Invalid
Changed in util-linux:
status: New → Invalid
Revision history for this message
Colin Watson (cjwatson) wrote :

Contains detailed (albeit inconclusive) diagnosis by a developer. Do not close.

Changed in parted:
status: Invalid → Triaged
Changed in util-linux:
status: Invalid → Triaged
Revision history for this message
Luke Plant (spookylukey) wrote :

Still present in hardy/jaunty -- I recently installed Hardy on my box, which contained an existing Jaunty installation. (Bug #333584 #https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/333584 stopped me installing Intrepid, so I had to install Hardy). After I had done, the partition table could not be read by cfdisk (whether Intrepid or Jaunty's version). GParted (any version) has no problem with it.

My partition table, from fdisk:
---
Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x10000000

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 35243 283089366 83 Linux
/dev/sda2 35244 38913 29479275 5 Extended
/dev/sda5 37781 38913 9100791 82 Linux swap / Solaris
/dev/sda6 35244 37669 19486782 83 Linux
/dev/sda7 37670 37780 891576 82 Linux swap / Solaris

Partition table entries are not in disk order
---

My guess is that the problem is cfdisk. See also http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=464377

Revision history for this message
Tim Webster (tdwebste) wrote :

In my case using gparted to resize a partition within the extended partition caused the problem.

dpkg -p gparted | grep Version
Version: 0.4.5-2

I suggest:

 fixed it up with booting from a live-cd and using a usb-key.
sfdisk -d /dev/hda>hda.out
where hda.out is in on my usb key.
then
sfdisk /dev/hda -O backup.hda<hda.out
to simply rewrite the partiton table saved as hda.out
the backup.hda is a backup (made on my usb key too) in case something goes
wrong.

or
b)
fdisk advanced mode
 by pressing x
show help m
and use the f option
write changes w

then reboot

you may also need to adjust your /boot/grub/menu.lst, and also your /etc/fstab

P.S.
I have included the gparted package version in the Description field
Also please refer to parted bug list.

Revision history for this message
Phillip Susi (psusi) wrote :

So (c)fdisk complains that the partitions are not in order? I'd say that's their bug; there's nothing wrong with them not being in natural order.

Revision history for this message
Phillip Susi (psusi) wrote :

This is easy to reproduce by simply creating two logical partitions out of order. This is an error in cfdisk not parted.

Changed in parted (Ubuntu):
status: Triaged → Invalid
Revision history for this message
Ian Jackson (ijackson) wrote : [Bug 107023] Re: cfdisk complains about auto-resize generated setup

Phillip Susi writes ("[Bug 107023] Re: cfdisk complains about auto-resize generated setup"):
> This is easy to reproduce by simply creating two logical partitions out
> of order. This is an error in cfdisk not parted.
>
> ** Changed in: parted (Ubuntu)
> Status: Triaged => Invalid

I think the status in util-linux should therefore be Confirmed ?

Colin has posted the offending bit of code. Maybe it needs to be
simply removed, but someone will have to look at the rest of the
cfdisk code to check it doesn't rely on this inaccurate assumption. I
suspect it probably does.

Ian.

Revision history for this message
Phillip Susi (psusi) wrote :

Triaged > Confirmed. I'm actually working on removing the offending code though, so marking as in progress.

Changed in util-linux (Ubuntu):
assignee: nobody → Phillip Susi (psusi)
importance: Undecided → Medium
status: Triaged → In Progress
Revision history for this message
Phillip Susi (psusi) wrote :

Nevermind, after looking at the cfdisk code it seems that it needs a major rewrite to handle out of order partitions.

Changed in util-linux (Ubuntu):
assignee: Phillip Susi (psusi) → nobody
status: In Progress → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.