ubiquity overwrites VBR of extended partition

Bug #445067 reported by Martin Erik Werner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
parted (Ubuntu)
Fix Released
Undecided
Unassigned
Karmic
Won't Fix
Undecided
Unassigned
partman-basicmethods (Ubuntu)
Fix Released
Medium
Colin Watson
Karmic
Fix Released
Medium
Colin Watson

Bug Description

Binary package hint: ubiquity
Version: 1.99.28
LiveCD daily: 06-Oct-2009 08:18

When installing through ubiquity the Volume Boot Record(s?) of extended partition(s?) are wiped.

I've taken a hit from this problem since on my main machine I have grub installed to the VBR of an extended partition. Then when installing karmic directly to a usb stick (specifically installing grub to the mbr of the usb) I then wiped the grub vbr from my extended partition on the main hard disk.

I have furthermore done some testing in a virtualbox with two virt harddrives, confirming that ubiquity (but not the grub2 tools) will mess up the extended partition(s?) whenever performing an install:

Some notes on the testing:

Installed jaunty inside extended partition on sda5 (swap to sda6), grub vbr installed to sda1 via ubiquity.
grub setup to mbr using livecd.
sudo grub
root (hd0,4)
setup (hd0)

Install karmic to sdb1 (specifying no using swap on sda6), specifying bootloader to /dev/sdb, noting that last screen says partition table of both sda and sdb will be changed (!?)

using sudo dd if=/dev/sda1 bs=512 count=1 | xxd
I notice that what formerly was a grub VBR is now only a few odd bits that I guess is only for describing the extended partition

I reinstalled grub-legacy to sda1 using jaunty:
sudo grub
root (hd0,4)
setup (hd0,0)

Ran commands:
sudo grub-setup '(hd1)'
grub-install /dev/sdb
from karmic with no change to vbr of sda6

boot livecd start ubiquity:
Again installing to sdb1 but now leaving bootloader to install to default (hd0)
Again the vbr of sda1 is wiped.

Revision history for this message
Martin Erik Werner (arand) wrote :
Revision history for this message
Martin Erik Werner (arand) wrote :

Attaching hex represented output of 512 first bytes of sda1 (in test procedure above) both for reinstalled (&original) state and post-karmic install state of sda1 VBR

description: updated
Revision history for this message
Martin Erik Werner (arand) wrote : installer logs

On my main machine (NOT the vbox test described above) I have this kind
of setup:
 Device Boot Start End Blocks Id System
/dev/sda1 1 2550 20482843+ c7 Syrinx
/dev/sda2 2551 6375 30720000 7 HPFS/NTFS
/dev/sda3 6376 36746 243955057+ 7 HPFS/NTFS
/dev/sda4 * 36747 38913 17406427+ 5 Extended
> /dev/sda5 36747 38378 13109008+ 83 Linux
> /dev/sda6 38379 38913 4297356 82 Linux swap / Solaris

sda1 & sda2 are windows, sda3 is storage.

sda4 is the "extended" partition "containing" sda5 (ubu 9.04) and sda6
(swap)
For various reasons I have the first 512b part of grub installed to sda4
("root (0,4); setup (hd0,3)"), which is being chainloaded.
When installing ubuntu to a usb stick (not liveusb) these 512b of
bootloader were wiped and ubuntu is unable to boot.

Attached logs from the installer

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

The fact that it's rewriting the partition table on /dev/sda at all in this case is a bug that might be fixed either in partman-base (by making SET_FLAGS not mark the partition table as changed when the new flags are the same as the old ones) or partman-basicmethods (by not sending the SET_FLAGS command at all in the case where it won't do anything). I lean towards the latter, which is nice and simple and furthermore more efficient anyway. I think it's worth getting this fixed in 9.10, as having partition tables spuriously rewritten does tend to alarm people even if no data loss is involved.

The fact that partition boot records appear to be getting lost in the process can, I think, only be a parted bug. partman certainly isn't intentionally telling it to do this.

affects: ubiquity (Ubuntu) → partman-basicmethods (Ubuntu)
Changed in partman-basicmethods (Ubuntu Karmic):
importance: Undecided → Medium
milestone: none → ubuntu-9.10
assignee: nobody → Colin Watson (cjwatson)
status: New → Fix Committed
Revision history for this message
Colin Watson (cjwatson) wrote :

We won't be doing anything for 9.10 about whatever the parted bug is; not enough time, and too risky.

Changed in parted (Ubuntu Karmic):
status: New → Won't Fix
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package partman-basicmethods - 43ubuntu1

---------------
partman-basicmethods (43ubuntu1) karmic; urgency=low

  * Don't send the SET_FLAGS command when the new flags are the same as the
    old ones; this avoids partition tables being rewritten when all we did
    was set the method to "don't use" (LP: #445067).

 -- Colin Watson <email address hidden> Sat, 24 Oct 2009 01:22:56 +0100

Changed in partman-basicmethods (Ubuntu Karmic):
status: Fix Committed → Fix Released
Revision history for this message
Martin Erik Werner (arand) wrote :

Thankyou for the quick response! This'll definitely save me hassle, and possibly others from panic.

Question though, how would I go about testing this? Seems like this is a baked-in part of the installer, and there are no dailies generated now.

Revision history for this message
Martin Erik Werner (arand) wrote :

Logs with manually patched partman using:
wget -O- http://bazaar.launchpad.net/%7Eubuntu-core-dev/partman-basicmethods/ubuntu/diff/762 | filterdiff -x debian/changelog | sudo patch /lib/partman/choose_method/70dont_use/do_option

Revision history for this message
Martin Erik Werner (arand) wrote :

Wrong file above, here's the right one

Revision history for this message
Martin Erik Werner (arand) wrote :
Revision history for this message
Martin Erik Werner (arand) wrote :

The logs above are taken from yet another system (...); a virtualbox with this kind of layout (sdb1 is to where karmic is installed, sda5 is a jaunty install, inside sda2 where the interesting 512b are):
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x000d8e9e

   Device Boot Start End Blocks Id System
/dev/sdb1 * 1 1044 8385898+ 83 Linux

Disk /dev/sda: 11.8 GB, 11803820032 bytes
255 heads, 63 sectors/track, 1435 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0003682f

   Device Boot Start End Blocks Id System
/dev/sda1 * 1 637 5116671 7 HPFS/NTFS
/dev/sda2 638 1435 6409935 5 Extended
/dev/sda5 638 1394 6080571 83 Linux
/dev/sda6 1395 1435 329301 82 Linux swap / Solaris

Revision history for this message
Martin Erik Werner (arand) wrote :

Oh, and the 512b was still overwritten when testing the patch. So symptom remains unfixed after patching.

Revision history for this message
Martin Erik Werner (arand) wrote :

Tested with Jaunty installer as well, same issue -- not a regression.

tags: added: boot extended grub mbr partition ubiquity vbr
Revision history for this message
Martin Erik Werner (arand) wrote :

This bug is still present on the final Karmic liveCD, may I reopen?

Changed in partman-basicmethods (Ubuntu Karmic):
status: Fix Released → Confirmed
Revision history for this message
Martin Erik Werner (arand) wrote :

And still happening in the current Lucid daily, reopening.

description: updated
Changed in partman-basicmethods (Ubuntu):
status: Fix Released → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

The remaining part is that we're recreating the swap partition, and that marks the extended partition as dirty. I don't think this is likely to be either straightforward or desirable to change.

The core parted bug was fixed upstream a little while ago:

commit d693a28adbbb298e69b3d4388a9150416a88651a
Author: Petr Uzel <email address hidden>
Date: Thu Aug 20 15:27:09 2009 +0200

    do not discard bootcode from extended partition

    * libparted/labels/dos.c (write_ext_table): Do not discard
      bootcode from extended partition on msdos label when some of
      the logical partitions are changed

    Signed-off-by: Petr Uzel <email address hidden>

Thus we should backport or sync to this, rather than playing whack-a-mole with partman semantics.

Changed in partman-basicmethods (Ubuntu Karmic):
status: Confirmed → Fix Released
Changed in partman-basicmethods (Ubuntu):
status: Confirmed → Fix Released
Colin Watson (cjwatson)
Changed in parted (Ubuntu):
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package parted - 2.1-2ubuntu1

---------------
parted (2.1-2ubuntu1) lucid; urgency=low

  * Resynchronise with Debian experimental (LP: #511075). Remaining
    changes:
    - gptsync.dpatch: On Intel Mac systems, write a synced MBR rather than a
      protective MBR.
    - Add -fno-stack-protector on sparc.
    - sparc-new-label.dpatch: Fix sparc disk label generation. This is
      required for LDOM and parallel installations with Solaris 10.
    - loop-partitions.dpatch: Loop devices can only have one partition, so
      don't generate device names such as "/dev/loop0p1".
    - udevadm-settle.dpatch: Run 'udevadm settle' either side of rereading
      the partition table, to avoid a variety of races.
    - dmraid.dpatch: Ensure that device-mapper devices for dmraid arrays do
      not have extra nodes created needlessly, as well as making sure that
      partition nodes for dmraid devices are not probed.
  * Upstream fixes:
    - Supports non-512-byte logical sectors (LP: #505549).
    - Do not discard bootcode from extended partition on msdos label when
      some of the logical partitions are changed (LP: #445067).
    - Don't use msftres flag for FAT/NTFS partitions on GPT (LP: #397386).

parted (2.1-2) experimental; urgency=low

  * Build-depend on libblkid-dev, since otherwise we don't get
    minimum/optimum alignment handling on Linux.

parted (2.1-1) experimental; urgency=low

  * New upstream release

  [ Otavio Salvador ]
  * control.in: bump preferred soname for libreadline (closes: #553824).

  [ Colin Watson ]
  * control.in: Remove copy-and-paste error from libparted1.8-i18n
    description (closes: #497626).
  * copyright: Document parted.info's licence, namely GFDL 1.1 with no
    invariant sections, front-cover texts, or back-cover texts (closes:
    #500201).
  * rules: Cell partition tables are misdetected as pc98, so disable pc98
    support on powerpc (closes: #487833).
  * control.in: Don't build-depend on libdevmapper-dev on hurd-i386.
  * control.in: Build-depend on libdevmapper-dev (>= 1.02.33), for
    dm_task_set_major_minor.

  [ Xavier Oswald ]
  * debian/control.in:
    - Change my mail address
    - Bump Standards-Version to 3.8.3
    - Update Build-Depends on debhelper 7
  * debian/compat: update version to 7
  * Parted not informing the kernel of changes to the partition table
    (Closes: #557044), fixed upstream

  [ Otavio Salvador ]
  * debian/watch: fix URL to download
  * Switch to quilt to manage patches
    - unpartitioned-disks.dpatch, drop (merged upstream)
    - unblacklist-md.dpatch, drop (merged upstream)
    - amiga-raid-lvm-fix.dpatch, drop (not used for ages)
    - devfs.dpatch, drop (devfs is not used)
    - reiserfs-libname.dpatch, drop (referenced library is unavailable)

  [ Xavier Oswald, Colin Watson ]
  * Refresh update-ext4-code.patch

  [ Otavio Salvador ]
  * Fix parted-doc info files installation
  * Add lintian overrides for parted package
  * Use soname in libparted udeb name
 -- Colin Watson <email address hidden> Fri, 26 Feb 2010 14:27:21 +0000

Changed in parted (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Martin Erik Werner (arand) wrote :

I just made a Lucid install on a USB stick, and can confirm that the bootrecord of the extended partition on my main drive is unmodified. Thanks for getting this fix in!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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