From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ZuEbDYTiZF+rXgAA0tVLHw (envelope-from ) for ; Fri, 18 Sep 2020 16:38:28 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id CE+MCITiZF+0VQAA1q6Kng (envelope-from ) for ; Fri, 18 Sep 2020 16:38:28 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 45583940664 for ; Fri, 18 Sep 2020 16:38:27 +0000 (UTC) Received: from localhost ([::1]:56902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kJJOz-0004Gn-JJ for larch@yhetil.org; Fri, 18 Sep 2020 12:38:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kJIte-0004yk-Th for bug-guix@gnu.org; Fri, 18 Sep 2020 12:06:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60952) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kJIte-0002ub-GB for bug-guix@gnu.org; Fri, 18 Sep 2020 12:06:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kJIte-00089N-AF for bug-guix@gnu.org; Fri, 18 Sep 2020 12:06:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#43491: Fakechroot execution engine can fail to find libraries Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Fri, 18 Sep 2020 16:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43491 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 43491@debbugs.gnu.org Received: via spool by 43491-submit@debbugs.gnu.org id=B43491.160044510831248 (code B ref 43491); Fri, 18 Sep 2020 16:06:02 +0000 Received: (at 43491) by debbugs.gnu.org; 18 Sep 2020 16:05:08 +0000 Received: from localhost ([127.0.0.1]:44264 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJIsl-00087v-IA for submit@debbugs.gnu.org; Fri, 18 Sep 2020 12:05:08 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:58686) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kJIsj-00087K-M6 for 43491@debbugs.gnu.org; Fri, 18 Sep 2020 12:05:06 -0400 X-IronPort-AV: E=Sophos;i="5.77,274,1596492000"; d="scan'208";a="359435447" Received: from 91-160-117-201.subs.proxad.net (HELO ribbon) ([91.160.117.201]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2020 18:04:58 +0200 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87mu1nw6x9.fsf@inria.fr> Date: Fri, 18 Sep 2020 18:04:58 +0200 In-Reply-To: <87mu1nw6x9.fsf@inria.fr> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Fri, 18 Sep 2020 15:28:18 +0200") Message-ID: <87d02jvzo5.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -6.0 (------) X-Mailman-Approved-At: Fri, 18 Sep 2020 12:29:24 -0400 X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: ir+E1K/VSTv0 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s skribis: > $ guix describe > Generacio 159 Sep 18 2020 08:55:27 (nuna) > guix 98b89f4 > repository URL: https://git.savannah.gnu.org/git/guix.git > branch: master > commit: 98b89f432103b66efacee0bcba41a94148b8e870 > $ mkdir /tmp/fakechroot-test > $ (cd /tmp/fakechroot-test; tar xf $(guix pack -RR openmpi -S /bin=3Dbin = -v0)) > $ unshare -m -U -r -f sh -c 'mount -t tmpfs none /gnu; echo /gnu/*; GUIX_= EXECUTION_ENGINE=3Dfakechroot /tmp/fakechroot-test/bin/orterun' > /gnu/* > /tmp/fakechroot-test/gnu/store/rm1d9z3z3iwsv779vqlg7q5z7pdk5k12-openmpi-4= .0.5/bin//orterun: error while loading shared libraries: libevent_core-2.1.= so.7: cannot open shared object file: No such file or directory If we look at the LD_DEBUG=3Dall output, we see that /gnu/store/=E2=80=A6libevent-2.11.1/lib has disappeared from the search pat= h at the point where ld.so looks for libevent_core.so: --8<---------------cut here---------------start------------->8--- 15220: file=3Dlibevent_core-2.1.so.7 [0]; needed by /tmp/openmpi/gnu/= store/rm1d9z3z3iwsv779vqlg7q5z7pdk5k12-openmpi-4.0.5/bin//orterun [0] 15220: find library=3Dlibevent_core-2.1.so.7 [0]; searching 15220: search path=3D/tmp/openmpi/gnu/store/fa6wj5bxkj5ll1d7292a70knm= yl7a0cr-glibc-2.31/lib:/tmp/openmpi/gnu/store/01b4w3m6mp55y531kyi1g8shh722k= wqm-gcc-7.5.0-lib/lib:/tmp/openmpi/gnu/store:/tmp/openmpi/gnu/store/01b4w3m= 6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.= 5.0/../../.. (LD_LIBRARY_PATH) 15220: trying file=3D/tmp/openmpi/gnu/store/fa6wj5bxkj5ll1d7292a70kn= myl7a0cr-glibc-2.31/lib/libevent_core-2.1.so.7 15220: trying file=3D/tmp/openmpi/gnu/store/01b4w3m6mp55y531kyi1g8sh= h722kwqm-gcc-7.5.0-lib/lib/libevent_core-2.1.so.7 15220: trying file=3D/tmp/openmpi/gnu/store/libevent_core-2.1.so.7 15220: trying file=3D/tmp/openmpi/gnu/store/01b4w3m6mp55y531kyi1g8sh= h722kwqm-gcc-7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../libe= vent_core-2.1.so.7 15220: search path=3D/gnu/store/rm1d9z3z3iwsv779vqlg7q5z7pdk5k12-open= mpi-4.0.5/lib:/gnu/store/xk22b03jb0c0b6vkadqbkr9d4556rwxh-hwloc-2.2.0-lib/l= ib:/gnu/store/i1smdd4r44c5wwi03g40dvc6wfnqgdwq-libpciaccess-0.16/lib (RUNP= ATH from file /tmp/openmpi/gnu/store/rm1d9z3z3iwsv779vqlg7q5z7pdk5k12-openm= pi-4.0.5/bin//orterun) 15220: trying file=3D/gnu/store/rm1d9z3z3iwsv779vqlg7q5z7pdk5k12-ope= nmpi-4.0.5/lib/libevent_core-2.1.so.7 15220: trying file=3D/gnu/store/xk22b03jb0c0b6vkadqbkr9d4556rwxh-hwl= oc-2.2.0-lib/lib/libevent_core-2.1.so.7 15220: trying file=3D/gnu/store/i1smdd4r44c5wwi03g40dvc6wfnqgdwq-lib= pciaccess-0.16/lib/libevent_core-2.1.so.7 15220: search path=3D (system search path) 15220: search path=3D/gnu/store/rykm237xkmq7rl1p0nwass01p090p88x-zlib= -1.2.11/lib:/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/g= cc/x86_64-unknown-linux-gnu/7.5.0/../../../tls/haswell/x86_64:/gnu/store/01= b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/gcc/x86_64-unknown-linux-g= nu/7.5.0/../../../tls/haswell:/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-g= cc-7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../tls/x86_64:/gn= u/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/gcc/x86_64-unkno= wn-linux-gnu/7.5.0/../../../tls:/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm= -gcc-7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../haswell/x86_= 64:/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/gcc/x86_64= -unknown-linux-gnu/7.5.0/../../../haswell:/gnu/store/01b4w3m6mp55y531kyi1g8= shh722kwqm-gcc-7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../x8= 6_64:/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc-7.5.0-lib/lib/gcc/x86_= 64-unknown-linux-gnu/7.5.0/../../.. (RUNPATH from file /tmp/openmpi/gnu/st= ore/rm1d9z3z3iwsv779vqlg7q5z7pdk5k12-openmpi-4.0.5/bin//orterun) 15220: trying file=3D/gnu/store/rykm237xkmq7rl1p0nwass01p090p88x-zli= b-1.2.11/lib/libevent_core-2.1.so.7 15220: trying file=3D/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc= -7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../tls/haswell/x86_= 64/libevent_core-2.1.so.7 15220: trying file=3D/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc= -7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../tls/haswell/libe= vent_core-2.1.so.7 15220: trying file=3D/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc= -7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../tls/x86_64/libev= ent_core-2.1.so.7 15220: trying file=3D/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc= -7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../tls/libevent_cor= e-2.1.so.7 15220: trying file=3D/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc= -7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../haswell/x86_64/l= ibevent_core-2.1.so.7 15220: trying file=3D/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc= -7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../haswell/libevent= _core-2.1.so.7 15220: trying file=3D/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc= -7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../x86_64/libevent_= core-2.1.so.7 15220: trying file=3D/gnu/store/01b4w3m6mp55y531kyi1g8shh722kwqm-gcc= -7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../libevent_core-2.= 1.so.7 15220: search path=3D (system search path) --8<---------------cut here---------------end--------------->8--- IIUC, the only way a search path entry can =E2=80=9Cdisappear=E2=80=9D is i= f ld.so marks it as =E2=80=9Cnonexisting=E2=80=9D, as per dl-load.c: --8<---------------cut here---------------start------------->8--- if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)) _dl_debug_printf (" trying file=3D%s\n", buf); fd =3D open_verify (buf, -1, fbp, loader, whatcode, mode, found_other_class, false); if (this_dir->status[cnt] =3D=3D unknown) { if (fd !=3D -1) this_dir->status[cnt] =3D existing; /* Do not update the directory information when loading auditing code. We must try to disturb the program as little as possible. */ else if (loader =3D=3D NULL || GL(dl_ns)[loader->l_ns]._ns_loaded->l_auditing =3D=3D 0) { /* We failed to open machine dependent library. Let's test whether there is any directory at all. */ struct stat64 st; buf[buflen - namelen - 1] =3D '\0'; if (__xstat64 (_STAT_VER, buf, &st) !=3D 0 || ! S_ISDIR (st.st_mode)) /* The directory does not exist or it is no directory. */ this_dir->status[cnt] =3D nonexisting; else this_dir->status[cnt] =3D existing; } } --8<---------------cut here---------------end--------------->8--- Indeed, we can see =E2=80=98stat=E2=80=99 calls passed raw /gnu/store file = names from RUNPATH entries (instead of /tmp/fakechroot-test/gnu/store), suggesting that =E2=80=98la_objsearch=E2=80=99 didn=E2=80=99t have a chance to rewrite= them: --8<---------------cut here---------------start------------->8--- 18952 openat(AT_FDCWD, "/tmp/fakechroot-test/gnu/store/01b4w3m6mp55y531kyi1= g8shh722kwqm-gcc-7.5.0-lib/lib/gcc/x86_64-unknown-linux-gnu/7.5.0/../../../= libz.so.1", O_RDONLY|O_CLOEXEC) =3D -1 ENOENT (Dosiero a=C5=AD dosierujo ne= ekzistas) 18952 openat(AT_FDCWD, "/tmp/guix-exec-3Y7bac/gnu/store/rm1d9z3z3iwsv779vql= g7q5z7pdk5k12-openmpi-4.0.5/lib/libz.so.1", O_RDONLY|O_CLOEXEC) =3D -1 ENOE= NT (Dosiero a=C5=AD dosierujo ne ekzistas) 18952 openat(AT_FDCWD, "/tmp/guix-exec-3Y7bac/gnu/store/xk22b03jb0c0b6vkadq= bkr9d4556rwxh-hwloc-2.2.0-lib/lib/libz.so.1", O_RDONLY|O_CLOEXEC) =3D -1 EN= OENT (Dosiero a=C5=AD dosierujo ne ekzistas) 18952 openat(AT_FDCWD, "/tmp/guix-exec-3Y7bac/gnu/store/i1smdd4r44c5wwi03g4= 0dvc6wfnqgdwq-libpciaccess-0.16/lib/libz.so.1", O_RDONLY|O_CLOEXEC) =3D -1 = ENOENT (Dosiero a=C5=AD dosierujo ne ekzistas) 18952 openat(AT_FDCWD, "/tmp/guix-exec-3Y7bac/gnu/store/c7wscymmk379v16invi= 8m68f6v5c8gsv-libevent-2.1.11/lib/tls/haswell/x86_64/libz.so.1", O_RDONLY|O= _CLOEXEC) =3D -1 ENOENT (Dosiero a=C5=AD dosierujo ne ekzistas) 18952 stat("/gnu/store/c7wscymmk379v16invi8m68f6v5c8gsv-libevent-2.1.11/lib= /tls/haswell/x86_64", 0x7ffc99e48700) =3D -1 ENOENT (Dosiero a=C5=AD dosier= ujo ne ekzistas) 18952 openat(AT_FDCWD, "/tmp/guix-exec-3Y7bac/gnu/store/c7wscymmk379v16invi= 8m68f6v5c8gsv-libevent-2.1.11/lib/tls/haswell/libz.so.1", O_RDONLY|O_CLOEXE= C) =3D -1 ENOENT (Dosiero a=C5=AD dosierujo ne ekzistas) 18952 stat("/gnu/store/c7wscymmk379v16invi8m68f6v5c8gsv-libevent-2.1.11/lib= /tls/haswell", 0x7ffc99e48700) =3D -1 ENOENT (Dosiero a=C5=AD dosierujo ne = ekzistas) 18952 openat(AT_FDCWD, "/tmp/guix-exec-3Y7bac/gnu/store/c7wscymmk379v16invi= 8m68f6v5c8gsv-libevent-2.1.11/lib/tls/x86_64/libz.so.1", O_RDONLY|O_CLOEXEC= ) =3D -1 ENOENT (Dosiero a=C5=AD dosierujo ne ekzistas) 18952 stat("/gnu/store/c7wscymmk379v16invi8m68f6v5c8gsv-libevent-2.1.11/lib= /tls/x86_64", 0x7ffc99e48700) =3D -1 ENOENT (Dosiero a=C5=AD dosierujo ne e= kzistas) 18952 openat(AT_FDCWD, "/tmp/guix-exec-3Y7bac/gnu/store/c7wscymmk379v16invi= 8m68f6v5c8gsv-libevent-2.1.11/lib/tls/libz.so.1", O_RDONLY|O_CLOEXEC) =3D -= 1 ENOENT (Dosiero a=C5=AD dosierujo ne ekzistas) 18952 stat("/gnu/store/c7wscymmk379v16invi8m68f6v5c8gsv-libevent-2.1.11/lib= /tls", 0x7ffc99e48700) =3D -1 ENOENT (Dosiero a=C5=AD dosierujo ne ekzistas) 18952 openat(AT_FDCWD, "/tmp/guix-exec-3Y7bac/gnu/store/c7wscymmk379v16invi= 8m68f6v5c8gsv-libevent-2.1.11/lib/haswell/x86_64/libz.so.1", O_RDONLY|O_CLO= EXEC) =3D -1 ENOENT (Dosiero a=C5=AD dosierujo ne ekzistas) 18952 stat("/gnu/store/c7wscymmk379v16invi8m68f6v5c8gsv-libevent-2.1.11/lib= /haswell/x86_64", 0x7ffc99e48700) =3D -1 ENOENT (Dosiero a=C5=AD dosierujo = ne ekzistas) 18952 openat(AT_FDCWD, "/tmp/guix-exec-3Y7bac/gnu/store/c7wscymmk379v16invi= 8m68f6v5c8gsv-libevent-2.1.11/lib/haswell/libz.so.1", O_RDONLY|O_CLOEXEC) = =3D -1 ENOENT (Dosiero a=C5=AD dosierujo ne ekzistas) 18952 stat("/gnu/store/c7wscymmk379v16invi8m68f6v5c8gsv-libevent-2.1.11/lib= /haswell", 0x7ffc99e48700) =3D -1 ENOENT (Dosiero a=C5=AD dosierujo ne ekzi= stas) 18952 openat(AT_FDCWD, "/tmp/guix-exec-3Y7bac/gnu/store/c7wscymmk379v16invi= 8m68f6v5c8gsv-libevent-2.1.11/lib/x86_64/libz.so.1", O_RDONLY|O_CLOEXEC) = =3D -1 ENOENT (Dosiero a=C5=AD dosierujo ne ekzistas) 18952 stat("/gnu/store/c7wscymmk379v16invi8m68f6v5c8gsv-libevent-2.1.11/lib= /x86_64", 0x7ffc99e48700) =3D -1 ENOENT (Dosiero a=C5=AD dosierujo ne ekzis= tas) --8<---------------cut here---------------end--------------->8--- My guess is that after these =E2=80=98stat=E2=80=99 calls, the libevent dir= ectory is marked as non-existing and is skipped from then on, hence the failure. Does that make sense? The patch below fixes the issue for this particular example by simply passing the whole RUNPATH of the wrapped executable as =E2=80=98--library-p= ath=E2=80=99, as was the case in v1 of the patch set=C2=B9. (This assumes that the RUNPA= TH of pack-audit.so is a subset of that of the program, which is usually the case.) Thanks, Ludo=E2=80=99. =C2=B9 https://issues.guix.gnu.org/41189#3 --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 379e6a3ac6..6355b99252 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -820,8 +820,7 @@ last resort for relocation." (string-append "-DLOADER_AUDIT_RUNPATH={ " (string-join (map object->string - (runpath - #$(audit-module))) + (runpath program)) ", " 'suffix) "NULL }") (if gconv --=-=-=--