From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id 4EddFs7BIWR7VQEASxT56A (envelope-from ) for ; Mon, 27 Mar 2023 18:18:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id aIl/Fs7BIWRRGgAA9RJhRA (envelope-from ) for ; Mon, 27 Mar 2023 18:18:22 +0200 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 028141B96E for ; Mon, 27 Mar 2023 18:18:21 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=inria.fr header.s=dc header.b=m92H63fu; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=inria.fr (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679933902; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe: list-post:dkim-signature; bh=E/UujCyRnh065P/cJ4YguNyYqBOp8KYk0V+ZV0/DxDM=; b=c4mdwFttoeoopEbgq3jUQqheRula0t1snwQZXq15e+jp3FyKfT/mQR8BNr2ViJCJ4x0ipN 7hXIX7u5DgO2S2+Wfk/V7x62TBEpAsAHpQQVe7JYzF27N2w5qn2En6U/UxJnEa7PNfqSeb z0pOxSFYHS+m0j5Us0Z5a9aZN4fuqD4kqHf0q3TRgsZz5WSzDGSOvMs4ykaF3u+C4cUANg zW8ajPAmX8IMeec6G+Mc2Thr7mfaMIuO9Gna5BbDiBr/3THxSL+KiGa0R5nTaZY0eIb+OJ ETqLsN7TK2vIHcY3BApSbCfaEgj6wj0dnYFIDHcMSBZtezYI2CWBWm7DfiVNpQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679933902; a=rsa-sha256; cv=none; b=l8OiLDVQHCTZSjamkRT4foioQNk+hmKpbMUclWzdBn+Kt/vBdpKQFAyWQgl7BqUmx7+HIZ i858PRp4+jbx1XII2KUOJ3FJs0lJStrr9rd+2MeXRkoIwvJtsGDpLEN3GCnvEfxmTmdnCs 2u1G2lyCHagRRGIyzNVbnODrmsV7A5c5xG46SnpC7g02FO2LGBET0ejghPLhuBNgMjROid wTKalbpSeuzlJIYtKDHI8o11m/YUY0b8IypcuwXQlxBQ0rG+Be5Pg8z0b8CIhZzb817wSX bCkIAKeBn5eQy6YqpMZaiFVNLzNcIC3WeskKrnOhZ4WQwIfx5EuzcD1ku12fnw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=inria.fr header.s=dc header.b=m92H63fu; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=inria.fr (policy=none) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pgpXp-000088-4r; Mon, 27 Mar 2023 12:18:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgpXn-0008Py-Ax for bug-guix@gnu.org; Mon, 27 Mar 2023 12:18:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pgpXn-0007qG-2M for bug-guix@gnu.org; Mon, 27 Mar 2023 12:18:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pgpXm-0003gA-9v; Mon, 27 Mar 2023 12:18:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#62487: guix-daemon fails on SELinux/systemd distros Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: rekado@elephly.net, bug-guix@gnu.org Resent-Date: Mon, 27 Mar 2023 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62487 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 62487@debbugs.gnu.org Cc: Ricardo Wurmus X-Debbugs-Original-To: bug-guix@gnu.org X-Debbugs-Original-Xcc: Ricardo Wurmus Received: via spool by submit@debbugs.gnu.org id=B.167993384514092 (code B ref -1); Mon, 27 Mar 2023 16:18:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Mar 2023 16:17:25 +0000 Received: from localhost ([127.0.0.1]:48278 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgpXB-0003fD-DI for submit@debbugs.gnu.org; Mon, 27 Mar 2023 12:17:25 -0400 Received: from lists.gnu.org ([209.51.188.17]:57334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pgpX9-0003f5-JV for submit@debbugs.gnu.org; Mon, 27 Mar 2023 12:17:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgpX5-0006jH-Ah for bug-guix@gnu.org; Mon, 27 Mar 2023 12:17:21 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pgpX1-0007b3-Ek for bug-guix@gnu.org; Mon, 27 Mar 2023 12:17:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:subject:date:message-id:mime-version; bh=E/UujCyRnh065P/cJ4YguNyYqBOp8KYk0V+ZV0/DxDM=; b=m92H63fuonzWuZeMuSYq2GE6BjfxaleAjO/pc+hkX+HJYMeThX7UOfcE 47wCCfgRZJxUUOB2xZFdrFuBDXOvjF+rZO2BYikS+q+5lj2jaOS0GTvQT hST46FyRWnjXF9xNsaDWCZ/EAARpmUItMCgjXgu90WZ5lf78mLnrzQxFu Q=; X-IronPort-AV: E=Sophos;i="5.98,295,1673910000"; d="scan'208";a="99368628" Received: from unknown (HELO ribbon) ([193.50.110.81]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2023 18:16:45 +0200 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Septidi 7 Germinal an 231 de la =?UTF-8?Q?R=C3=A9volution, ?= jour du Bouleau X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 27 Mar 2023 18:16:45 +0200 Message-ID: <87a5zygoeq.fsf@inria.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=192.134.164.83; envelope-from=ludovic.courtes@inria.fr; helo=mail2-relais-roc.national.inria.fr X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: X-Migadu-Queue-Id: 028141B96E X-Spam-Score: -1.53 X-Migadu-Spam-Score: -1.53 X-Migadu-Scanner: scn0.migadu.com List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-TUID: mlC/Y3aoNX1Z --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello! Running guix-daemon on an SELinux distro is difficult and sparsely documented (info "(guix) SELinux Support"). On-line fora are full of questions on this topic and sometimes random advice. I thought we could improve on that by having =E2=80=98guix-install.sh=E2=80= =99 take care of most things dynamically and documenting any remaining bits with copy/pastable snippets. The attached patch does 90% of the job! I tested it on the Rocky Linux 9 live image available at: https://dl.rockylinux.org/pub/rocky/9/live/x86_64/Rocky-9-Workstation-Lit= e-x86_64-latest.iso The missing 10% related to the =E2=80=98gnu-store.mount=E2=80=99 job: guix-= daemon fails to remount it read-write: --8<---------------cut here---------------start------------->8--- # guix build hello guix build: error: remounting /gnu/store writable: Permission denied # ausearch -c guix-daemon | tail time->Mon Mar 27 12:01:38 2023 type=3DPROCTITLE msg=3Daudit(1679932898.081:464): proctitle=3D2F7661722F677= 569782F70726F66696C65732F7065722D757365722F726F6F742F63757272656E742D677569= 782F62696E2F677569782D6461656D6F6E00333830320000000000000000000000000000000= 0000000000000000000002D2D646973636F7665723D6E6F type=3DSYSCALL msg=3Daudit(1679932898.081:464): arch=3Dc000003e syscall=3D1= 65 success=3Dno exit=3D-13 a0=3D0 a1=3D4c5c10 a2=3D49f442 a3=3D1020 items= =3D0 ppid=3D3258 pid=3D3805 auid=3D4294967295 uid=3D0 gid=3D0 euid=3D0 suid= =3D0 fsuid=3D0 egid=3D0 sgid=3D0 fsgid=3D0 tty=3D(none) ses=3D4294967295 co= mm=3D"guix-daemon" exe=3D"/gnu/store/5kj8lyybjrdl7xd0fx9g9vzkz8sklqsy-guix-= 1.4.0/bin/guix-daemon" subj=3Dsystem_u:system_r:guix_daemon.guix_daemon_t:s= 0 key=3D(null) type=3DAVC msg=3Daudit(1679932898.081:464): avc: denied { remount } for = pid=3D3805 comm=3D"guix-daemon" scontext=3Dsystem_u:system_r:guix_daemon.gu= ix_daemon_t:s0 tcontext=3Dsystem_u:object_r:fs_t:s0 tclass=3Dfilesystem per= missive=3D0 --8<---------------cut here---------------end--------------->8--- It works fine (as in: =E2=80=98guix build hello=E2=80=99 succeeds) if I =E2= =80=98systemctl stop guix-daemon.service=E2=80=99 and instead run: guix-daemon --build-users-group=3Dguixbuild in the terminal. Could it be a systemd feature at play here? As a stopgap, we could change =E2=80=98guix-install.sh=E2=80=99 to not inst= all =E2=80=98gnu-store.mount=E2=80=99 on SELinux systems. Thoughts? Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/etc/guix-install.sh b/etc/guix-install.sh index ea10f35250..1e6d5285f7 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -599,6 +599,22 @@ fi _msg "${PAS}Bash shell prompt successfully customized for Guix" } +sys_maybe_setup_selinux() +{ + if [ -f /sys/fs/selinux/policy ] + then + prompt_yes_no "Install SELinux policy required to run guix-daemon?" \ + || return + + local var_guix=/var/guix/profiles/per-user/root/current-guix + semodule -i "${var_guix}/share/selinux/guix-daemon.cil" + restorecon -R /gnu /var/guix + # chcon -R -t guix_daemon.guix_daemon_conf_t /var/guix/ + # chcon -R -t guix_daemon.guix_profiles_t /var/guix/profiles/per-user/root/current-guix + # chcon -R -t guix_daemon.guix_profiles_t /var/guix/profiles/per-user/root/current-guix-1-link + fi +} + welcome() { local char @@ -674,6 +690,7 @@ main() sys_create_store "${GUIX_BINARY_FILE_NAME}" "${tmp_path}" sys_create_build_user + sys_maybe_setup_selinux sys_enable_guix_daemon sys_authorize_build_farms sys_create_init_profile --=-=-=--