Bug 1197407

Summary: libguestfs fails to find root
Product: Red Hat Enterprise Linux 7 Reporter: William Brown <william>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: ptoscano
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-02 09:15:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Output of virt-cat -x -v none

Description William Brown 2015-03-01 01:38:36 UTC
Created attachment 996669 [details]
Output of virt-cat -x -v

Description of problem:
I am using the virt-v2v tools from https://www.redhat.com/archives/libguestfs/2014-May/msg00090.html as they are not yet available (from what I can see)

My guest has partitioning as:

NAME                MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vda                 252:0    0   20G  0 disk 
├─vda1              252:1    0  512M  0 part /boot
└─vda2              252:2    0 19.5G  0 part 
  ├─vg00-root_lv    253:0    0  512M  0 lvm  /
  ├─vg00-swap_lv    253:1    0    2G  0 lvm  [SWAP]
  ├─vg00-usr_lv     253:2    0    3G  0 lvm  /usr
  ├─vg00-var_log_lv 253:3    0    2G  0 lvm  /var/log
  ├─vg00-var_lib_lv 253:4    0    2G  0 lvm  /var/lib
  ├─vg00-var_lv     253:5    0  1.5G  0 lvm  /var
  └─vg00-home_lv    253:6    0  512M  0 lvm  /home


Libguest fails to find the root volume in this configuration.

I have attached the log of virt-cat -x -v on this host.

Version     : 1.28.1
From repo   : libguestfs-RHEL-7.1-preview

Comment 1 William Brown 2015-03-01 02:17:30 UTC
  /* Linux root? */
  else if (is_dir_etc &&
           (is_dir_bin ||
            (guestfs_is_symlink (g, "/bin") > 0 &&
             guestfs_is_dir (g, "/usr/bin") > 0)) &&
           guestfs_is_file (g, "/etc/fstab") > 0) {
    fs->is_root = 1;
    fs->format = OS_FORMAT_INSTALLED;
    if (guestfs___check_linux_root (g, fs) == -1)
      return -1;
  }


src/inspect-fs.c

Because /usr is seperate, /usr/bin is dir will never be satisfied.

Perhaps just check that /usr is a directory instead?

Comment 2 William Brown 2015-03-01 02:26:17 UTC
As a work around, you can boot a guest with rd.break rd.shell and run

umount /sysroot/usr/
remount -o rw,remount /sysroot
mkdir /sysroot/usr/bin
sync
remount -o ro,remount /sysroot
reboot

This is enough to pass the check for root_lv to pass as the root, then the tools will mount /usr anyway and everything works.

Comment 4 Richard W.M. Jones 2015-03-02 09:15:43 UTC
This is the same as the problem that inspection doesn't
work when /usr is on a separate partition.  Therefore
marking as duplicate.

*** This bug has been marked as a duplicate of bug 1186935 ***