From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 08 04:24:50 2021 Received: (at 50945) by debbugs.gnu.org; 8 Nov 2021 09:24:50 +0000 Received: from localhost ([127.0.0.1]:56323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mk0tW-0004UC-1X for submit@debbugs.gnu.org; Mon, 08 Nov 2021 04:24:50 -0500 Received: from mail-lj1-f176.google.com ([209.85.208.176]:44625) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mk0tR-0004Tu-Uv for 50945@debbugs.gnu.org; Mon, 08 Nov 2021 04:24:48 -0500 Received: by mail-lj1-f176.google.com with SMTP id 13so10301572ljj.11 for <50945@debbugs.gnu.org>; Mon, 08 Nov 2021 01:24:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop-in.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=4dcvY6EjAPgL4ZhyR2FDSa+6/f4Xt/H9c34M7w3mDzw=; b=7WV4UnXCJRGZl49rObI3jr+5f/zDyvoK2ccoqxjplvGVz09hJsVuPZx6xBQJEbrCnI y8mrMhVsE+PoT/OyP3X+qckvDAfXFyhec4+4509I9Drq+n/90l71cuHDseGPBU0GaYND YMLwNh4Q9o0T0ssSfXa4egYPlEigEKZVT0c4YGrQYYSPoE7vAxmmwtluEey6IazQWlBo +nQLISoMFov7k1bNB93ZxFnsJhdep1tp1OWlY4dBgD3k8+g1HXeK/Ezk+QZYQiQUfabg HfPU3sec65spXZYHIn1+Xc9B2UVoeckn0ZIBW0wRvaoLhYyRnyWgZBAyX56hP0W1jeCK MGVg== 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:in-reply-to:references:date :message-id:mime-version; bh=4dcvY6EjAPgL4ZhyR2FDSa+6/f4Xt/H9c34M7w3mDzw=; b=MJ8fSmKY9XARxLyBVjun7r5bIWneh9Oh3qSR8GDbBGv07wGZ1jXmR9ZYmYKDBXLtYA iYI5zyuY9VoFLNVQ9Yhd8/+PXHSgBG0WLu2azzsFCvQJOPptWGdYPFDpURRm8hvG4J/Y GmMl7uwW8JKbQqw4E+9zmjZwqRyAliNXJ9L/oOGMrBohi0+5VA0Ep1/zlJo8Nm3U6LBI KXpvanX6RQRo7FH2yTW4AcYKekoyr3scKX+vh9VBLDfqIza2sZshPJuPjdqk6eSEIXfP H3Daq8ItZmQFrab208yaXcCUqZZS+Z72zJyGRXroHZbkmkQhFHzI7CuWT8aB/b4H78FI uvng== X-Gm-Message-State: AOAM530216qbumTB9TGaOBxXpsrsRuEWX4U/gKWWlFHxYaXCWe5eig4h ujb93p+N4dV+FuELMBWm2g4dcQ== X-Google-Smtp-Source: ABdhPJzRj5Pq/1ZyM7b3j73q0nP91WEwFmhdAxFYzn6lnhw+8Jd4MkoU7JT/dc2NFeY5py9dIg2L9w== X-Received: by 2002:a2e:3c18:: with SMTP id j24mr59506064lja.252.1636363479903; Mon, 08 Nov 2021 01:24:39 -0800 (PST) Received: from localhost (109-252-141-7.dynamic.spd-mgts.ru. [109.252.141.7]) by smtp.gmail.com with ESMTPSA id g26sm89384ljn.107.2021.11.08.01.24.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Nov 2021 01:24:39 -0800 (PST) From: Andrew Tropin To: Oleg Pykhalov , Xinglu Chen Subject: Re: bug#50945: Guix home: No such file or directory: "/run/user/1003/on-first-login-executed" In-Reply-To: <87ee7u4k0a.fsf@disroot.org> References: <87y27czr0v.fsf@gnu.org> <871r4xwgtn.fsf@trop.in> <87ee7u4k0a.fsf@disroot.org> Date: Mon, 08 Nov 2021 12:24:35 +0300 Message-ID: <87o86vgfu4.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 50945 Cc: 50945@debbugs.gnu.org, Jan Nieuwenhuizen X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2021-11-05 17:58, Xinglu Chen wrote: > Hi, > > On Thu, Oct 07 2021, Andrew Tropin wrote: > >> On 2021-10-01 17:46, Jan Nieuwenhuizen wrote: >> >>> Hi, >>> >>> When using su or sudo to enter an account managed by guix home, I get >>> this error >>> >>> --8<---------------cut here---------------start------------->8--- >>> Backtrace: >>> 2 (primitive-load "/home/guix/.guix-home/on-first-login") >>> In ice-9/ports.scm: >>> 461:11 1 (call-with-output-file "/run/user/1003/on-first-login-=E2= =80=A6" =E2=80=A6) >>> In unknown file: >>> 0 (open-file "/run/user/1003/on-first-login-executed" "w" = =E2=80=A6) >>> >>> ERROR: In procedure open-file: >>> In procedure open-file: No such file or directory: "/run/user/1003/on-f= irst-login-executed" >>> --8<---------------cut here---------------end--------------->8--- >>> >>> [...] >> >> Thank you for a very detailed report. >> >> pam_elogind doesn't create a session, when the login shell spawned by >> sudo or su =3D> XDG_RUNTIME_DIR not get created =3D> this message appear= s. >> >> I think we can omit execution of any processes by on-first-login script >> in case session wasn't created. Added the check: >> >> From aab6df0298963fe91a6ebfd1dadbc1530eceeff7 Mon Sep 17 00:00:00 2001 >> From: Andrew Tropin >> Date: Thu, 7 Oct 2021 08:12:04 +0300 >> Subject: [PATCH] home-services: on-first-login: Check if XDG_RUNTIME_DIR >> exists. >> >> * gnu/home-services.scm (on-first-login): on-first-login won't execute >> anything if XDG_RUNTIME_DIR doesn't exists. >> --- >> gnu/home-services.scm | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/gnu/home-services.scm b/gnu/home-services.scm >> index 9f1e986616..0b77a1321d 100644 >> --- a/gnu/home-services.scm >> +++ b/gnu/home-services.scm >> @@ -286,8 +286,11 @@ will be put in @file{~/.guix-home/files}."))) >> ;; XDG_RUNTIME_DIR dissapears on logout, that means such trick >> ;; allows to launch on-first-login script on first login only >> ;; after complete logout/reboot. >> - (when (not (file-exists? flag-file-path)) >> - (begin #$@gexps (touch flag-file-path)))))) >> + (if (file-exists? xdg-runtime-dir) >> + (when (not (file-exists? flag-file-path)) > > Use (unless =E2=80=A6) instead of (when (not =E2=80=A6)=E2=80=A6). > >> + (begin #$@gexps (touch flag-file-path))) >> + (display "XDG_RUNTIME_DIR doesn't exists, the session wasn't >> +created, on-first-login script won't execute anything."))))) > > It would be good to tell the user how they could manually run the > script, that way they could manually set/create $XDG_RUNTIME_DIR and run > the script. > > "XDG_RUNTIME_DIR doesn't exist; the 'on-first-login' script won't > execute anything. You can manually execute the script by running > '$HOME/.guix-home/on-first-login' > > WDYT? Addressed suggestions, attaching updated patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-home-services-on-first-login-Check-if-XDG_RUNTIME_DI.patch Content-Transfer-Encoding: quoted-printable From=208b924b02ab917632047d6653f19d9b16175989bf Mon Sep 17 00:00:00 2001 From: Andrew Tropin Date: Thu, 7 Oct 2021 08:12:04 +0300 Subject: [PATCH] home-services: on-first-login: Check if XDG_RUNTIME_DIR exists. * gnu/home-services.scm (on-first-login): on-first-login won't execute anything if XDG_RUNTIME_DIR doesn't exists. =2D-- gnu/home/services.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 5c9b743f7b..1e295b6afe 100644 =2D-- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -286,8 +286,13 @@ (define (compute-on-first-login-script _ gexps) ;; XDG_RUNTIME_DIR dissapears on logout, that means such trick ;; allows to launch on-first-login script on first login only ;; after complete logout/reboot. =2D (when (not (file-exists? flag-file-path)) =2D (begin #$@gexps (touch flag-file-path)))))) + (if (file-exists? xdg-runtime-dir) + (unless (file-exists? flag-file-path) + (begin #$@gexps (touch flag-file-path))) + (display "XDG_RUNTIME_DIR doesn't exists, on-first-login script +won't execute anything. You can check if xdg runtime directory exists, +XDG_RUNTIME_DIR variable is set to apropriate value and manually execute t= he +script by running '$HOME/.guix-home/on-first-login'"))))) =20 (define (on-first-login-script-entry m-on-first-login) "Return, as a monadic value, an entry for the on-first-login script =2D-=20 2.33.0 --=-=-= Content-Type: text/plain Also, added a note about elogind/XDG_RUNTIME_DIR to manual. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-doc-Add-a-note-about-elogind-and-XDG_RUNTIME_DIR-for.patch Content-Transfer-Encoding: quoted-printable From=20f5d35fd4f542a11226c0159ee32498e374ff40a2 Mon Sep 17 00:00:00 2001 From: Andrew Tropin Date: Mon, 8 Nov 2021 12:22:04 +0300 Subject: [PATCH] doc: Add a note about elogind and XDG_RUNTIME_DIR for Guix Home. * doc/guix.texi (Declaring the Home Environment): Add a note about elogind = and XDG_RUNTIME_DIR. =2D-- doc/guix.texi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 3355a535ad..36437cf161 100644 =2D-- a/doc/guix.texi +++ b/doc/guix.texi @@ -35916,6 +35916,13 @@ guix home reconfigure config.scm This ``builds'' your home environment and creates @file{~/.guix-home} pointing to it. Voil=C3=A0! =20 +@quotation=20 +Ensure that operating system has elogind or any other mechanism, which +creates xdg runtime directory and sets @env{XDG_RUNTIME_DIR} variable. +Otherwise, @file{on-first-login} script won't execute anything, and +process like userland Shepherd and its descendants won't start. +@end quotation + @node Configuring the Shell @section Configuring the Shell This section is safe to skip if your shell or shells are managed by =2D-=20 2.33.0 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Oleg, please apply it if it looks good. =2D-=20 Best regards, Andrew Tropin --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmGI7NMACgkQIgjSCVjB 3rAbfw/+LytNQu+aIiMgrUK3tiCecllYPTaTiuT5wJJGaSBdoePgy3q3EYFCINt0 ViyKK+/+3rhMSmr19cbPhCax9i+aWGUpO9eIlHPLqwgawDljB3wWEKvMHb6EOIMB YCVfQLXFCAyEmj8F8wjyPCaJUtabctMrNdI/fo3OKyIyPPJmsaAgs/HbCx9pJ2Bp VzbkXyOzC5QyPdZOb/zZN1PxQ3LtHp7VoNciyPqIFIYq3EVIT7gJMyBxyK/JLaMq BH9VaATHpz+60fn28EqSz/5DeiQjv0U3M3ocvWKZAV2W3zj+xnc/Aer8RZs3U5yB Zy2VIlacIdN2ozgrwWRpe5WVtWRDnxH+wiP2jgFF5G8JyDVjLvJEvKhZLLGCkn1r cBzfI4ns46+0fvyWr0c7HstRZc1NIV4m/yOr2/REuF7bilPqGHh6NiEPtruqQhdc 7vgvJ8Yu/40OHlpYU9oheTw91SJqBn5XQ2XglL87u0UzFJK0SZD0jpn8XcphvWcA bICKDeDtAfCAQLfqWlIagaFg/WkLe6GGau+cAOEWTgHXPwEYpexe1RNFRcTuzLRd tXm/7KFVmAPdlSfhl8f8EqoyNInHEp/1WlAUYdbQKt2zmNo9YCgWV+7a4PUOtqQ9 ENWR1Ya1egVgKyknOLsC2JqLvvrtkTSivqXH0+db7emL67TGp0Y= =0e5H -----END PGP SIGNATURE----- --==-=-=--