From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 6I4UH23b1GFZCgEAgWs5BA (envelope-from ) for ; Wed, 05 Jan 2022 00:42:37 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id IETFF23b1GEEHgAAG6o9tA (envelope-from ) for ; Wed, 05 Jan 2022 00:42:37 +0100 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 CB48045FCC for ; Wed, 5 Jan 2022 00:42:36 +0100 (CET) Received: from localhost ([::1]:56286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n4tRr-000514-VA for larch@yhetil.org; Tue, 04 Jan 2022 18:42:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n4tRK-0004wj-MT for bug-guix@gnu.org; Tue, 04 Jan 2022 18:42:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:55828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n4tRK-0000PU-CW for bug-guix@gnu.org; Tue, 04 Jan 2022 18:42:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n4tRK-0005D6-9d for bug-guix@gnu.org; Tue, 04 Jan 2022 18:42:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#25325: elogind does not set ACLs promptly Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 04 Jan 2022 23:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25325 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Chris Marusich Received: via spool by 25325-submit@debbugs.gnu.org id=B25325.164133969819966 (code B ref 25325); Tue, 04 Jan 2022 23:42:02 +0000 Received: (at 25325) by debbugs.gnu.org; 4 Jan 2022 23:41:38 +0000 Received: from localhost ([127.0.0.1]:39136 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4tQw-0005Bx-4e for submit@debbugs.gnu.org; Tue, 04 Jan 2022 18:41:38 -0500 Received: from mail-wr1-f43.google.com ([209.85.221.43]:46863) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n4tQu-0005Bj-IA for 25325@debbugs.gnu.org; Tue, 04 Jan 2022 18:41:37 -0500 Received: by mail-wr1-f43.google.com with SMTP id i22so79242794wrb.13 for <25325@debbugs.gnu.org>; Tue, 04 Jan 2022 15:41:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=0QUKrGzrzGQWz2/PrEvxjtnRMCpIJLhlnSBSIG7dCZQ=; b=Ie2L+nAnZKIGVsa76iniYdSYQ4WzhoyFbxIE4ANugPxo5ZAxna6u2wuPy1IwuAYIB6 14vYjbzmTRxTwdH1nOk7YYbhWb6KVfE49/z3kDgjLuZVqmYhqE9hZACVfjtsXI/ky8OQ X7NTS1Z/J67ReALiVee6ymKWQVJtttyZmyXprbTbKCn68mUCS6DLhYdak8ovQfMYBCmj taHvKYmjgKYIhs2Vy6Fd6Lev6jLkMkpw3a23Z5ZXJ+dN6EwW0FJKpedjK27ExA4YY2Qa q+SUbx7BQmpWXyQmmPyuH8KJD01ZJ1eFRD0oaKN+P0UH0PX39JJtPovsaXO+M02Bz2c6 Issg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=0QUKrGzrzGQWz2/PrEvxjtnRMCpIJLhlnSBSIG7dCZQ=; b=JAv/XQSp/gv2PH8Bo9xBq2LeAjD6f4H2SXEzVyG71osLN9YcvpBiwkQOMB+Vo+c4MV VL7yJaUimy2uvywXUgccc8X4ChCd3Oe1O5XDrMMRVgh/XL7RdagPcP+M2FtKBJITORFW JR13CcJBQwVcs1A4ma3MyqQGuxBlhBYGvglx0Oxxj+NFlxHnNuK6upMRrw4JN0wiIznX MxgrqC2yEg4QMtJd0Y584timPi7Lzooob9PegeZz9xj6JA+EI4FgBmTqwvbfyoTgsqOv +tBGwsZSJgLPt8VbzwvJAD2WH7eTyS7T0MCbA2NmE23kA7xqrePAWpifTcZTPBEOZDhy D5YA== X-Gm-Message-State: AOAM531VBJWzOvXDAKJH6YieAKNSAnJrbl0vmj8524BEfS988Qg5ATVJ 7heXRfEMb8LPREzGdHZmD+Mki1znO3k= X-Google-Smtp-Source: ABdhPJyJ40lHxPOLqRrHBroDMy73B8QTQVij9c68PtROOPPosRb2FevQJ4B3LFVQ5/9WHB33PUxtUQ== X-Received: by 2002:a5d:64c3:: with SMTP id f3mr43356560wri.295.1641339690711; Tue, 04 Jan 2022 15:41:30 -0800 (PST) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id m17sm898919wms.25.2022.01.04.15.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jan 2022 15:41:30 -0800 (PST) From: zimoun References: <87k2aewfo5.fsf@gmail.com> Date: Wed, 05 Jan 2022 00:37:58 +0100 In-Reply-To: <87k2aewfo5.fsf@gmail.com> (Chris Marusich's message of "Sun, 01 Jan 2017 14:58:50 -0800") Message-ID: <865yqzax7t.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: List-Subscribe: , Cc: 25325@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641339757; 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: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=0QUKrGzrzGQWz2/PrEvxjtnRMCpIJLhlnSBSIG7dCZQ=; b=NnDwHtOVi5yfgE/kMwgQkirV6k2wfBKcfLaAtZI9UJhqlaSIkA2keEfaG12WL/dx+EDxnd 5YvAUfzkKF3bUOslIQQ6Fqe2FhT6y7OdYYc4Shh20dFvRiIVMcs/+sXJWF+LzrUcJSSB4y +lt7f3ByZh5dpTd+WkzJoXXzjGOkmwWBMfp5GGFD2//CsQVL/bKrrTIlKaywkRivjc5kc+ Uyfrq1nQ+SI38GNfYL8snTst3bUJEnAlbJOhfLwjvjreXfHblSlQFal4eeP5KI7iTUj821 2oUEuBblJe9eEZF9l+aUqkwXi+riMyE5mPYO4PxJplmXjjztphqWSmyoO/tqqg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641339757; a=rsa-sha256; cv=none; b=Id8ROepc9MdeLAcWaNH6+HqJOqoPn3A4muMdz7VaZ9I1jYycBdh04TTCEBJCXApFLojxMg Uzk6QjpxZbkUOOAQbmsLtLEOZIn7W56rHQvYjHfQZxghC94O2YnqvgpvYfTwj6pO9MxC4L Ac4ClWc8e+mmwG0JK11Yr63OSaBEmRwnJcvRiYGhxFGFc8P6jwXt1wSK3UPcjqKL7GrUeA pbrRNLnGd/AMpc1wZAnDB7nfgxRurvVc6w20H0xtC5xWLMfwgupSp+GbqM8f18dl7kyMXB oxbDbQgWEP0juuvUkbNUPcrSSIg6+9sUnUSjx9HLIhua+cwb9UcK6uJ5G41yWA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Ie2L+nAn; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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" X-Migadu-Spam-Score: -1.99 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Ie2L+nAn; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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" X-Migadu-Queue-Id: CB48045FCC X-Spam-Score: -1.99 X-Migadu-Scanner: scn1.migadu.com X-TUID: o/iki+9ACyaK Hi Chris, I am doing some triage of old bug and I hit this one [1]. Since it is from 2017 and many things changed since then, is it still an issue? 1: On Sun, 01 Jan 2017 at 14:58, Chris Marusich wrote: > Please find attached a description of the bug, which came from the > following email thread: > > https://lists.gnu.org/archive/html/guix-devel/2016-12/msg01126.html > > From: Chris Marusich > Subject: Re: Let non-root users use MTP devices (Attempt #2) > To: ludo@gnu.org (Ludovic Court=C3=A8s) > Cc: guix-devel@gnu.org > Date: Thu, 29 Dec 2016 16:41:10 -0800 (5 years, 5 days, 16 hours ago) > > ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> Chris Marusich skribis: >> >>> Chris Marusich writes: >>> >>>> Here's a second attempt to fix MTP support for GuixSD. It's simple and >>>> requires no special group permissions. >>>> >>>> It turns out that elogind (like systemd's logind) can be compiled with >>>> support for ACLs (provided by libacl), in which case elogind will >>>> automatically set an ACL on a device file granting access to a user wh= en >>>> that user is logged in using a seat to which the device is attached. = In >>>> short, by adding acl as an input to elogind, users will be able to >>>> access devices without running programs as root, and without being a >>>> member of any special group. >>>> >>>> That's just one piece of the puzzle, though. The other piece is the >>>> udev rules provided by libmtp. It's necessary to install those udev >>>> rules; if we don't, then the MTP device won't be tagged properly, so >>>> elogind will not set any ACLs for it. I've chosen to install those >>>> rules by modifying the base services in desktop.scm so that all deskto= ps >>>> will get the rules, not just GNOME; if you know of a better way to >>>> install them, please let me know. >>>> >>>> This patch has a happy side effect. Namely: because elogind is now >>>> setting ACLs, it gives a user access to other devices that are attached >>>> to their seat. For instance, after this change, I can access /dev/kvm >>>> and /dev/cdrom (and other devices) without being root, and without bei= ng >>>> in any special group. How nice! >>> >>> After sending this, I've noticed something odd: sometimes, it can take >>> quite a while for elogind to set the ACLs. It's a bit of a mystery to >>> me. I'm not sure how/when elogind decides to update the ACLs; I assumed >>> it was continuously checking for changes in the hardware or receiving >>> notifications about hardware changes, but it seems like elogind isn't >>> noticing when I plug in my phone. Even though the device file shows up, >>> elogind doesn't set the ACLs unless I do something. >>> >>> By "do something," I mean: Apparently, logging out and logging back in >>> seems to trigger elogind to set the ACLs. Even just switching virtual >>> terminals (i.e., Control + F1, followed by Control + F7) seems to >>> trigger it, which is weird. Even when elogind has not yet set the ACLs, >>> the "uaccess" tag has in fact been correctly set for the device (as >>> reported by e.g. "udevadm info /dev/libmtp-1-1"), which leads me to >>> suspect that elogind is either failing to notice or just ignoring the >>> hardware change. I wonder if this might be a bug of some kind. >>> >>> What do you think we should do? >> >> Good question! I don=E2=80=99t know. Does this happen only for MTP dev= ices or >> also with other things (KVM?)? > > Yes, this happens for other devices, too. For example, I observe > exactly the same behavior for /dev/sr0 when I plug in an external CD-ROM > drive (via USB cable) after logging in. The ACL doesn't get set until > after I do something like switch to another virtual terminal and back. > >> Does =E2=80=9Cudevadm settle=E2=80=9D trigger the ACL change? > > No, neither "udevadm settle" nor "sudo udevadm settle" triggers the ACL > change. I suspect that maybe elogind is ignoring or failing to notice > the new device, or perhaps the mechanism that elogind relies on to learn > about new devices is not working for some reason. > > It looks like elogind sets the ACLs via devnode_acl_all, defined in > src/login/logind-acl.c. Ultimately it seems this gets called while in > seat_set_active (specifically, invoked at src/login/logind-seat.c:213), > under certain conditions. That's as far as I got. > > I cannot reproduce this issue on Ubuntu; there, the ACL gets set > promptly. Cheers, simon