Bug 770075

Summary: FEBOOTSTRAP_MODULES fails if modules directory is not under /lib
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: gaowanlong, virt-maint
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: 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 Richard W.M. Jones 2011-12-23 09:48:35 UTC
Description of problem:

If, say, FEBOOTSTRAP_MODULES=/tmp/modules, then the build of
the appliance fails because /tmp/modules doesn't exist.  What
should happen is that the path is written to appear under /lib
in the appliance.

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

libguestfs 1.15.13
febootstrap 3.12

How reproducible:

100%

Steps to Reproduce:
1. Copy a /lib/modules/* directory to somewhere under /tmp
2. Set FEBOOTSTRAP_KERNEL and FEBOOTSTRAP_MODULES
3. Run any libguestfs tool
  
Actual results:

febootstrap-supermin-helper: ext2: parent directory not found: /tmp/modules: File not found by ext2_lookup
Fatal error: exception Guestfs.Error("external command failed, see earlier error messages")
libguestfs: closing guestfs handle 0xa5f2a0 (state 0)

Expected results:


Additional info:

Comment 1 Wanlong Gao 2011-12-24 03:41:08 UTC
Yeah, I can see the same problem:
febootstrap-supermin-helper: ext2: parent directory not found: /home/allen/modules: File not found by ext2_lookup

Comment 2 Wanlong Gao 2011-12-24 09:33:02 UTC
I installed the upstream febootstrap, then this problem is disappeared.

febootstrap-supermin-helper: using environment variable(s) FEBOOTSTRAP_* to
select kernel /tmp/p and module path /tmp/3.1.6-1.fc16.x86_64
supermin helper [00000ms] finished creating kernel
supermin helper [00887ms] finished mke2fs
supermin helper [00887ms] visiting /usr/local/lib/guestfs/supermin.d
supermin helper [00887ms] visiting /usr/local/lib/guestfs/supermin.d/base.img
supermin helper [02515ms] visiting /usr/local/lib/guestfs/supermin.d/daemon.img
supermin helper [02517ms] visiting /usr/local/lib/guestfs/supermin.d/hostfiles
supermin helper [04056ms] visiting /usr/local/lib/guestfs/supermin.d/init.img
supermin helper [04057ms] adding kernel modules
supermin helper [05620ms] closing ext2 filesystem

Comment 3 Wanlong Gao 2011-12-24 09:38:37 UTC
Then I noticed that if I moved the modules to /tmp/3.1.6-1.fc16.x86_64, it can boot successfully, but can't when moved to /tmp/modules/3.1.6-1.fc16.x86_64.

Comment 4 Richard W.M. Jones 2011-12-24 10:00:43 UTC
(In reply to comment #3)
> Then I noticed that if I moved the modules to /tmp/3.1.6-1.fc16.x86_64, it can
> boot successfully, but can't when moved to /tmp/modules/3.1.6-1.fc16.x86_64.

The specific problem is that it tries to create the modules
directory in the same directory as on the host.  If that
directory is /tmp/modules/XXX then it fails because /tmp/modules
doesn't exist when it comes to building the root appliance
(because febootstrap requires that all parent directories are
created before their contents).

In any case, it's all wrong ... it should be mapping the host
pathnames to /lib/modules.

Comment 5 Wanlong Gao 2011-12-27 15:05:49 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > Then I noticed that if I moved the modules to /tmp/3.1.6-1.fc16.x86_64, it can
> > boot successfully, but can't when moved to /tmp/modules/3.1.6-1.fc16.x86_64.
> 
> The specific problem is that it tries to create the modules
> directory in the same directory as on the host.  If that
> directory is /tmp/modules/XXX then it fails because /tmp/modules
> doesn't exist when it comes to building the root appliance
> (because febootstrap requires that all parent directories are
> created before their contents).
> 
> In any case, it's all wrong ... it should be mapping the host
> pathnames to /lib/modules.

Yeah, I looked into this and found that this is a febootstrap's bug, but I haven't got a good idea to fix this, because if we change the behaviour of ext2_file_stat, it will be effected with the other host files.

I tried to pass another argument to the ext2_file_stat to divide the modules' behaviour, but it seems not a good idea, either.

Do you have any good ideas about this?

Thanks
-Wanlong Gao