Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

fakechroot - Seems to be inconsistent

User discussion about Debian Development, Debian Project News and Announcements. Not for support questions.
Post Reply
Message
Author
sarvi
Posts: 8
Joined: 2008-10-01 04:39

fakechroot - Seems to be inconsistent

#1 Post by sarvi »

Hi,
I am using fakechroot-2.8 and fakeroot in a Redhat environment trying to debootstrap a debian chroot to allow me to do some debian development.

Is there any gotchas that I need to be aware of when working with fakechroot???

My attempts at debootstraping with fakeroot/fakechroot have been running into a lot of problems.

I spent weekend stracing and I notice that chroot seems to be inconsistent in the system calls and how it maps chroot path names into real paths.

The reason my debootstrap was failing at the -second-stage of debootstrapping.
Because dpkg --install was invoked within the chroot and it was invoking dpkg-split, which was failing to execute.

On stracing, I found that dpkg was executed from the with the chroot, but the dpkg-split executable it was attempting fork off could not be found.
I see from the strace it is searching all the paths in my real paths including /usr/bin but not /ws/sarvi/buildspace/newroot/root/usr/bin.

Put an another way, it was able to find dpkg(which is not installed in my real root by the way) when i invoked it from the fakechrooted shell. But a process dpkg forks, namely dpkg-split, could not be found, though it is in the same directory as dpkg itself.

What I have done for now, since I recognize this is the problem, is to add /ws/sarvi/buildspace/newroot/root/usr/bin to the end of my PATH when invoking the fakechroot. When I did the installation seems to have gone fine.

But I was under the impression, that I didn't have to do anything like this and fakechroot should be be applicable for processes invoked by processes as well. But they don't seem to be working that way.

Any pointers would be appreciated.

Thx,
Sarvi

User avatar
BioTube
Posts: 7520
Joined: 2007-06-01 04:34

#2 Post by BioTube »

Works fine with the real chroot command.
Image
Ludwig von Mises wrote:The elite should be supreme by virtue of persuasion, not by the assistance of firing squads.

sarvi
Posts: 8
Joined: 2008-10-01 04:39

#3 Post by sarvi »

Hi
Thanks for responding. Well for some reason, I am having trouble.
May be I am not using fakeroot fakechroot properly or I have not setup the environment properly.

I have below what I see during the debootstrap process. and how I need to adjust my PATH for thibgs to work

I have fakeroot/fakechroot installed under
/ws/sarvi/tools/i686

sjc-lds-251:20> echo $PATH
/ws/sarvi/tools/bin:/ws/sarvi/tools/usr/sbin:/ws/sarvi/tools/i686/bin:/nfs/nova/tools/latest/bin:/nfs/nova/binos-tools/bin:/sw/licensed/intel/beta64/bin:/usr/nova/bin:/usr/nova-noarch/bin:/usr/kerberos/bin:/router/bin:/usr/atria/bin:/usr/local/bin:/usr/local/etc:/bin:/usr/X11R6/bin:/usr/sbin:/sbin:/usr/bin:/usr/cisco/bin:.
sjc-lds-251:21> echo $LD_LIBRARY_PATH
/ws/sarvi/tools/i686/lib/fakechroot:/ws/sarvi/tools/i686/lib:/ws/sarvi/tools/lib:/usr/X11R6/lib
sjc-lds-251:22> echo $LD_PRELOAD
LD_PRELOAD: Undefined variable.

Command:
fakeroot -s /ws/sarvi/buildspace/newroot/files.state fakechroot debootstrap --arch=i386 --verbose --variant=fakechroot etch /ws/sarvi/buildspace/newroot/root

Completes as below
I: Extracting tzdata...
I: Extracting util-linux...
I: Extracting zlib1g...
I: Installing core packages...
W: Failure trying to run: chroot /ws/sarvi/buildspace/newroot/root dpkg --force-depends --install var/cache/apt/archives/base-files_4_i386.deb var/cache/apt/archives/base-passwd_3.5.11_i386.deb

This is failing at the beginning of stage 2 of debootstrap as ashown by the debootstrap log
Progress: 1 : 7 : INSTCORE : Installing core packages
Progress: 2 : 7 : INSTCORE : Installing core packages
IN_TARGET: dpkg --force-depends --install var/cache/apt/archives/base-files_4_i386.deb var/cache/apt/archives/base-passwd_3.5.11_i386.deb
dpkg (subprocess): failed to exec dpkg-split to see if it's part of a multiparter: No such file or directory
dpkg: error processing var/cache/apt/archives/base-files_4_i386.deb (--install):
subprocess dpkg-split returned error exit status 2
dpkg (subprocess): failed to exec dpkg-split to see if it's part of a multiparter: No such file or directory
dpkg: error processing var/cache/apt/archives/base-passwd_3.5.11_i386.deb (--install):
subprocess dpkg-split returned error exit status 2
Errors were encountered while processing:
var/cache/apt/archives/base-files_4_i386.deb
var/cache/apt/archives/base-passwd_3.5.11_i386.deb


I can now chroot shell into it though, since the first stage of debootstrap went through.

fakeroot -i /ws/sarvi/buildspace/newroot/files.state -s /ws/sarvi/buildspace/newroot/files.state fakechroot chroot /ws/sarvi/buildspace/newroot/root /bin/bash
root@sjc-lds-251:/# echo $PATH
/ws/sarvi/tools/bin:/ws/sarvi/tools/usr/sbin:/ws/sarvi/tools/i686/bin:/nfs/nova/tools/latest/bin:/nfs/nova/binos-tools/bin:/sw/licensed/intel/beta64/bin:/usr/nova/bin:/usr/nova-noarch/bin:/usr/kerberos/bin:/router/bin:/usr/atria/bin:/usr/local/bin:/usr/local/etc:/bin:/usr/X11R6/bin:/usr/sbin:/sbin:/usr/bin:/usr/cisco/bin:.
root@sjc-lds-251:/#

root@sjc-lds-251:/# dpkg --install /var/cache/apt/archives/sed_4.1.5-1_i386.deb
dpkg (subprocess): failed to exec dpkg-split to see if it's part of a multiparter: No such file or directory
dpkg: error processing /var/cache/apt/archives/sed_4.1.5-1_i386.deb (--install):
subprocess dpkg-split returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/sed_4.1.5-1_i386.deb
root@sjc-lds-251:/#

I then exited added to the PATH and the rechrooted into shell
sjc-lds-251:25> setenv PATH {$PATH}:/ws/sarvi/buildspace/newroot/root/usr/bin
sjc-lds-251:26>
sjc-lds-251:26> fakeroot -i /ws/sarvi/buildspace/newroot/files.state -s /ws/sarvi/buildspace/newroot/files.state fakechroot chroot /ws/sarvi/buildspace/newroot/root /bin/bash
root@sjc-lds-251:/#
root@sjc-lds-251:/#
root@sjc-lds-251:/# dpkg --install /var/cache/apt/archives/sed_4.1.5-1_i386.deb
Selecting previously deselected package sed.
dpkg: regarding .../archives/sed_4.1.5-1_i386.deb containing sed, pre-dependency problem:
sed pre-depends on libc6 (>= 2.3.6-6)
dpkg: error processing /var/cache/apt/archives/sed_4.1.5-1_i386.deb (--install):
pre-dependency problem - not installing sed
Errors were encountered while processing:
/var/cache/apt/archives/sed_4.1.5-1_i386.deb

Notice above that this time it did not have trouble finding dpkg-split, if I had used the --force option it would have actually installed sed fine.

Now when i get out and reinitialize/re-debootstrap the root directory it goes through fine as shown below.
I: Configuring aptitude...
I: Configuring apt-utils...
I: Configuring perl-modules...
I: Configuring perl...
I: Base system installed successfully.

sarvi
Posts: 8
Joined: 2008-10-01 04:39

#4 Post by sarvi »

Could this be a problem. In 2.7 of fakechroot, the changelog says the following.
- Fixed execve(2) function to not expand argv0 and handle "#!" correctly.

Does this mean that it does not expand to real full path before executing.

Cause, I see the strace logs show execv being invoked without expansition for dpkg-split. See below. If they were behaving like the rest, they should have been expanded with /ws/sarvi/buildspace/newroot/root

[pid 25169] getcwd("/ws/sarvi/buildspace/newroot/root", 4096) = 34
[pid 25169] execve("/ws/sarvi/tools/bin/dpkg-split", ["dpkg-split", "-Qao", "/var/lib/dpkg/reassemble.deb", "/var/cache/apt/archives/sed_4.1."...], [/* 99 vars */]) = -1 ENOENT (No such file or directory)
[pid 25169] execve("/ws/sarvi/tools/usr/sbin/dpkg-split", ["dpkg-split", "-Qao", "/var/lib/dpkg/reassemble.deb", "/var/cache/apt/archives/sed_4.1."...], [/* 99 vars */]) = -1 ENOENT (No such file or directory)
[pid 25169] execve("/ws/sarvi/tools/x86_64/bin/dpkg-split", ["dpkg-split", "-Qao", "/var/lib/dpkg/reassemble.deb", "/var/cache/apt/archives/sed_4.1."...], [/* 99 vars */]) = -1 ENOENT (No such file or directory)

Zelgadis
Posts: 1
Joined: 2013-11-27 15:49

Re: fakechroot - Seems to be inconsistent

#5 Post by Zelgadis »

Hello!

I have faced the same problems as yours, being on Fedora. Here's the command that did the trick for me:

Code: Select all

export LIBDIR=lib64
export PREFIX=/ws/sarvi/buildspace/newroot/roo

LD_LIBRARY_PATH=/${LIBDIR}:${PREFIX}/usr/${LIBDIR} \
PATH=${PREFIX}/usr/sbin:${PREFIX}/sbin:${PREFIX}/usr/bin:${PREFIX}/bin:/usr/local/sbin:/usr/sbin:/sbin:/sbin:/bin:/usr/bin:$PATH HOME=/ LOGNAME=root \
		fakeroot fakechroot \
		debootstrap --variant=fakechroot --arch=$SYS_ARCH --include=sudo --include=apt lenny \
		${PREFIX} http://archive.debian.org/debian

Post Reply