Bug 594021

Summary: libguestfs-supermin-helper fails to find a suitable kernel on a dual-boot host
Product: [Community] Virtualization Tools Reporter: Jinxin Zheng <jzheng>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: mbooth, virt-maint, yuzhang
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-05-21 11:28:26 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:

Description Jinxin Zheng 2010-05-20 11:12:58 UTC
Description of problem:
I have a machine configured with the following partition layout,
$ fdisk -l

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14       38913   312464250   8e  Linux LVM

$ lvm pvs
  PV         VG         Fmt  Attr PSize   PFree
  /dev/sda2  VolGroup00 lvm2 a-   297.97G    0 
$ lvm vgs
  VG         #PV #LV #SN Attr   VSize   VFree
  VolGroup00   1   3   0 wz--n- 297.97G    0 
$ lvm lvs
  LV       VG         Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  LVrhel6  VolGroup00 -wi-a-  57.47G                                      
  LogVol00 VolGroup00 -wi-ao 231.00G                                      
  LogVol01 VolGroup00 -wi-ao   9.50G 

This is a dual boot system I use, with a RHEL 5 installed on LogVol00 and a RHEL 6 installed on LVrhel6. the /dev/sda1 part is mounted on /boot holding all the installed kernels -- both system's vmlinuz-* kernel file reside in /dev/sda1.

With this circumstance I just booted into the RHEL 5, installed libguestfs from the latest koji rpm, issued 'launch' in guestfish, getting this error,
><fs> run
libguestfs-supermin-helper: failed to find a suitable kernel.
I looked for kernels in /boot and modules in /lib/modules.
If this is a Xen guest, and you only have Xen domU kernels
installed, try installing a fullvirt kernel (only for
libguestfs use, you shouldn't boot the Xen guest with it).
libguestfs: error: external command failed: PATH='/usr/lib64/guestfs':$PATH libguestfs-supermin-helper '/usr/lib64/guestfs' x86_64 epel-5 /tmp/libguestfs9fVRLf/kernel /tmp/libguestfs9fVRLf/initrd


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

How reproducible:
Always

Steps to Reproduce:
1. install a multi-boot machine with at least two systems similar to the description above.
2. boot into the system that has a lower version of kernel, and install libguestfs.
3. issue launch in guestfish.
  
Actual results:
libguestfs-supermin-helper: failed to find a suitable kernel.

Expected results:
should succeed without failure.

Additional info:
this is what I have in /boot
$ ls -1 /boot/
config-2.6.18-164.el5
config-2.6.18-164.el5debug
config-2.6.18-164.el5xen
config-2.6.18-194.el5
config-2.6.18-194.el5debug
config-2.6.18-194.el5xen
config-2.6.32-19.el6.x86_64
efi
grub
initramfs-2.6.32-19.el6.x86_64.img
initrd-2.6.18-164.el5debug.img
initrd-2.6.18-164.el5.img
initrd-2.6.18-164.el5xen.img
initrd-2.6.18-194.el5debug.img
initrd-2.6.18-194.el5.img
initrd-2.6.18-194.el5xen.img
initrd-2.6.32-19.el6.x86_64kdump.img
lost+found
memtest86+-1.65
symvers-2.6.18-164.el5debug.gz
symvers-2.6.18-164.el5.gz
symvers-2.6.18-164.el5xen.gz
symvers-2.6.18-194.el5debug.gz
symvers-2.6.18-194.el5.gz
symvers-2.6.18-194.el5xen.gz
symvers-2.6.32-19.el6.x86_64.gz
System.map-2.6.18-164.el5
System.map-2.6.18-164.el5debug
System.map-2.6.18-164.el5xen
System.map-2.6.18-194.el5
System.map-2.6.18-194.el5debug
System.map-2.6.18-194.el5xen
System.map-2.6.32-19.el6.x86_64
vmlinuz-2.6.18-164.el5
vmlinuz-2.6.18-164.el5debug
vmlinuz-2.6.18-164.el5xen
vmlinuz-2.6.18-194.el5
vmlinuz-2.6.18-194.el5debug
vmlinuz-2.6.18-194.el5xen
vmlinuz-2.6.32-19.el6.x86_64
xen.gz-2.6.18-164.el5
xen.gz-2.6.18-194.el5
xen-syms-2.6.18-164.el5
xen-syms-2.6.18-194.el5

and in /lib/modules (on the rhel 5 file system),
$ ls -1 /lib/modules/
2.6.18-159.el5
2.6.18-159.el5xen
2.6.18-160.el5
2.6.18-164.el5
2.6.18-164.el5debug
2.6.18-164.el5xen
2.6.18-194.el5
2.6.18-194.el5debug
2.6.18-194.el5xen
2.6.18-98.el5
2.6.18-98.el5xen
fglrx

It seems that libguestfs-supermin-helper is trying to detect the latest kernel vmlinuz-2.6.32-19.el6.x86_64 in /boot, however the corresponding module files could not be found as they reside in the rhel 6 file system 'LVrhel6'.

I think the helper tool should try all possibilities in this kind of situation, i.e it should detect the 2.6.18-194.el5 as the most suitable kernel on the system, instead of failure.

I tried to rename the vmlinuz-2.6.32-19.el6.x86_64 so that it's not seen by libguestfs-supermin-helper, as a result libguestfs becomes good for me.

Comment 1 Jinxin Zheng 2010-05-20 11:14:19 UTC
output of libguestfs-test-tool

$ libguestfs-test-tool 
===== Test starts here =====
LIBGUESTFS_DEBUG=1
new guestfs handle 0x12240190
library version: 1.2.7
guestfs_get_append: (null)
guestfs_get_autosync: 0
guestfs_get_memsize: 500
guestfs_get_path: /usr/lib64/guestfs
guestfs_get_qemu: /usr/bin/qemu-system-x86_64
guestfs_get_verbose: 1
Launching appliance, timeout set to 120 seconds.
looking for supermin appliance in /usr/lib64/guestfs
[00000ms] begin building supermin appliance
[00000ms] PATH='/usr/lib64/guestfs':$PATH libguestfs-supermin-helper --verbose '/usr/lib64/guestfs' x86_64 epel-5 /tmp/libguestfsZMMz07/kernel /tmp/libguestfsZMMz07/initrd
supermin helper [00000ms] sourcedir = /usr/lib64/guestfs, host_cpu = x86_64, repo = epel-5, kernel = /tmp/libguestfsZMMz07/kernel, initrd = /tmp/libguestfsZMMz07/initrd
libguestfs-supermin-helper: failed to find a suitable kernel.
I looked for kernels in /boot and modules in /lib/modules.
If this is a Xen guest, and you only have Xen domU kernels
installed, try installing a fullvirt kernel (only for
libguestfs use, you shouldn't boot the Xen guest with it).
libguestfs: error: external command failed: PATH='/usr/lib64/guestfs':$PATH libguestfs-supermin-helper --verbose '/usr/lib64/guestfs' x86_64 epel-5 /tmp/libguestfsZMMz07/kernel /tmp/libguestfsZMMz07/initrd
libguestfs-test-tool: failed to launch appliance
closing guestfs handle 0x12240190 (state 0)

Comment 2 Richard W.M. Jones 2010-05-21 11:28:26 UTC
This is actually an febootstrap bug, although we don't have a
bug tracker for febootstrap.

I have pushed the following fix upstream (in febootstrap):

http://git.annexia.org/?p=febootstrap.git;a=commitdiff;h=51f70a0bc0f57e72889208bd7f5ec8a7f229c541

Comment 3 Jinxin Zheng 2010-05-24 02:16:16 UTC
Rich, Would you please give a tip on how to verify the change you have made ?

as (I think) there's currently no available rpm containing this change, I am trying to compile febootstrap from the git source on the RHEL 5, but this fails at the configure step with 
configure.ac:62: required file `lib/Makefile.in' not found

Comment 4 Jinxin Zheng 2010-05-24 03:41:12 UTC
(In reply to comment #3)
> Rich, Would you please give a tip on how to verify the change you have made ?
> 
> as (I think) there's currently no available rpm containing this change, I am
> trying to compile febootstrap from the git source on the RHEL 5, but this fails
> at the configure step with 
> configure.ac:62: required file `lib/Makefile.in' not found    

This is what I got from autogen.sh

[febootstrap]$ ./autogen.sh 
configure.ac:62: required file `lib/Makefile.in' not found
autoreconf: automake failed with exit status: 1
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
./configure: line 1712: gl_EARLY: command not found
checking for a BSD-compatible install... /usr/bin/install -c
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for function prototypes... yes
checking whether gcc and cc understand -c and -o together... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for _LARGE_FILES value needed for large files... no
./configure: line 3626: gl_INIT: command not found
checking for perldoc... perldoc
checking for fakeroot... fakeroot
checking for fakechroot... fakechroot
checking for yum... yum
configure: creating ./config.status
config.status: creating lib/Makefile
config.status: error: cannot find input file: lib/Makefile.in

Comment 5 Jinxin Zheng 2010-05-24 09:34:46 UTC
(In reply to comment #3)
> Rich, Would you please give a tip on how to verify the change you have made ?
> 
> as (I think) there's currently no available rpm containing this change, I am
> trying to compile febootstrap from the git source on the RHEL 5, but this fails
> at the configure step with 
> configure.ac:62: required file `lib/Makefile.in' not found    

Well, stupid me.. had a look at the autogen.sh file and found that missing gnulib is my problem...

git cloned gnulib to appropriate location, and febootstrap compiled ok.

however, got another problem here,

$ febootstrap-supermin-helper  --verbose '/usr/lib64/guestfs' x86_64 epel-5 /tmp/kernel /tmp/initrd
supermin helper [00000ms] whitelist = (not specified), host_cpu = epel-5, kernel = /tmp/kernel, initrd = /tmp/initrd
supermin helper [00000ms] inputs[0] = /usr/lib64/guestfs
supermin helper [00000ms] inputs[1] = x86_64
checking modpath /lib/modules/2.6.18-194.el5debug is a directory
picked vmlinuz-2.6.18-194.el5debug because modpath /lib/modules/2.6.18-194.el5debug exists
checking modpath /lib/modules/2.6.18-194.el5 is a directory
picked vmlinuz-2.6.18-194.el5 because modpath /lib/modules/2.6.18-194.el5 exists
checking modpath /lib/modules/2.6.18-164.el5 is a directory
picked vmlinuz-2.6.18-164.el5 because modpath /lib/modules/2.6.18-164.el5 exists
checking modpath /lib/modules/2.6.18-164.el5debug is a directory
picked vmlinuz-2.6.18-164.el5debug because modpath /lib/modules/2.6.18-164.el5debug exists
checking modpath /lib/modules/2.6.32-19.el6.x86_64 is a directory
creating symlink /tmp/kernel -> /boot/vmlinuz-2.6.18-194.el5debug
supermin helper [00044ms] finished creating kernel
supermin helper [00044ms] visiting /usr/lib64/guestfs
supermin helper [00044ms] visiting /usr/lib64/guestfs/initramfs.epel-5.x86_64.supermin.hostfiles
supermin helper [00664ms] visiting /usr/lib64/guestfs/kmod.whitelist
febootstrap-supermin-helper: febootstrap-supermin-helper.c:596: write_hostfiles: Assertion `patt' failed.
Aborted

$ echo $?
134

should I file another bug for this?

Comment 6 Jinxin Zheng 2010-05-24 09:55:25 UTC
(In reply to comment #5)
> (In reply to comment #3)
> > Rich, Would you please give a tip on how to verify the change you have made ?
> > 
> > as (I think) there's currently no available rpm containing this change, I am
> > trying to compile febootstrap from the git source on the RHEL 5, but this fails
> > at the configure step with 
> > configure.ac:62: required file `lib/Makefile.in' not found    
> 
> Well, stupid me.. had a look at the autogen.sh file and found that missing
> gnulib is my problem...
> 
> git cloned gnulib to appropriate location, and febootstrap compiled ok.
> 
> however, got another problem here,
> 
> $ febootstrap-supermin-helper  --verbose '/usr/lib64/guestfs' x86_64 epel-5
> /tmp/kernel /tmp/initrd
> supermin helper [00000ms] whitelist = (not specified), host_cpu = epel-5,
> kernel = /tmp/kernel, initrd = /tmp/initrd
> supermin helper [00000ms] inputs[0] = /usr/lib64/guestfs
> supermin helper [00000ms] inputs[1] = x86_64
> checking modpath /lib/modules/2.6.18-194.el5debug is a directory
> picked vmlinuz-2.6.18-194.el5debug because modpath
> /lib/modules/2.6.18-194.el5debug exists
> checking modpath /lib/modules/2.6.18-194.el5 is a directory
> picked vmlinuz-2.6.18-194.el5 because modpath /lib/modules/2.6.18-194.el5
> exists
> checking modpath /lib/modules/2.6.18-164.el5 is a directory
> picked vmlinuz-2.6.18-164.el5 because modpath /lib/modules/2.6.18-164.el5
> exists
> checking modpath /lib/modules/2.6.18-164.el5debug is a directory
> picked vmlinuz-2.6.18-164.el5debug because modpath
> /lib/modules/2.6.18-164.el5debug exists
> checking modpath /lib/modules/2.6.32-19.el6.x86_64 is a directory
> creating symlink /tmp/kernel -> /boot/vmlinuz-2.6.18-194.el5debug
> supermin helper [00044ms] finished creating kernel
> supermin helper [00044ms] visiting /usr/lib64/guestfs
> supermin helper [00044ms] visiting
> /usr/lib64/guestfs/initramfs.epel-5.x86_64.supermin.hostfiles
> supermin helper [00664ms] visiting /usr/lib64/guestfs/kmod.whitelist
> febootstrap-supermin-helper: febootstrap-supermin-helper.c:596:
> write_hostfiles: Assertion `patt' failed.
> Aborted
> 
> $ echo $?
> 134
> 
> should I file another bug for this?    

Well, stupid again. I misunderstood the usage of febootstrap-supermin-helper.

It looks fine now. Thank you.