linux_dist-gentoo-stage3 : issue dealing with rm in chrooted environment

TitusCrow

New Member


Messages: 2

Hi freeBSD users !

I'm facing a problem dealing with the gentoo stage3 port, and as my searches on Google were unsuccessful, I decided to write my first thread here. Hope someone will be able to point me to the right direction !

Actually, I would like to test CUDA samples on FreeBSD OS, using the Linux compatibility layer and native FreeBSD NVidia drivers. Unfortunately, I'm stuck before I could test this.

This is what I did so far :

1. First, I installed a fresh FreeBSD using the "netinst" of freeBSD 9.0.

Code:
uname -a
FreeBSD TestBSD 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012 /usr/obj/usr/src/sys/GENERIC  amd64
2. Then, I installed linux_base-f10 and nvidia-driver ports (nvidia-driver port has an option to consider linux compatibility that need the linux_base-f10 port):

# cd /usr/ports/emulators/linux_base-f10 && make install clean
and
# cd /usr/ports/x11/nvidia-driver && make install clean

3. As I intend to compile CUDA stuff in a simili-Linux box, I also installed linux_dist-gentoo-stage3:

# cd /usr/ports/emulators/linux_dist-gentoo-stage3 && make install clean

Everything went flawlessly, using default settings (meaning I've a i386 linux_base-f10 and a i486 linux_dist-gentoo-stage3). The Linux and NVidia modules are loaded, respectively in /etc/rc.conf and /boot/loader.conf :
Code:
# kldstat
Id Refs Address            Size     Name
 1   10 0xffffffff80200000 11cd9b0  kernel
 2    1 0xffffffff813ce000 ee73e8   nvidia.ko
 3    2 0xffffffff822b6000 45090    linux.ko
4. Doing some searches on Internet dealing with chrooted environments in FreeBSD, I found that I need to do some mounting for the chrooted environment to work correctly:

# mount -t linprocfs linproc /usr/local/gentoo-stage3/proc
# mount -t linsysfs linsys /usr/local/gentoo-stage3/sys
# mount -t devfs devfs /usr/local/gentoo-stage3/dev

5. Phew ! OK, now let's try to use this gentoo stage3 !

Code:
 chroot /usr/local/gentoo-stage3/ /bin/bash
TestBSD / # emerge --sync

sent 48.88K bytes  received 7.02M bytes  59.62K bytes/sec
total size is 268.27M  speedup is 37.97

 * An update to portage is available. It is _highly_ recommended
 * that you update portage now, before any other packages are updated.

 * To update portage, run 'emerge portage' now.

TestBSD / #
This is the point where I'm facing issues.

6. In order to compile things in this chroot, the Gentoo portage provides /usr/portage/scripts/bootstrap.sh. However, whether I launch this script or decide to update portage, here's what I get:

Code:
TestBSD / # emerge portage
Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Starting parallel fetch

>>> Emerging (1 of 5) sys-devel/m4-1.4.16
 * m4-1.4.16.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...                                          [ ok ]
>>> Unpacking source...
>>> Unpacking m4-1.4.16.tar.xz to /var/tmp/portage/sys-devel/m4-1.4.16/work
tar: m4-1.4.16/THANKS: Cannot utime: Bad file descriptor
tar: m4-1.4.16/NEWS: Cannot utime: Bad file descriptor
tar: m4-1.4.16/Makefile.am: Cannot utime: Bad file descriptor

[...]

 * ERROR: sys-devel/m4-1.4.16 failed (unpack phase):
 *   failure unpacking m4-1.4.16.tar.xz

TestBSD / #
Googling this points me to a solution (Link)
Indeed, using
Code:
TestBSD / # export TAR_OPTIONS='--touch'
makes the messages disappear..

7. However :

Code:
TestBSD / # export TAR_OPTIONS='--touch'
TestBSD / # emerge portage
Calculating dependencies... done!

>>> Verifying ebuild manifests

[...]

checking for a BSD-compatible install... rm: cannot remove `conftest.dir/conftest.one': Bad file descriptor
rm: cannot remove `conftest.dir/conftest.two': Bad file descriptor
[...]
checking whether the C compiler works... rm: cannot remove `conftest.dir': Is a directory
yes
[...]
checking dependency style of i486-pc-linux-gnu-gcc... mkdir: cannot create directory `conftest.dir': File exists
touch: setting times of `sub/conftst1.h': Invalid argument
touch: setting times of `sub/conftst2.h': Invalid argument
touch: setting times of `sub/conftst3.h': Invalid argument
touch: setting times of `sub/conftst4.h': Invalid argument
touch: setting times of `sub/conftst5.h': Invalid argument
touch: setting times of `sub/conftst6.h': Invalid argument
rm: cannot remove `conftest.dir/conftest.one': Bad file descriptor
rm: cannot remove `conftest.dir/conftest.two': Bad file descriptor
rm: cannot remove `conftest.dir/depcomp': Bad file descriptor
rm: cannot remove `conftest.dir/sub': Bad file descriptor
rm: cannot remove `conftest.dir/confmf': Bad file descriptor
rm: cannot remove `conftest.dir/conftest.err': Bad file descriptor
[...]
And this, of course, ends in error state.

Conclusion:

So far, I haven't been able to go beyond this step... and googling these error messages does not point me to relevant informations :/ .
I also tried without success to mount outside the chroot the /usr/local/gentoo-stage3/tmp and /usr/local/gentoo-stage3/var/tmp/portage as tmpfs.

Any help would be greatly appreciated !!

Thanks for your reading !
 
OP
OP
TitusCrow

TitusCrow

New Member


Messages: 2

I reply to myself :
I found this Link explaining a workaround :

[font="Courier New"] This can be worked around by adding a symlink to busybox:

Code:
ln -s /bin/busybox /usr/bin/touch
There is a similar issue involving `rm`. I have not debugged it in
depth, but it also can be fixed with a symlink to busybox:

Code:
ln -s /bin/busybox /bin/rm
Lastly, the issue with tar can be fixed with a symlink to busybox too:

Code:
 ln -s /bin/busybox /bin/tar
We still need the appropriate syscalls implemented to make these
commands happy, but at least we have a workaround now.
[/font]
Applying this in my chroot environment gives me the expected result :D
 
Top