Date: Mon, 21 Aug 2023 11:30:21 +0200 From: Felix Palmen <zirias@freebsd.org> To: ports@freebsd.org, emulation@freebsd.org Subject: Re: Building a Linuxulator userland from source Message-ID: <ycunrmdtcbpudkpvklm4mty2udi2jlx75akpfc3qfpi7xhwx65@ln4asxaakt3n> In-Reply-To: <SI2PR01MB50365D850421F63522B5269DFA1EA@SI2PR01MB5036.apcprd01.prod.exchangelabs.com> References: <xcztahm3vu3bjghjqqxuoy2xabyjmyfq22jw6mkaaaqo7wa36s@fdq7dlvpuhlk> <i3kr2kukjwgw2xvjlzgshwe72bjpnln4lvl7prhk77nelzidm6@2g56zi3ku7ec> <SI2PR01MB5036EAB6EE2D224BBDAF86B0FA19A@SI2PR01MB5036.apcprd01.prod.exchangelabs.com> <SI2PR01MB50366A01896746D4DAFC18F7FA1EA@SI2PR01MB5036.apcprd01.prod.exchangelabs.com> <cnbxytnfqoh4dr6clz3qdhygeehjh7e3kqjdiarhiqsjhburhk@eotxvli5ma23> <SI2PR01MB50365D850421F63522B5269DFA1EA@SI2PR01MB5036.apcprd01.prod.exchangelabs.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--ysylsehyngskod7k Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Tatsuki Makino <tatsuki_makino@hotmail.com> [20230821 17:40]: > Felix Palmen wrote on 2023/08/21 16:21: > > This works perfectly fine when used from within a Linux shell. Example > > from testing my new userland: > >=20 > > | [00:00:20] Entering interactive test mode. Type 'exit' when done. > > | root@14a-default:~ # /compat/linux/bin/bash > > | bash-5.2# ldd /bin/bash > > | linux-vdso.so.1 (0x00007fffffffe000) > > | libreadline.so.8 =3D> /usr/lib64/libreadline.so.8 (0x00000008= 01154000) > > | libhistory.so.8 =3D> /usr/lib64/libhistory.so.8 (0x0000000801= 1ad000) > > | libncursesw.so.6 =3D> /usr/lib64/libncursesw.so.6 (0x00000008= 011bb000) > > | libc.so.6 =3D> /usr/lib64/libc.so.6 (0x0000000801400000) > > | /lib64/ld-linux-x86-64.so.2 (0x0000000001021000) > > | bash-5.2#=20 >=20 > Oh, I understand. > If we try to use it directly, the command not found if bash is not instal= led. Installing a FreeBSD bash won't help either, this script expects /bin/bash which will never exist on FreeBSD (it's installed in /usr/local/bin/bash). > we want poudriere to mount real devfs to /compat/linux/dev as well, > since linux binary behaves like chroot to /compat/linux. Well, first /compat/linux is *not* a chroot or jail, but actually just some kind of "filesystem overlay", which is the great thing about it. It means Linux binaries can access *all* files of the FreeBSD system, as long as they are not "shadowed" by something below /compat/linux. And indeed, to support building native Linux software using poudriere, it *should* mount devfs on /compat/linux/dev. > Alternatively, pkg-plist in emulators/linux_base-c7 is creating dummy > /compat/linux/dev, and removing it seems to be a workaround. In a live system, there's no issue. /etc/rc.d/linux will mount all necessary pseudo filesystems: | if checkyesno linux_mounts_enable; then | linux_mount linprocfs "${_emul_path}/proc" -o nocover | linux_mount linsysfs "${_emul_path}/sys" -o nocover | linux_mount devfs "${_emul_path}/dev" -o nocover | linux_mount fdescfs "${_emul_path}/dev/fd" -o nocover,linrdlnk | linux_mount tmpfs "${_emul_path}/dev/shm" -o nocover,mode=3D1777 | fi So far, poudriere doesn't mount anything on /compat/linux/dev for its building jails, although it *does* mount /compat/linux/proc. For now, I found that a simple symlink to the real /dev also does the trick, which I can add with some hackery in the port Makefile itself, by adding some extra prerequisite for "build-depends" when a poudriere build is detected. In the long run, poudriere should mount a real devfs though. Cheers, Felix --=20 Felix Palmen <zirias@FreeBSD.org> {private} felix@palmen-it.de -- ports committer -- {web} http://palmen-it.de {pgp public key} http://palmen-it.de/pub.txt {pgp fingerprint} 6936 13D5 5BBF 4837 B212 3ACC 54AD E006 9879 F231 --ysylsehyngskod7k Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iNUEABYKAH0WIQRpNhPVW79IN7ISOsxUreAGmHnyMQUCZOMupl8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0Njkz NjEzRDU1QkJGNDgzN0IyMTIzQUNDNTRBREUwMDY5ODc5RjIzMQAKCRBUreAGmHny MYyLAP0SU1MiNcfwVy/eqGV/MwLiTvCk7tuPUZ32NiHboW7BhAEAxTrZ7sPo1PoL 2Y6EKaGFGlwAmRwdTy+RdZOkiQ04sgY= =1wwN -----END PGP SIGNATURE----- --ysylsehyngskod7k--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ycunrmdtcbpudkpvklm4mty2udi2jlx75akpfc3qfpi7xhwx65>