From nobody Mon Aug 21 09:30:21 2023 X-Original-To: emulation@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RTnJd6BSjz4qVxP; Mon, 21 Aug 2023 09:30:25 +0000 (UTC) (envelope-from felix@palmen-it.de) Received: from stef.palmen-it.de (stef.palmen-it.de [IPv6:2001:470:1f0b:bbb:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4RTnJc5bhhz4LBf; Mon, 21 Aug 2023 09:30:24 +0000 (UTC) (envelope-from felix@palmen-it.de) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=palmen-it.de header.s=20200414 header.b=mPWmo3km; spf=pass (mx1.freebsd.org: domain of felix@palmen-it.de designates 2001:470:1f0b:bbb:1::1 as permitted sender) smtp.mailfrom=felix@palmen-it.de; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=palmen-it.de; s=20200414; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:To:From:Date:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=46bYIQDfgDUQ8HcAqd1T+Uu10niHmh4w/Bw1dny81R4=; b=mPWmo3kmvfx4IwrDTLhH65om+4 FYbYh566DsyChadnSm/LreaRjIdDS6o4yhiuaolQzsDsi51P8mKJLtmuM+3tKb8xQGY4pEi7N+NGv OzUo6niZuOOnJPykR0HSK2Zx+Hg3MTJ4jzyFSNvzdMfpSodj4mvsIYVjb3jmqLkqDhR6QMlthRIir 767ug/alR6DTcm5kF9jl8UHiGxNzeLKd3z7fTZTSqFq2k1/QqwbjVvAlN1gUlpQWcjp5gxOHijTZv 7j75oEM4EYGWYFjQ6hbRBm1jnyX8IKG+o1uUuvtW8HTcRKSt9YxdIUY6CWbVWIhPZQmoEdOmd7xda UVC7ZHBw==; Received: from [192.168.71.101] (helo=mail.home.palmen-it.de) by stef.palmen-it.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qY1Er-00AFMR-Li; Mon, 21 Aug 2023 11:30:21 +0200 Received: from nexus.home.palmen-it.de ([192.168.99.2]) by mail.home.palmen-it.de with esmtpsa (TLS1.3) tls TLS_CHACHA20_POLY1305_SHA256 (Exim 4.96 (FreeBSD)) (envelope-from ) id 1qY1Er-00023K-1W; Mon, 21 Aug 2023 09:30:21 +0000 Date: Mon, 21 Aug 2023 11:30:21 +0200 From: Felix Palmen To: ports@freebsd.org, emulation@freebsd.org Subject: Re: Building a Linuxulator userland from source Message-ID: Mail-Followup-To: ports@freebsd.org, emulation@freebsd.org X-Face: /1K@t"h.}e~pR@]c7HorQ!T`F^RJCa'BCr#e>IKA{>C/9OTGB4|xh"y2{?1Z5M i2w"AH^pN_LlHR^{+f',_Np~;.B;!M/bL}*qk]p5*r7F5vW};{:@4u5S?T&f0$7BJ-71Q5SV]:v$`5 A0[DZ:=?S52x8HJ~5@^P_\T@MsjG{R( Organization: FreeBSD.org References: List-Id: Development of Emulators of other operating systems List-Archive: https://lists.freebsd.org/archives/freebsd-emulation List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-emulation@freebsd.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ysylsehyngskod7k" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20230517 X-Spamd-Result: default: False [-7.50 / 15.00]; SIGNED_PGP(-2.00)[]; DWL_DNSWL_MED(-2.00)[palmen-it.de:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.999]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; FORGED_SENDER(0.30)[zirias@freebsd.org,felix@palmen-it.de]; R_DKIM_ALLOW(-0.20)[palmen-it.de:s=20200414]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; R_SPF_ALLOW(-0.20)[+ip6:2001:470:1f0b:bbb:1::1:c]; RCVD_IN_DNSWL_MED(-0.20)[2001:470:1f0b:bbb:1::1:from]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[freebsd.org]; MLMMJ_DEST(0.00)[ports@freebsd.org,emulation@freebsd.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_NEQ_ENVFROM(0.00)[zirias@freebsd.org,felix@palmen-it.de]; RCVD_COUNT_TWO(0.00)[2]; HAS_ORG_HEADER(0.00)[]; TO_DN_NONE(0.00)[]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[palmen-it.de:+]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCPT_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_TLS_ALL(0.00)[] X-Spamd-Bar: ------- X-Rspamd-Queue-Id: 4RTnJc5bhhz4LBf --ysylsehyngskod7k Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Tatsuki Makino [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 {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--