Bug 745606 - libguestfs: error: part_list: could not parse row from output of parted print command
libguestfs: error: part_list: could not parse row from output of parted print...
Status: CLOSED RAWHIDE
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Richard W.M. Jones
:
: 842551 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-12 16:00 EDT by Richard W.M. Jones
Modified: 2012-07-24 03:49 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-05-02 13:28:05 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2011-10-12 16:00:01 EDT
Description of problem:

This guest has two block devices, a regular disk and a read-only
install CD.

The part-list API is unable to parse the output of parted
on the CD-ROM:

$ sudo virt-alignment-scan -d WinXP -x
libguestfs: trace: add_domain "WinXP" "readonly:true" "allowuuid:true"
libguestfs: trace: add_domain = 2
libguestfs: trace: launch
libguestfs: trace: launch = 0
libguestfs: trace: list_devices
libguestfs: trace: list_devices = ["/dev/vda", "/dev/vdb"]
libguestfs: trace: part_list "/dev/vda"
libguestfs: trace: part_list = <struct guestfs_partition_list *>
/dev/sda1        32256          512    bad (alignment < 4K)
libguestfs: trace: part_list "/dev/vdb"
libguestfs: trace: part_list = NULL (error)
libguestfs: error: part_list: could not parse row from output of parted print command: /dev/vdb:617756672B:virtblk:512:512:unknown:Virtio Block Device;

This is not particularly surprising, because the output of
parted is (yet again) screwed up:

# guestfish --ro -d WinXP run : debug sh "parted -m -- /dev/vdb unit b print"
Error: /dev/vdb: unrecognised disk label                                  
BYT;
/dev/vdb:617756672B:virtblk:512:512:unknown:Virtio Block Device;

Note the extra "Error" line sent to stdout, even though we
have specified the -m option.

Version-Release number of selected component (if applicable):

libguestfs-1.13.20-1.fc17.x86_64
parted-3.0-3.fc17.x86_64

How reproducible:

100%

Steps to Reproduce:
1. Add en_windows_xp_professional_with_service_pack_3_x86_cd_x14-80428.iso
   to guest as CD-ROM.
2. Try 'part-list' command on the CD-ROM device.
Comment 1 Richard W.M. Jones 2011-10-12 17:31:49 EDT
Proposed patch (to parted) sent upstream:
http://lists.alioth.debian.org/pipermail/parted-devel/2011-October/thread.html#3944
Comment 2 Richard W.M. Jones 2012-05-02 13:28:05 EDT
A simple reproducer for this is:

$ dd if=/dev/urandom of=/tmp/test.img bs=1k count=500
500+0 records in
500+0 records out
512000 bytes (512 kB) copied, 0.0474926 s, 10.8 MB/s

With this random disk image, in guestfish:

><fs> part-list /dev/vda 
libguestfs: error: part_list: could not parse row from output of parted print command: /dev/vda:512000B:virtblk:512:512:unknown:Virtio Block Device:;

and directly in parted:

$ parted -m -s -- /tmp/test.img unit b print 2> /dev/null
Error: /tmp/test.img: unrecognised disk label
BYT;
/tmp/test.img:512000B:file:512:512:unknown::;

(Notice that the error message was sent to stdout)

With the inclusion of my patch (comment 1) in parted 3.1, the
parted command works and libguestfs is fixed without needing any
changes.

Note that the fix is included in parted 3.1 in Fedora >= 18.
Fedora 17 still contains the broken version of parted.

Closing this bug with resolution "RAWHIDE".
Comment 3 Richard W.M. Jones 2012-07-24 03:49:55 EDT
*** Bug 842551 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.