Problem chrooting Linux system

Hello, i am trying some testing about Linux chroot under FreeBSD, if i use debottstrap to obtain Linux system it works without problem:
Code:
debootstrap --arch=amd64 --no-check-gpg focal ./test
mount -o nocover -t linprocfs linprocfs ./test/proc
mount -o nocover -t linsysfs linsysfs ./test/sys
mount -o nocover -t devfs devfs ./test/dev
mount -o nocover,linrdlnk -t fdescfs fdescfs ./test/dev/fd
mount -o nocover,mode=1777 -t tmpfs tmpfs ./test/dev/shm
chroot ./test /bin/bash

root@Garrus:/# uname -a
Linux Garrus.alfaexploit.com 3.17.0 FreeBSD 13.0-RELEASE-p3 #0: Tue Jun 29 19:46:20 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

But if i try it with a Gentoo system seems that dynamic linker configuration is not updated:
Code:
mkdir /compat/gentoo
cd /compat/gentoo
fetch https://bouncer.gentoo.org/fetch/root/all/releases/amd64/autobuilds/20210725T170534Z/stage3-amd64-openrc-20210725T170534Z.tar.xz
tar xpvf stage3-*.tar.xz --xattrs --numeric-owner
mount -o nocover -t linprocfs linprocfs /compat/gentoo/proc
mount -o nocover -t linsysfs linsysfs /compat/gentoo/sys
mount -o nocover -t devfs devfs /compat/gentoo/dev
mount -o nocover,linrdlnk -t fdescfs fdescfs /compat/gentoo/dev/fd
mount -o nocover,mode=1777 -t tmpfs tmpfs /compat/gentoo/dev/shm

chroot /compat/gentoo /bin/bash
/bin/bash: error while loading shared libraries: libreadline.so.8: cannot stat shared object: Invalid argument

Library is located in chroot system:
Code:
ls -la /compat/gentoo/lib64/libreadline.so.8*
lrwxrwxrwx  1 root  wheel      18 Jul 18 20:14 /compat/gentoo/lib64/libreadline.so.8 -> libreadline.so.8.1
-rwxr-xr-x  1 root  wheel  346104 Jul 18 20:14 /compat/gentoo/lib64/libreadline.so.8.1

And chroot system is configured to search for libraries in the correct directory:
Code:
cat /compat/gentoo/etc/ld.so.conf
# ld.so.conf autogenerated by env-update; make all changes to
# contents of /etc/env.d directory
include ld.so.conf.d/*.conf
/lib64
/usr/lib64
/usr/local/lib64
/lib
/usr/lib
/usr/local/lib

Why chroot is not reading /etc/ld.so.conf configuration when its chrooted? Why debootstrap system works?
 
D

Deleted member 30996

Guest
Garrus.alfaexploit.com
What could possibly go wrong?

lightbulb.jpg
 
This sounds like a fascinating idea from a Doctor Frankenstein perspective, that is.

FreeBSD can run Linux binaries natively, true. But I am pretty convinced that that support is kind of limited, and when some Linux binaries try to use interfaces/functionality the FreeBSD kernel has not funny things are bound to happen. So while building the monster might be a fun experience, using it for productional work might result in having the monster biting your hand, hard.
 
OP
kr0m
That script installs a Ubuntu system in chrrot and executes Linux browser using linuxulator, it works perfectly.
I thought that I could test a Gentoo system instead of Ubuntu, but it seems that debootstrap modifies something in chroot ld system while doing it manually following gentoo handbook installation, doesn't.

As I said its only a test, but I would like to know why debootstrap works while deploying chroot manually not.
 
D

Deleted member 30996

Guest
I put up a sub-domain pllaceholder yesterday but just got Let's Encrypt going. Graphics not started on and only an idea of what will be.
 
OP
kr0m
Sorry but i dont undestand what are you trying to say, are you trying to configure garrus.alfaexploit.com subdomain with lets encrypt https?
For doing that you have to demonstrate that alfaexploit.com domain belongs to you, and thats impossible because alfaexploit.com domain is mine not yours.

If you want to test Letsencrypt you first has to buy a domain, then you can demonstrate that domain belongs to you and you can ask for certificate.

I dont know if it helps you?
 

olli@

Developer
But if i try it with a Gentoo system seems that dynamic linker configuration is not updated:
Code:
/bin/bash: error while loading shared libraries: libreadline.so.8: cannot stat shared object: Invalid argument
What is the output of the following command?
brandelf /compat/gentoo/lib64/libreadline.so.8.1
 
OP
kr0m
The output is:

Bash:
File '/compat/gentoo/lib64/libreadline.so.8.1' is of brand 'SVR4' (0).
 
OP
kr0m
I am trying to understand /usr/ports/emulators/linux_base-c7/Makefile steps, maybe it shows me the light
 

olli@

Developer
The output is:

Bash:
File '/compat/gentoo/lib64/libreadline.so.8.1' is of brand 'SVR4' (0).
Ok, that should work. I suspected that the ELF branding of the libraries was wrong (i.e. “FreeBSD” instead of “SVR4” or “Linux”), but it appears to be ok.
 
D

Deleted member 30996

Guest
Sorry but i dont undestand what are you trying to say, are you trying to configure garrus.alfaexploit.com subdomain with lets encrypt https?
No. But any confusion on your part my fault in not being more clear.

My website is https://alfaexploit.com
Garrus is the machine hostname
I was responding to your post informing me that it was your site I referenced unknowingly with the screenshot of the network error.

I referenced my own site sub-domain in my response..
 
from a Doctor Frankenstein perspective
😂
...I'm not seldom wondering how much effort is brought into transforming FreeBSD into Linux.

To get some Linux applications running that are missed under FreeBSD - okay.
To experiment for pure curiosity what can be done - okay.
But sometimes - not necessaily in this very case, sorry for running a bit besides the actual topic again - I wonder myself, why some people trying to transform FreeBSD into Linux instead of just stick with in the first place... - but I also would not try to get a BigMac in a sushi bar. 🤪
And there people trying such. *facepalm*
 
Top