Bug 13313 - wic write --expand auto changes swap UUID
Summary: wic write --expand auto changes swap UUID
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: Scripts and Tools (show other bugs)
Version: 3.0
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 3.2 M1
Assignee: Chee Yang
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2019-04-30 10:33 UTC by Ross Burton
Modified: 2020-05-13 17:38 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Burton 2019-04-30 10:33:38 UTC
The generated mount point for the swap in a wic image's fstab uses the swap UUID, whereas the partition regeneration code when the new expanded partition is created uses the partition UUID.

If an image is written without using --expand the image boots.  If --expand is used the UUID of the swap isn't preserved and the image won't boot.
Comment 1 Ross Burton 2019-04-30 10:42:18 UTC
Loopback mount the original wic: the fstab contains this:


UUID=9951-E297	/boot	vfat	defaults	0	0
UUID=53fbb599-1298-4ffb-b5fa-c697f6d7d993	swap	swap	defaults	0	0

lsblk says:

NAME      FSTYPE LABEL    UUID                                 MOUNTPOINT
loop1
├─loop1p1 vfat   efi      9951-E297
├─loop1p2 ext4   platform 0c057449-028a-4227-8549-6c6fca952f26 /mnt
└─loop1p3 swap   swap1    53fbb599-1298-4ffb-b5fa-c697f6d7d993

Those are filesystem UUIDs not partition UUIDs:

$ blkid  /dev/loop1p3
/dev/loop1p3: LABEL="swap1" UUID="53fbb599-1298-4ffb-b5fa-c697f6d7d993" TYPE="swap" PARTLABEL="swap1" PARTUUID="ff602e88-56f8-4091-afdb-35af24f8644f"

But when wic write builds the new partition table it is using the UUIDs from sfdisk, which are the partition UUIDs.

$ wic write -e auto
DEBUG: _exec_cmd: /data/poky-tmp/master/work/corei7-64-poky-linux/wic-tools/1.0-r0/recipe-sysroot-native/sbin/mkswap -L swap1 -U FF602E88-56F8-4091-AFDB-35AF24F8644F /tmp/wic-part3-626vx29l