Bug 1592061 - virt-v2v convert rhel5.3 failure when executing rpm -ql kernel-2.6.18-128.el5 command
Summary: virt-v2v convert rhel5.3 failure when executing rpm -ql kernel-2.6.18-128.el5...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-16 15:50 UTC by Haigang
Modified: 2018-06-21 14:15 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-06-21 14:15:23 UTC
Embargoed:


Attachments (Terms of Use)
rhel5.3.xml (735 bytes, application/xml)
2018-06-16 15:50 UTC, Haigang
no flags Details
virt-v2v.log (864.92 KB, text/plain)
2018-06-17 01:22 UTC, Haigang
no flags Details

Description Haigang 2018-06-16 15:50:01 UTC
Created attachment 1452207 [details]
rhel5.3.xml

Description of problem:

I use the virt-v2v tool to convert a vhdx hard disk with a rhel5.3 system to a qcow2 disk

run command:

```shell
virt-v2v  -v -x -i libvirtxml /tmp/rhel5.3.xml  -o local -os "/tmp/rhel5.3" -of qcow2
```

error message:

commandrvf: umount /sysroot/dev
renaming /sysroot/etc/mohobmk2 to /sysroot/etc/resolv.conf
guestfsd: error:
guestfsdlibguestfs: trace: v2v: command_lines = NULL (error)
virt-v2v: error: libguestfs error: command_lines:
libguestfs: trace: v2v: close
libguestfs: closing guestfs handle 0x560ae94a35d0 (state 2)
libguestfs: trace: v2v: internal_autosync
: => command_lines (0x33) took 0.18 secs
guestfsd: <= internal_autosync (0x11a) request length 40 bytes
umount-all: /proc/mounts: fsname=/dev/root dir=/ type=ext2 opts=rw,noatime,block_validity,barrier,user_xattr,acl freq=0 passno=0
umount-all: /proc/mounts: fsname=/proc dir=/proc type=proc opts=rw,relatime freq=0 passno=0
umount-all: /proc/mounts: fsname=/sys dir=/sys type=sysfs opts=rw,relatime freq=0 passno=0
umount-all: /proc/mounts: fsname=tmpfs dir=/run type=tmpfs opts=rw,nosuid,relatime,size=399236k,mode=755 freq=0 passno=0
umount-all: /proc/mounts: fsname=/dev dir=/dev type=devtmpfs opts=rw,relatime,size=993792k,nr_inodes=248448,mode=755 freq=0 passno=0
umount-all: /proc/mounts: fsname=/dev/pts dir=/dev/pts type=devpts opts=rw,relatime,mode=600,ptmxmode=000 freq=0 passno=0
umount-all: /proc/mounts: fsname=shmfs dir=/dev/shm type=tmpfs opts=rw,relatime freq=0 passno=0
umount-all: /proc/mounts: fsname=/dev/mapper/VolGroup00-LogVol00 dir=/sysroot type=ext3 opts=rw,relatime,data=ordered freq=0 passno=0
umount-all: /proc/mounts: fsname=/dev/sda1 dir=/sysroot/boot type=ext3 opts=rw,relatime,data=ordered freq=0 passno=0
commandrvf: stdout=n stderr=y flags=0x0
commandrvf: umount /sysroot/boot
commandrvf: stdout=n stderr=y flags=0x0
commandrvf: umount /sysroot
commandrvf: stdout=n stderr=y flags=0x0
commandrvf: udevadm --debug settle -E /dev/sdb
calling: settle
commandrvf: stdout=n stderr=y flags=0x0
commandrvf: udevadm --debug settle -E /dev/sda
calling: settle
fsync /dev/sda
libguestfs: trace: v2v: internal_autosync = 0
libguestfs: sending SIGTERM to process 2202
libguestfs: qemu maxrss 347676K
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfszqQJzo
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /run/user/1000/libguestfsmZNdDA


Can be seen because of the error caused by executing rpm -ql kernel-2.6.18-128.el5 command


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

virt-v2v --verions:1.38.1

python-guestfs: 1.38.1

How reproducible:

I locate the problem by using python-guestfs

run:

>>> import guestfs
>>> disk="/v2v/bd39737c-a726-4fcc-8ae1-940453b5504a.vhdx"
>>> g = guestfs.GuestFS(python_return_dict=True)
>>> g.add_drive_opts(disk, readonly=1)
>>> g.launch()

>>> roots = g.inspect_os()
>>> roots                                                                                                                           
['/dev/VolGroup00/LogVol00']

>>> root=roots[0]
>>> mps = g.inspect_get_mountpoints(root)
>>> def compare(a, b):                                                                                                              
...  return len(a) - len(b)

>>> for device in sorted(mps.keys(), compare):                                                                                     
...  try:                                                                                                      
...      g.mount_ro(mps[device], device)                                                                                            
...  except RuntimeError as msg:                                                                                                   
...      print "%s (ignored)" % msg


>>> g.command(['rpm','--version'])                                                                                                 
'RPM version 4.4.2.3\n'


>>> g.command(['rpm','-qa','kernel-2.6.18-128.el5'])                                                                                
Traceback (most recent call last):                                                                                                  
  File "<stdin>", line 1, in <module>                                                                                               
  File "/usr/lib/python2.7/dist-packages/guestfs.py", line 2000, in command
    r = libguestfsmod.command(self._o, arguments)
RuntimeError: command:


This returns RuntimeError. But I use centos7.4 and the execution command is all normal


>>> import guestfs
>>> disk="/v2v/e78de914-9676-4fac-900b-73cbfa701de2.vhdx"
>>> g = guestfs.GuestFS(python_return_dict=True)
>>> g.add_drive_opts(disk, readonly=1)
>>> g.launch()

>>> roots = g.inspect_os()
>>> roots
['/dev/centos/root']

>>> root=roots[0]
>>> mps = g.inspect_get_mountpoints(root)
>>> def compare(a, b):                                                                                                              
...  return len(a) - len(b)

>>> for device in sorted(mps.keys(), compare):                                                                                     
...  try:                                                                                                      
...      g.mount_ro(mps[device], device)                                                                                            
...  except RuntimeError as msg:                                                                                                   
...      print "%s (ignored)" % msg


>>> g.command(['rpm','--version'])
'RPM version 4.11.3\n'

>>> g.command(['rpm','-ql','kernerl-3.10.0-693.el7'])
'/boot/.vmlinuz-3.10.0-693.el7.x86_64.hmac\n/boot/System.map-3.10.0-693.el7.x86_64\n/boot/config-3.10.0-693.el7.x86_64\n/boot/initr..................

Comment 1 Haigang 2018-06-16 15:56:03 UTC
sorry,I mistyped here ,g.command(['rpm','-qa','kernel-2.6.18-128.el5']) should be 
  g.command(['rpm','-ql','kernel-2.6.18-128.el5']) ,

Comment 2 Richard W.M. Jones 2018-06-16 16:22:46 UTC
Please can you attach the complete output from the virt-v2v -v -x
command which fails.

Comment 3 Haigang 2018-06-17 01:19:23 UTC
(In reply to Richard W.M. Jones from comment #2)
> Please can you attach the complete output from the virt-v2v -v -x
> command which fails.

Comment 4 Haigang 2018-06-17 01:22:13 UTC
Created attachment 1452300 [details]
virt-v2v.log

Comment 5 Haigang 2018-06-17 01:24:56 UTC
(In reply to Richard W.M. Jones from comment #2)
> Please can you attach the complete output from the virt-v2v -v -x
> command which fails.

I put the complete output in the attachment

Comment 6 Richard W.M. Jones 2018-06-17 11:18:38 UTC
The error is:

[   11.951943] rpmq[335] vsyscall attempted with vsyscall=none ip:ffffffffff600000 cs:33 sp:7ffcfffadcc8 ax:ffffffffff600000 si:0 di:7ffcfffadce0
[   11.962530] rpmq[335]: segfault at ffffffffff600000 ip ffffffffff600000 sp 00007ffcfffadcc8 error 15

The RPM binary from RHEL 5 is very old and doesn't run with
the Debian kernel you are using.

However it may be possible to make it work by setting:

  export LIBGUESTFS_APPEND="vsyscall=emulate"

before running the virt-v2v command.  I'm interested to know
if that works.

See also:

https://einsteinathome.org/content/vsyscall-now-disabled-latest-linux-distros

Comment 7 Haigang 2018-06-17 11:43:03 UTC
I'm so sorry, I made a wrong analysis.

Is indeed this issue.


I setting:

  export LIBGUESTFS_APPEND="vsyscall=emulate"


Virt-v2v tool completes disk convert successfully!


Thank you very much!

Comment 8 Richard W.M. Jones 2018-06-17 13:10:20 UTC
Documentation patch posted:

https://www.redhat.com/archives/libguestfs/2018-June/msg00073.html

Comment 9 Richard W.M. Jones 2018-06-21 14:15:23 UTC
Although it's only a documentation fix, that is now upstream
in libguestfs >= 1.39.6 and >= 1.38.3:

https://github.com/libguestfs/libguestfs/commit/8c3375d47c524b391617ab64f7f533ec66f532ec


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