Bug 790728

Summary: blkid ignores swap UUIDs if the first byte is a zero byte
Product: Red Hat Enterprise Linux 6 Reporter: Mohua Li <moli>
Component: util-linux-ngAssignee: Karel Zak <kzak>
Status: CLOSED ERRATA QA Contact: Branislav Blaškovič <bblaskov>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: azelinka, bblaskov, leiwang, qguan, qwan, rjones, rvokal
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: util-linux-ng-2.17.2-12.8.el6 Doc Type: Bug Fix
Doc Text:
Cause: blkid command ignores swap area UUIDs if the first byte is zero Consequence: the swap areas is not possible to address by UUIDs for example from /etc/fstab. Fix: libblkid has been fixed
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-21 10:22:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 836160, 840699    

Description Mohua Li 2012-02-15 09:35:20 UTC
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 = ""

Comment 1 Qixiang Wan 2012-02-15 09:48:49 UTC
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.

Comment 2 Richard W.M. Jones 2012-02-15 09:57:22 UTC
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.

Comment 4 RHEL Program Management 2012-03-01 17:09:56 UTC
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.

Comment 5 Suzanne Logcher 2012-05-18 20:51:46 UTC
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.

Comment 11 errata-xmlrpc 2013-02-21 10:22:47 UTC
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