Bug 997160

Summary: virt-sysprep prints: filesize: /etc/mdadm.conf: No such file or directory
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, mbooth, ptoscano
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-10 12:54:53 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Richard W.M. Jones 2013-08-14 15:34:53 EDT
Description of problem:

(Reported by Chocobo on IRC)

virt-sysprep fails inspecting the guest and prints:

Guestfs.Error("filesize: /etc/mdadm.conf: No such file or directory")

A full trace (-x) is attached below.

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

libguestfs 1.22.5

How reproducible:

100%

Steps to Reproduce:
1. Create a CentOS 6.4 guest with cloud-init.
2. Run virt-sysprep -a disk.img

Additional info:

Examining the guest ...
libguestfs: trace: add_drive "centos64.img" "readonly:true"
libguestfs: trace: add_drive = 0
libguestfs: trace: launch
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: launch = 0
libguestfs: trace: inspect_os
libguestfs: trace: umount_all
libguestfs: trace: umount_all = 0
libguestfs: trace: list_filesystems
libguestfs: trace: list_devices
libguestfs: trace: list_devices = ["/dev/sda"]
libguestfs: trace: list_partitions
libguestfs: trace: list_partitions = ["/dev/sda1"]
libguestfs: trace: list_md_devices
libguestfs: trace: list_md_devices = []
libguestfs: trace: part_to_dev "/dev/sda1"
libguestfs: trace: part_to_dev = "/dev/sda"
libguestfs: trace: part_to_partnum "/dev/sda1"
libguestfs: trace: part_to_partnum = 1
libguestfs: trace: part_to_dev "/dev/sda1"
libguestfs: trace: part_to_dev = "/dev/sda"
libguestfs: trace: part_get_mbr_id "/dev/sda" 1
libguestfs: trace: part_get_mbr_id = 131
libguestfs: trace: vfs_type "/dev/sda1"
libguestfs: trace: vfs_type = "ext4"
libguestfs: trace: feature_available "lvm2"
libguestfs: trace: feature_available = 1
libguestfs: trace: lvs
libguestfs: trace: lvs = []
libguestfs: trace: feature_available "ldm"
libguestfs: trace: feature_available = 1
libguestfs: trace: list_ldm_volumes
libguestfs: trace: list_ldm_volumes = []
libguestfs: trace: list_ldm_partitions
libguestfs: trace: list_ldm_partitions = []
libguestfs: trace: list_filesystems = ["/dev/sda1", "ext4"]
libguestfs: trace: vfs_type "/dev/sda1"
libguestfs: trace: vfs_type = "ext4"
libguestfs: trace: internal_parse_mountable "/dev/sda1"
libguestfs: trace: internal_parse_mountable = <struct guestfs_internal_mountable *>
libguestfs: trace: is_whole_device "/dev/sda1"
libguestfs: trace: is_whole_device = 0
libguestfs: trace: mount_ro "/dev/sda1" "/"
libguestfs: trace: mount_ro = 0
libguestfs: trace: part_to_partnum "/dev/sda1"
libguestfs: trace: part_to_partnum = 1
libguestfs: trace: is_dir "/etc"
libguestfs: trace: is_dir = 1
libguestfs: trace: is_dir "/bin"
libguestfs: trace: is_dir = 1
libguestfs: trace: is_dir "/share"
libguestfs: trace: is_dir = 0
libguestfs: trace: is_file "/grub/menu.lst"
libguestfs: trace: is_file = 0
libguestfs: trace: is_file "/grub/grub.conf"
libguestfs: trace: is_file = 0
libguestfs: trace: is_file "/grub2/grub.cfg"
libguestfs: trace: is_file = 0
libguestfs: trace: is_file "/etc/freebsd-update.conf"
libguestfs: trace: is_file = 0
libguestfs: trace: is_file "/etc/fstab"
libguestfs: trace: is_file = 1
libguestfs: trace: is_file "/etc/release"
libguestfs: trace: is_file = 0
libguestfs: trace: is_file "/hurd/console"
libguestfs: trace: is_file = 0
libguestfs: trace: is_file "/etc/fstab"
libguestfs: trace: is_file = 1
libguestfs: trace: is_file "/etc/lsb-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: trace: is_file "/etc/redhat-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: trace: is_file "/etc/debian_version" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: trace: is_file "/etc/pardus-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: trace: is_file "/etc/arch-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: trace: is_file "/etc/gentoo-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: trace: is_file "/etc/meego-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: trace: is_file "/etc/slackware-version" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: trace: is_file "/etc/ttylinux-target" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: trace: is_file "/etc/SuSE-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: trace: is_file "/etc/br-version" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: trace: is_file "/bin/bash"
libguestfs: trace: is_file = 1
libguestfs: trace: file_architecture "/bin/bash"
libguestfs: trace: file "/bin/bash"
libguestfs: trace: file = "ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, BuildID[sha1]=513e5f6407fa109cd46b8fa803f51dc8d2507c2b, stripped"
libguestfs: trace: file_architecture = "x86_64"
libguestfs: trace: is_file "/etc/fstab" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: trace: filesize "/etc/fstab"
libguestfs: trace: filesize = 617
libguestfs: trace: is_file "/etc/mdadm.conf" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: trace: filesize "/etc/mdadm.conf"
libguestfs: trace: filesize = -1 (error)
libguestfs: trace: umount_all
libguestfs: trace: umount_all = 0
libguestfs: trace: inspect_os = NULL (error)
sysprep operation failed: exception: Guestfs.Error("filesize: /etc/mdadm.conf: No such file or directory")
libguestfs: trace: close
libguestfs: trace: internal_autosync
libguestfs: trace: internal_autosync = 0
Comment 1 Richard W.M. Jones 2013-08-14 15:36:22 EDT
guestfish -i trace:

libguestfs: trace: set_pgroup true
libguestfs: trace: set_pgroup = 0
libguestfs: trace: add_drive "centos64.img" "readonly:true"
libguestfs: trace: add_drive = 0
libguestfs: trace: is_config
libguestfs: trace: is_config = 1
libguestfs: trace: launch
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: launch = 0
libguestfs: trace: list_partitions
libguestfs: trace: list_partitions = ["/dev/sda1"]
libguestfs: trace: vfs_type "/dev/sda1"
libguestfs: trace: vfs_type = "ext4"
libguestfs: trace: inspect_os
libguestfs: trace: umount_all
libguestfs: trace: umount_all = 0
libguestfs: trace: list_filesystems
libguestfs: trace: list_devices
libguestfs: trace: list_devices = ["/dev/sda"]
libguestfs: trace: list_partitions
libguestfs: trace: list_partitions = ["/dev/sda1"]
libguestfs: trace: list_md_devices
libguestfs: trace: list_md_devices = []
libguestfs: trace: part_to_dev "/dev/sda1"
libguestfs: trace: part_to_dev = "/dev/sda"
libguestfs: trace: part_to_partnum "/dev/sda1"
libguestfs: trace: part_to_partnum = 1
libguestfs: trace: part_to_dev "/dev/sda1"
libguestfs: trace: part_to_dev = "/dev/sda"
libguestfs: trace: part_get_mbr_id "/dev/sda" 1
libguestfs: trace: part_get_mbr_id = 131
libguestfs: trace: vfs_type "/dev/sda1"
libguestfs: trace: vfs_type = "ext4"
libguestfs: trace: feature_available "lvm2"
libguestfs: trace: feature_available = 1
libguestfs: trace: lvs
libguestfs: trace: lvs = []
libguestfs: trace: feature_available "ldm"
libguestfs: trace: feature_available = 1
libguestfs: trace: list_ldm_volumes
libguestfs: trace: list_ldm_volumes = []
libguestfs: trace: list_ldm_partitions
libguestfs: trace: list_ldm_partitions = []
libguestfs: trace: list_filesystems = ["/dev/sda1", "ext4"]
libguestfs: trace: vfs_type "/dev/sda1"
libguestfs: trace: vfs_type = "ext4"
libguestfs: trace: internal_parse_mountable "/dev/sda1"
libguestfs: trace: internal_parse_mountable = <struct guestfs_internal_mountable *>
libguestfs: trace: is_whole_device "/dev/sda1"
libguestfs: trace: is_whole_device = 0
libguestfs: trace: mount_ro "/dev/sda1" "/"
libguestfs: trace: mount_ro = 0
libguestfs: trace: part_to_partnum "/dev/sda1"
libguestfs: trace: part_to_partnum = 1
libguestfs: trace: is_dir "/etc"
libguestfs: trace: is_dir = 1
libguestfs: trace: is_dir "/bin"
libguestfs: trace: is_dir = 1
libguestfs: trace: is_dir "/share"
libguestfs: trace: is_dir = 0
libguestfs: trace: is_file "/grub/menu.lst"
libguestfs: trace: is_file = 0
libguestfs: trace: is_file "/grub/grub.conf"
libguestfs: trace: is_file = 0
libguestfs: trace: is_file "/grub2/grub.cfg"
libguestfs: trace: is_file = 0
libguestfs: trace: is_file "/etc/freebsd-update.conf"
libguestfs: trace: is_file = 0
libguestfs: trace: is_file "/etc/fstab"
libguestfs: trace: is_file = 1
libguestfs: trace: is_file "/etc/release"
libguestfs: trace: is_file = 0
libguestfs: trace: is_file "/hurd/console"
libguestfs: trace: is_file = 0
libguestfs: trace: is_file "/etc/fstab"
libguestfs: trace: is_file = 1
libguestfs: trace: is_file "/etc/lsb-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments
libguestfs: trace: is_file "/etc/redhat-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments
libguestfs: trace: is_file "/etc/debian_version" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments
libguestfs: trace: is_file "/etc/pardus-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments
libguestfs: trace: is_file "/etc/arch-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments
libguestfs: trace: is_file "/etc/gentoo-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments
libguestfs: trace: is_file "/etc/meego-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments
libguestfs: trace: is_file "/etc/slackware-version" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments
libguestfs: trace: is_file "/etc/ttylinux-target" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments
libguestfs: trace: is_file "/etc/SuSE-release" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments
libguestfs: trace: is_file "/etc/br-version" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments
libguestfs: trace: is_file "/bin/bash"
libguestfs: trace: is_file = 1
libguestfs: trace: file_architecture "/bin/bash"
libguestfs: trace: file "/bin/bash"
libguestfs: trace: file = "ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, BuildID[sha1]=513e5f6407fa109cd46b8fa803f51dc8d2507c2b, stripped"
libguestfs: trace: file_architecture = "x86_64"
libguestfs: trace: is_file "/etc/fstab" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments
libguestfs: trace: filesize "/etc/fstab"
libguestfs: trace: filesize = 617
libguestfs: trace: is_file "/etc/mdadm.conf" "followsymlinks:true"
libguestfs: trace: is_file = -1 (error)
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments
libguestfs: trace: filesize "/etc/mdadm.conf"
libguestfs: trace: filesize = -1 (error)
libguestfs: error: filesize: /etc/mdadm.conf: No such file or directory
libguestfs: trace: umount_all
libguestfs: trace: umount_all = 0
libguestfs: trace: inspect_os = NULL (error)
libguestfs: trace: close
libguestfs: trace: internal_autosync
libguestfs: trace: internal_autosync = 0
Comment 2 Richard W.M. Jones 2013-08-14 15:42:10 EDT
Turns out this is the libguestfs package from Arch Linux (AUR):
https://aur.archlinux.org/packages/libguestfs/

The key error is:
libguestfs: error: is_file: header optargs_bitmask field must be passed as 0 for calls that don't take optional arguments

This is because AUR libguestfs 1.22.5 comes with the appliance
from libguestfs 1.22.0.  The is-file API isn't compatible since
we added optional arguments to it:
https://github.com/libguestfs/libguestfs/commit/5d3961bce0d4780298f6dbd3326245f7a3c67fd1

This is an AUR packaging bug.
Comment 3 Richard W.M. Jones 2013-08-14 16:12:02 EDT
Filed request with AUR downstream:

https://aur.archlinux.org/packages/libguestfs/?comments=all
Comment 4 Pino Toscano 2014-06-10 11:28:22 EDT
Rich, should we close this, given it turns out to be a distribution bug?
Comment 5 Richard W.M. Jones 2014-06-10 12:54:53 EDT
Yup, this is fixed in the AUR now.