Comment 6 for bug 346589

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

I agree that Matt's request for the dialog to go away should be a separate bug. The original reporter of this bug did not raise the presence of the dialog as a problem.

When /cdrom is mounted from a physically-read-only device or something that supports the CD capability ioctl (of course, a real CD-ROM will be both), it's already excluded. Therefore the remaining interesting cases are:

  * CD contents written to the entirety of a writeable medium and used as the installation medium (common case: usb-creator when told to use the whole disk)
  * CD contents written to one partition of a writeable medium and used as the installation medium (common case: recovery partition, such as that used by Dell)

In the former case, I agree that it is unnecessary and confusing to show a dialog. You can't use the installation medium as an installation target, and you're reasonably unlikely to want to.

However, the latter case is quite different. Consider the case where the CD contents have been written to a partition as a recovery image, which is then booted. Since the containing disk is considered busy in the kernel, we aren't going to be able to reread the partition table in the event that it is changed, which may cause problems; on the other hand, it may well be useful to use that disk as an installation target, particularly if the recovery image uses careful preseeding to ensure that it only uses existing partitions, so the disk should not simply be excluded. In the event that such an image is used without preseeding, it is more helpful to inform the user that the full range of partitioning operations are not available on this disk than it is to simply ignore the disk.

Perhaps an improved interface would be as follows:

  * If a filesystem that is not the installation medium is mounted from a disk that would otherwise be a candidate for partitioning, then issue a warning as we do today.
  * If the installation medium is mounted from a disk that would otherwise be a candidate for partitioning, and it occupies the whole disk (i.e. either it fills the entire device, or it occupies the only partition on the device and there is no more than a trivial amount (say, 16MB) of unpartitioned space available), then silently exclude that disk.
  * If the installation medium is mounted from a disk that would otherwise be a candidate for partitioning, and it does not occupy the whole disk as defined above, then the disk may be useful for partitioning but should be considered "locked": only changes that do not modify the partition table should be allowed.

partman-base/lib/base.sh:partman_lock_unit() is approximately the interface we'd want to use to implement the last point; this is used by partman-crypto and partman-lvm. However, it isn't quite perfect, because it locks all partitions on the device against *any* changes, not just ones that would modify the partition table. We should look into this in a bit more detail when addressing this new bug.