Red Hat Bugzilla – Bug 790728
blkid ignores swap UUIDs if the first byte is a zero byte
Last modified: 2016-04-08 05:10:52 EDT
Description of problem: the swap partition failed to be labeled with some uuid value, like uuid value "0019036e-016a-4b2f-86e5-d379137983e1" which generated by uuidgen, when the uuid is "0019036e-016a-4b2f-86e5-d379137983e1", then get-e2uuid will return a null value for uuid Version-Release number of selected component (if applicable): libguestfs-1.16.5-1.el6 How reproducible: quite random Steps to Reproduce: 1.guestfish -xv -N fs 2.mkswap_U $uuid /dev/vda1 3.blkid /dev/vda1, or get-e2uuid /dev/vda1 4.swapon-uuid $uuid Actual results: swap can't be labeled with some uuid value generated by uuidgen Expected results: swap should be labeled with any valid uuid value Additional info: you could find the detail info of fail here, http://fileshare.englab.nay.redhat.com/pub/logs//45171/default/1808116/debug/libguestfs.lvm-off.nofs.raw.fs_swap.swapon-uuid.DEBUG scenario1, swap could be labeled with uuid "959b33c2-d7ac-46d6-887d-515dffb0b710 " ><fs> mkswap_U "959b33c2-d7ac-46d6-887d-515dffb0b710" "/dev/vda1" libguestfs: trace: mkswap_U "959b33c2-d7ac-46d6-887d-515dffb0b710" "/dev/vda1" libguestfs: send_to_daemon: 100 bytes: 00 00 00 60 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 84 | 00 00 00 00 | ... guestfsd: main_loop: proc 42 (mkfs) took 0.22 seconds guestfsd: main_loop: new request, len 0x60 mkswap --help Usage: mkswap [-c] [-pPAGESZ] [-L label] [-U UUID] /dev/name [blocks] mkswap -f -U 959b33c2-d7ac-46d6-887d-515dffb0b710 /dev/vda1 libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 84 | 00 00 00 01 | 00 12 34 02 | ... libguestfs: trace: mkswap_U = 0 ><fs> blkid /dev/vda1 libguestfs: trace: blkid "/dev/vda1" libguestfs: send_to_daemon: 60 bytes: 00 00 00 38 | 20 00 f5 f5 | 00 00 00 04 | 00 00 01 2f | 00 00 00 00 | ... guestfsd: main_loop: proc 132 (mkswap_U) took 0.01 seconds guestfsd: main_loop: new request, len 0x38 blkid -p /dev/null blkid -i The low-level probing mode requires a device blkid -c /dev/null -p -i -o export /dev/vda1 libguestfs: recv_from_daemon: 244 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 01 2f | 00 00 00 01 | 00 12 34 03 | ... libguestfs: trace: blkid = ["UUID", "959b33c2-d7ac-46d6-887d-515dffb0b710", "VERSION", "2", "TYPE", "swap", "USAGE", "other", "MINIMUM_IO_SIZE", "512", "PHYSICAL_SECTOR_SIZE", "512", "LOGICAL_SECTOR_SIZE", "512"] UUID: 959b33c2-d7ac-46d6-887d-515dffb0b710 VERSION: 2 TYPE: swap USAGE: other MINIMUM_IO_SIZE: 512 PHYSICAL_SECTOR_SIZE: 512 LOGICAL_SECTOR_SIZE: 512 ><fs> get-e2uuid /dev/vda1 libguestfs: trace: get_e2uuid "/dev/vda1" libguestfs: send_to_daemon: 60 bytes: 00 00 00 38 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 53 | 00 00 00 00 | ... guestfsd: main_loop: proc 303 (blkid) took 0.03 seconds guestfsd: main_loop: new request, len 0x38 blkid -c /dev/null -o value -s UUID /dev/vda1 libguestfs: recv_from_daemon: 80 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 53 | 00 00 00 01 | 00 12 34 04 | ... libguestfs: trace: get_e2uuid = "959b33c2-d7ac-46d6-887d-515dffb0b710" 959b33c2-d7ac-46d6-887d-515dffb0b710 scenario2, swap can't be labeled with uuid "0019036e-016a-4b2f-86e5-d379137983e1" ><fs> mkswap_U "0019036e-016a-4b2f-86e5-d379137983e1" "/dev/vda1" libguestfs: trace: mkswap_U "0019036e-016a-4b2f-86e5-d379137983e1" "/dev/vda1" libguestfs: send_to_daemon: 100 bytes: 00 00 00 60 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 84 | 00 00 00 00 | ... guestfsd: main_loop: proc 42 (mkfs) took 0.24 seconds guestfsd: main_loop: new request, len 0x60 mkswap --help Usage: mkswap [-c] [-pPAGESZ] [-L label] [-U UUID] /dev/name [blocks] mkswap -f -U 0019036e-016a-4b2f-86e5-d379137983e1 /dev/vda1 libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 84 | 00 00 00 01 | 00 12 34 02 | ... libguestfs: trace: mkswap_U = 0 ><fs> get-e2uuid /dev/vda1 libguestfs: trace: get_e2uuid "/dev/vda1" libguestfs: send_to_daemon: 60 bytes: 00 00 00 38 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 53 | 00 00 00 00 | ... guestfsd: main_loop: proc 303 (blkid) took 0.04 seconds guestfsd: main_loop: new request, len 0x38 blkid -c /dev/null -o value -s UUID /dev/vda1 libguestfs: recv_from_daemon: 44 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 53 | 00 00 00 01 | 00 12 34 04 | ... libguestfs: trace: get_e2uuid = ""
could be reproduced by: # guestfish -N disk mkswap_U "0019036e-016a-4b2f-86e5-d379137983e2" "/dev/vda" : get-e2uuid "/dev/vda" it's happen when the UUID begin with '00'. also I can reproduce this with mkswap tool on host: # qemu-img create test.img 5G Formatting 'test.img', fmt=raw size=5368709120 # mkswap -f -U 0084e9f3-ef57-4da7-bc27-0e48ee8a0c14 test.img Setting up swapspace version 1, size = 5242876 KiB no label, UUID=0084e9f3-ef57-4da7-bc27-0e48ee8a0c14 # blkid -c /dev/null -o value -s UUID test.img # rpm -qf `which mkswap` util-linux-ng-2.17.2-12.4.el6.x86_64 But not sure whether this is a bug in util-linux-ng.
This is actually a bug in blkid which was fixed upstream: http://comments.gmane.org/gmane.linux.utilities.util-linux-ng/4273 Libguestfs just uses mkswap (etc) from util-linux, so updating or fixing util-linux in RHEL should be sufficient to fix the bug in libguestfs. Because of this, I am reassigning the bug to util-linux-ng.
This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux maintenance release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux Update release for currently deployed products. This request is not yet committed for inclusion in an Update release.
This request was not resolved in time for the current release. Red Hat invites you to ask your support representative to propose this request, if still desired, for consideration in the next release of Red Hat Enterprise Linux.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2013-0517.html