UUIDs of existing swap partitions are changed

Bug #336992 reported by Luke Plant
8
Affects Status Importance Assigned to Milestone
busybox (Ubuntu)
Fix Released
High
Colin Watson
Hardy
Invalid
Undecided
Unassigned
Intrepid
Won't Fix
Undecided
Unassigned
Jaunty
Fix Released
High
Colin Watson
partman-basicfilesystems (Ubuntu)
Fix Released
High
Colin Watson
Hardy
Fix Released
High
Colin Watson
Intrepid
Won't Fix
Undecided
Unassigned
Jaunty
Fix Released
High
Colin Watson

Bug Description

I installed Ubuntu Intrepid on a machine, and then made a second installation (the second time using a Hardy Live CD, I was not able to use Intrepid the second time due to bug 333584 https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/333584 ).

The second installation involved repartitioning, and when I returned to my first installation, the UUID of the swap partition had been changed, which meant that swap was no longer available, and hibernate no longer worked.

The original UUID was:

441b1300-b765-4600-813b-fd2c03e917e6

The new UUID is:

441b13b7-6546-813b-fd2c-03e917e617e6

The striking similarities between these number make me think something funny is going on, which is why I bothered to post them. Assuming the hexadecimal digits correspond to a simple array of bytes, it looks like you can generate the second UUID by this algorithm:

1) create a buffer containing the first UUID
2) set pointer1 and pointer2 to position 0
3) if byte at pointer1 == 0, increment pointer1, and go to step 3
4) copy byte at pointer1 to pointer2
5) increment pointer1 and pointer2
6) go to step 3.

The other UUID on my first installation system, i.e. for the root partition, was not changed, but it did not contain a '00' in it either, so by the above process you would not expect it to change. (Also the root partition didn't change its starting cylinder, only the end cylinder, whereas the swap partition probably had to be created from scratch).

As mentioned above, this happened in Hardy, not Intrepid, and it looks like it could well be a libparted bug or something like that.

This was fixed in partman-basicfilesystems 62ubuntu2 in jaunty:

  http://bazaar.launchpad.net/~ubuntu-core-dev/partman-basicfilesystems/ubuntu/revision/574

I've backported this change to hardy-proposed:

  http://bazaar.launchpad.net/~ubuntu-core-dev/partman-basicfilesystems/hardy-proposed/revision/562

TEST CASE: Perform an installation on a blank disk, then set the UUID of the swap partition to one containing at least one zero byte; the UUID provided by the reporter of this bug will do fine. You can do that like this, assuming that the swap partition is /dev/sda5:

  sudo swapoff /dev/sda5
  sudo mkswap -U 441b1300-b765-4600-813b-fd2c03e917e6 /dev/sda5

Having done this, reboot and do another installation overwriting the previous one's root filesystem and just using the existing swap partition; you'll need to use the manual partitioner to do this properly. After rebooting, run 'sudo vol_id -u /dev/sda5' and confirm that the UUID shown is exactly that which you set previously.

REGRESSION POTENTIAL: It might be worth making sure that installations with a fresh swap partition (i.e. no UUID to preserve) keep on working.

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

Great catch, thanks. It looks as if the old UUID doesn't survive being saved in a shell variable in partman-basicfilesystems; we'll have to put it in a file instead (which in retrospect is more sensible anyway).

Changed in ubiquity:
assignee: nobody → cjwatson
importance: Undecided → High
status: New → Triaged
Revision history for this message
Colin Watson (cjwatson) wrote :

This only affects swap partitions, BTW, as those are the only ones for which we do this special UUID saving/restoring thing (which in turn is because it's apparently much more efficient to just reinitialise a swap partition than to check whether it's valid).

Revision history for this message
Colin Watson (cjwatson) wrote : Re: UUID of existing swap partitions are changed

I don't think we can sensibly fix this in Intrepid, since it would require new installer images and there are no plans for a point release; but I do think we should fix it in 8.04.3.

Changed in partman-basicfilesystems:
assignee: nobody → cjwatson
importance: Undecided → High
milestone: none → ubuntu-8.04.3
status: New → Triaged
status: New → Won't Fix
Revision history for this message
Colin Watson (cjwatson) wrote :

While testing my fix for this, I noticed that this whole system breaks in the alternate/server installer as of Intrepid because we use conv=notrunc and that's disabled in busybox dd. We could remove conv=notrunc, but that would cause problems for Wubi installations.

This problem does not exist in Hardy, where conv=notrunc was always supported in busybox dd regardless of configuration; at some point in between it was made a configuration option and we neglected to notice and turn it on.

Changed in busybox:
status: New → Won't Fix
assignee: nobody → cjwatson
importance: Undecided → High
status: New → Triaged
status: New → Invalid
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package busybox - 1:1.10.2-2ubuntu6

---------------
busybox (1:1.10.2-2ubuntu6) jaunty; urgency=low

  * [udeb] Enable FEATURE_DD_IBS_OBS, so that we can use conv=notrunc while
    restoring swap UUIDs (LP: #336992).

 -- Colin Watson <email address hidden> Tue, 03 Mar 2009 12:52:47 +0000

Changed in busybox:
status: Triaged → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package partman-basicfilesystems - 62ubuntu2

---------------
partman-basicfilesystems (62ubuntu2) jaunty; urgency=low

  * When formatting swap partitions, save the old UUID in a file rather than
    in a shell variable, as the latter approach eats NULs (LP: #336992).

 -- Colin Watson <email address hidden> Tue, 03 Mar 2009 12:54:26 +0000

Changed in partman-basicfilesystems:
status: Triaged → Fix Released
Colin Watson (cjwatson)
Changed in partman-basicfilesystems (Ubuntu Hardy):
status: Triaged → In Progress
Colin Watson (cjwatson)
description: updated
Colin Watson (cjwatson)
summary: - UUID of existing swap partitions are changed
+ UUIDs of existing swap partitions are changed
Revision history for this message
Steve Langasek (vorlon) wrote :

Accepted partman-basicfilesystems into hardy-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in partman-basicfilesystems (Ubuntu Hardy):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Steve Beattie (sbeattie) wrote :

I've reproduced the behavior of partman-basicfilesystems not preserving UUIDs of swap partitions on the livecd for hardy 8.04.2, and can confirm that the version of partman-basicfilesystems in -proposed and used on the hardy daily livecd (build 20090622.1) maintains the UUID of the swap partition correctly. I've also verified that installations where the swap UUID doesn't need to be preserved continue to work. Marking verification-done.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package partman-basicfilesystems - 56ubuntu5

---------------
partman-basicfilesystems (56ubuntu5) hardy-proposed; urgency=low

  * When formatting swap partitions, save the old UUID in a file rather than
    in a shell variable, as the latter approach eats NULs (LP: #336992).

 -- Colin Watson <email address hidden> Thu, 04 Jun 2009 22:06:14 +0100

Changed in partman-basicfilesystems (Ubuntu Hardy):
status: Fix Committed → Fix Released
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.