Bug 13313

Summary: wic write --expand auto changes swap UUID
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: Scripts and ToolsAssignee: Chee Yang <chee.yang.lee>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: chee.yang.lee, randy.macleod, ross.burton
Version: 3.0   
Target Milestone: 3.2 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

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