From: Andrew Tropin <andrew@trop.in>
To: Oleg Pykhalov <go.wigust@gmail.com>, Xinglu Chen <public@yoctocell.xyz>
Cc: 50945@debbugs.gnu.org
Subject: bug#50945: Guix home: No such file or directory: "/run/user/1003/on-first-login-executed"
Date: Mon, 08 Nov 2021 12:24:35 +0300 [thread overview]
Message-ID: <87o86vgfu4.fsf@trop.in> (raw)
In-Reply-To: <87ee7u4k0a.fsf@disroot.org>
[-- Attachment #1.1: Type: text/plain, Size: 2995 bytes --]
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-…" …)
>>> In unknown file:
>>> 0 (open-file "/run/user/1003/on-first-login-executed" "w" …)
>>>
>>> ERROR: In procedure open-file:
>>> In procedure open-file: No such file or directory: "/run/user/1003/on-first-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 => XDG_RUNTIME_DIR not get created => this message appears.
>>
>> 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 <andrew@trop.in>
>> 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 …) instead of (when (not …)…).
>
>> + (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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-home-services-on-first-login-Check-if-XDG_RUNTIME_DI.patch --]
[-- Type: text/x-patch, Size: 1550 bytes --]
From 8b924b02ab917632047d6653f19d9b16175989bf Mon Sep 17 00:00:00 2001
From: Andrew Tropin <andrew@trop.in>
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 | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/gnu/home/services.scm b/gnu/home/services.scm
index 5c9b743f7b..1e295b6afe 100644
--- 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.
- (when (not (file-exists? flag-file-path))
- (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 the
+script by running '$HOME/.guix-home/on-first-login'")))))
(define (on-first-login-script-entry m-on-first-login)
"Return, as a monadic value, an entry for the on-first-login script
--
2.33.0
[-- Attachment #1.3: Type: text/plain, Size: 62 bytes --]
Also, added a note about elogind/XDG_RUNTIME_DIR to manual.
[-- Attachment #1.4: 0001-doc-Add-a-note-about-elogind-and-XDG_RUNTIME_DIR-for.patch --]
[-- Type: text/x-patch, Size: 1150 bytes --]
From f5d35fd4f542a11226c0159ee32498e374ff40a2 Mon Sep 17 00:00:00 2001
From: Andrew Tropin <andrew@trop.in>
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.
---
doc/guix.texi | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/doc/guix.texi b/doc/guix.texi
index 3355a535ad..36437cf161 100644
--- 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à!
+@quotation
+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
--
2.33.0
[-- Attachment #1.5: Type: text/plain, Size: 80 bytes --]
Oleg, please apply it if it looks good.
--
Best regards,
Andrew Tropin
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2021-11-08 9:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-01 15:46 bug#50945: Guix home: No such file or directory: "/run/user/1003/on-first-login-executed" Jan Nieuwenhuizen
2021-10-01 17:05 ` Xinglu Chen
2021-10-07 5:21 ` Andrew Tropin
2021-11-05 16:58 ` Xinglu Chen
2021-11-08 9:24 ` Andrew Tropin [this message]
2021-11-14 22:11 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o86vgfu4.fsf@trop.in \
--to=andrew@trop.in \
--cc=50945@debbugs.gnu.org \
--cc=go.wigust@gmail.com \
--cc=public@yoctocell.xyz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).