From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Enge Subject: Creating user profiles Date: Sun, 13 Jan 2013 14:23:36 +0100 Message-ID: <201301131423.36130.andreas@enge.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="Boundary-01=_YVr8Qkt3tjzu+j4" Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:50394) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuNXR-0007lS-Ug for bug-guix@gnu.org; Sun, 13 Jan 2013 08:23:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TuNXK-00078o-92 for bug-guix@gnu.org; Sun, 13 Jan 2013 08:23:49 -0500 Received: from moutng.kundenserver.de ([212.227.17.10]:56140) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuNXJ-00078h-VJ for bug-guix@gnu.org; Sun, 13 Jan 2013 08:23:42 -0500 List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: bug-guix@gnu.org --Boundary-01=_YVr8Qkt3tjzu+j4 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Following the commit: commit b9e5c0a949fa627da55ea53fd71dfa96ad8a2b4b guix-package: Create ~/.guix-profile when it doesn't exist. I finally dropped giving the explicit profile parameter to guix-package. This results in the following error when installing a package: Backtrace: In ice-9/boot-9.scm: 149: 12 [catch #t # ...] 157: 11 [#] In unknown file: ?: 10 [catch-closure] In ice-9/boot-9.scm: 63: 9 [call-with-prompt prompt0 ...] In ice-9/eval.scm: 407: 8 [eval # #] In unknown file: ?: 7 [call-with-input-string "(apply (module-ref (resolve-interface '(guix-package)) 'guix-package) (cdr (command-line)))" ...] In ice-9/command-line.scm: 174: 6 [# #] In unknown file: ?: 5 [eval (apply (module-ref # #) (cdr #)) #] In ice-9/boot-9.scm: 149: 4 [catch srfi-34 # ...] 157: 3 [#] In /usr/local/bin/guix-package: 475: 2 [#] 409: 1 [process-actions (# #)] In unknown file: ?: 0 [symlink "/nix/store/g4bnzikcjgdcgmcj7by815wb9ykz470l-user- environment" ...] In fact, a symbolic link $HOME/.guix-profile is created to the non-existing file /usr/local/guix-git/var/nix/profiles/per-user/privat/guix-profile (where /usr/local/guix-git/ is my installation prefix). The user environment /nix/store/g4bnzikcjgdcgmcj7by815wb9ykz470l-user- environment exists in the nix store. I think the problem is that only the directory /usr/local/guix- git/var/nix/profiles exists, but that it is empty; maybe one should first create the directory $PREFIX/var/nix/profiles/per-user/$USER if it does not exist yet? Andreas --Boundary-01=_YVr8Qkt3tjzu+j4 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: 7bit

Following the commit:

commit b9e5c0a949fa627da55ea53fd71dfa96ad8a2b4b

guix-package: Create ~/.guix-profile when it doesn't exist.

 

I finally dropped giving the explicit profile parameter to guix-package. This results in the following error when installing a package:

 

Backtrace:

In ice-9/boot-9.scm:

149: 12 [catch #t #<catch-closure 12f39c0> ...]

157: 11 [#<procedure 128f0f0 ()>]

In unknown file:

?: 10 [catch-closure]

In ice-9/boot-9.scm:

63: 9 [call-with-prompt prompt0 ...]

In ice-9/eval.scm:

407: 8 [eval # #]

In unknown file:

?: 7 [call-with-input-string "(apply (module-ref (resolve-interface '(guix-package)) 'guix-package) (cdr (command-line)))" ...]

In ice-9/command-line.scm:

174: 6 [#<procedure 120e2a0 at ice-9/command-line.scm:169:3 (port)> #<input: string 10b60d0>]

In unknown file:

?: 5 [eval (apply (module-ref # #) (cdr #)) #<directory (guile-user) 12f5d80>]

In ice-9/boot-9.scm:

149: 4 [catch srfi-34 #<procedure 1290c40 at guix/ui.scm:71:2 ()> ...]

157: 3 [#<procedure 1753870 ()>]

In /usr/local/bin/guix-package:

475: 2 [#<procedure 13b8c60 at /usr/local/bin/guix-package:468:4 ()>]

409: 1 [process-actions (# #)]

In unknown file:

?: 0 [symlink "/nix/store/g4bnzikcjgdcgmcj7by815wb9ykz470l-user-environment" ...]

 

In fact, a symbolic link $HOME/.guix-profile is created to the non-existing file /usr/local/guix-git/var/nix/profiles/per-user/privat/guix-profile (where /usr/local/guix-git/ is my installation prefix).

 

The user environment /nix/store/g4bnzikcjgdcgmcj7by815wb9ykz470l-user-environment exists in the nix store.

 

I think the problem is that only the directory /usr/local/guix-git/var/nix/profiles exists, but that it is empty; maybe one should first create the directory $PREFIX/var/nix/profiles/per-user/$USER if it does not exist yet?

 

Andreas

 

--Boundary-01=_YVr8Qkt3tjzu+j4-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Creating user profiles Date: Sun, 13 Jan 2013 23:05:37 +0100 Message-ID: <87libwrb66.fsf@gnu.org> References: <201301131423.36130.andreas@enge.fr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:44765) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuVgY-0005W1-A4 for bug-guix@gnu.org; Sun, 13 Jan 2013 17:05:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TuVgS-00052H-CJ for bug-guix@gnu.org; Sun, 13 Jan 2013 17:05:46 -0500 Received: from mail4-relais-sop.national.inria.fr ([192.134.164.105]:64155) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuVgS-000524-0R for bug-guix@gnu.org; Sun, 13 Jan 2013 17:05:40 -0500 In-Reply-To: <201301131423.36130.andreas@enge.fr> (Andreas Enge's message of "Sun, 13 Jan 2013 14:23:36 +0100") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Andreas Enge Cc: bug-guix@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello! Andreas Enge skribis: > I think the problem is that only the directory /usr/local/guix- > git/var/nix/profiles exists, but that it is empty; maybe one should first= =20 > create the directory $PREFIX/var/nix/profiles/per-user/$USER if it does n= ot=20 > exist yet? Right, good point. (Apparently Nix=E2=80=99s manual doesn=E2=80=99t mentio= n it either.) So here=E2=80=99s what I would do: --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable --- a/doc/guix.texi +++ b/doc/guix.texi @@ -233,6 +233,16 @@ The @code{guix-daemon} program may then be run as @cod= e{root} with: # guix-daemon --build-users-group=3Dguix-builder @end example =20 +In such a multi-user setup, @dfn{user profiles}---i.e., the set of +user-installed packages as seen by @command{guix-package} +(@pxref{Invoking guix-package})---must be stored in a place registered +as a @dfn{garbage-collector root}. That directory is normally +@code{@var{localstatedir}/profiles/per-user/@var{user}}, where +@var{localstatedir} is the value passed to @code{configure} as +@code{--localstatedir}, and @var{user} is the user name. This directory +must be created by @code{root}, with @var{user} as the owner. When it +does not exist, @command{guix-package} emits an error about it. + Guix may also be used in a single-user setup, with @command{guix-daemon} running as a unprivileged user. However, to maximize non-interference of build processes, the daemon still needs to perform certain operations diff --git a/guix-package.in b/guix-package.in index 450d09e..ec09cc4 100644 --- a/guix-package.in +++ b/guix-package.in @@ -36,6 +36,7 @@ exec ${GUILE-@GUILE@} -L "@guilemoduledir@" -l "$0" \ #:use-module (guix packages) #:use-module (guix utils) #:use-module (guix config) + #:use-module ((guix build utils) #:select (directory-exists?)) #:use-module (ice-9 ftw) #:use-module (ice-9 format) #:use-module (ice-9 match) @@ -465,6 +466,25 @@ Install, remove, or upgrade PACKAGES in a single trans= action.\n")) (not (file-exists? %user-environment-directory))) (symlink %current-profile %user-environment-directory)) =20 + ;; Attempt to create /=E2=80=A6/profiles/per-user/$USER if needed. + (unless (or (not (equal? (assoc-ref opts 'profile) %current-profile)) + (directory-exists? %profile-directory)) + (catch 'system-error + (lambda () + (mkdir %profile-directory)) + (lambda args + ;; Often, we cannot create %PROFILE-DIRECTORY because its + ;; parent directory is root-owned and we're running + ;; unprivileged. + (format (current-error-port) + (_ "error: while creating directory `~a': ~a~%") + %profile-directory + (strerror (system-error-errno args))) + (format (current-error-port) + (_ "Please create the `~a' directory, with you as the ow= ner.~%") + %profile-directory) + (exit 1)))) + (with-error-handling (or (process-query opts) (parameterize ((%guile-for-build --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable WDYT? Thanks, Ludo=E2=80=99. --=-=-=-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Enge Subject: Re: Creating user profiles Date: Sun, 13 Jan 2013 23:31:44 +0100 Message-ID: <201301132331.44244.andreas@enge.fr> References: <201301131423.36130.andreas@enge.fr> <87libwrb66.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="Boundary-01=_QXz8QqlEK0cCgVx" Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:49188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuW64-0003wN-U4 for bug-guix@gnu.org; Sun, 13 Jan 2013 17:32:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TuW5v-0003Tf-9K for bug-guix@gnu.org; Sun, 13 Jan 2013 17:32:08 -0500 In-Reply-To: <87libwrb66.fsf@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Ludovic =?utf-8?q?Court=C3=A8s?= Cc: bug-guix@gnu.org --Boundary-01=_QXz8QqlEK0cCgVx Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Am Sonntag, 13. Januar 2013 schrieb Ludovic Court=C3=A8s: > Right, good point. (Apparently Nix=E2=80=99s manual doesn=E2=80=99t ment= ion it either.) > So here=E2=80=99s what I would do: I simply applied the patch, and it seems to be part of the solution. Upon a first run of "guix-package --list-available", I obtained the error=20 message inviting me to create the directory, which I did. The next call=20 succeeded. But now $HOME/.guix-profile points to the non-existing=20 /usr/local/guix-git/var/nix/profiles/per-user/privat/guix-profile, and I=20 get the error: Backtrace: In ice-9/boot-9.scm: 149: 9 [catch #t # ...] 157: 8 [#] In unknown file: ?: 7 [catch-closure] In ice-9/boot-9.scm: 63: 6 [call-with-prompt prompt0 ...] In ice-9/eval.scm: 407: 5 [eval # #] In unknown file: ?: 4 [call-with-input-string "(apply (module-ref (resolve-interface=20 '(guix-package)) 'guix-package) (cdr (command-line)))" ...] In ice-9/command-line.scm: 174: 3 [#=20 #] In unknown file: ?: 2 [eval (apply (module-ref # #) (cdr #)) #] In /usr/local/bin/guix-package: 467: 1 [guix-package "--list-available"] In unknown file: ?: 0 [symlink "/usr/local/guix-git/var/nix/profiles/per- user/privat/guix-profile" ...] ERROR: In procedure symlink: ERROR: In procedure symlink: File exists The problem is that the call to "guix-package --list-available" does not=20 actually create anything in the per-user profile directory. After deleting $HOME/.guix-profile again and running "guix-package -i=20 hello", the per-user profile directory contains a symbolic link guix- profile-1-link to a user environment in the nix store, and a symbolic link= =20 guix-profile to guix-profile-1-link, and $HOME/.guix-profile points to the= =20 right thing. Then "guix-package --list-available" succeeds. Now I can even remove the hello package, since then the per-user profile=20 directory contains a link to the empty user environment in the nix store. I would suggest the following: Before making the $HOME/.guix-profile=20 symlink, check for the guix-profile symlink in the per-user profile=20 directory. If it does not exist, create it as a link to the empty user=20 environment. So there will always be guix-profile-1-link linking to the=20 empty directory, which might also be useful for roll back (never delete=20 this first empty environment). Andreas --Boundary-01=_QXz8QqlEK0cCgVx Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

Am Sonntag,= 13. Januar 2013 schrieb Ludovic Court=C3=A8s:

> Right,= good point. (Apparently Nix=E2=80=99s manual doesn=E2=80=99t mention it e= ither.)

> So her= e=E2=80=99s what I would do:

&nb= sp;

I simply ap= plied the patch, and it seems to be part of the solution.

Upon a firs= t run of "guix-package --list-available", I obtained the error me= ssage inviting me to create the directory, which I did. The next call succe= eded. But now $HOME/.guix-profile points to the non-existing /usr/local/gui= x-git/var/nix/profiles/per-user/privat/guix-profile, and I get the error:

&nb= sp;

Backtrace:<= /p>

In ice-9/bo= ot-9.scm:

149: 9 [ca= tch #t #<catch-closure 14e29c0> ...]

157: 8 [#&= lt;procedure 147e0f0 ()>]

In unknown = file:

?: 7 [ca= tch-closure]

In ice-9/bo= ot-9.scm:

63: 6 [ca= ll-with-prompt prompt0 ...]

In ice-9/ev= al.scm:

407: 5 [ev= al # #]

In unknown = file:

?: 4 [ca= ll-with-input-string "(apply (module-ref (resolve-interface '(guix-pac= kage)) 'guix-package) (cdr (command-line)))" ...]

In ice-9/co= mmand-line.scm:

174: 3 [#&= lt;procedure 1415500 at ice-9/command-line.scm:169:3 (port)> #<input:= string 12a51a0>]

In unknown = file:

?: 2 [ev= al (apply (module-ref # #) (cdr #)) #<directory (guile-user) 14e4d80>= ]

In /usr/loc= al/bin/guix-package:

467: 1 [gu= ix-package "--list-available"]

In unknown = file:

?: 0 [sy= mlink "/usr/local/guix-git/var/nix/profiles/per-user/privat/guix-profi= le" ...]

&nb= sp;

ERROR: In p= rocedure symlink:

ERROR: In p= rocedure symlink: File exists

&nb= sp;

The problem= is that the call to "guix-package --list-available" does not act= ually create anything in the per-user profile directory.

&nb= sp;

After delet= ing $HOME/.guix-profile again and running "guix-package -i hello"= , the per-user profile directory contains a symbolic link guix-profile-1-li= nk to a user environment in the nix store, and a symbolic link guix-profile= to guix-profile-1-link, and $HOME/.guix-profile points to the right thing.= Then "guix-package --list-available" succeeds.

&nb= sp;

Now I can e= ven remove the hello package, since then the per-user profile directory con= tains a link to the empty user environment in the nix store.

&nb= sp;

I would sug= gest the following: Before making the $HOME/.guix-profile symlink, check fo= r the guix-profile symlink in the per-user profile directory. If it does no= t exist, create it as a link to the empty user environment. So there will a= lways be guix-profile-1-link linking to the empty directory, which might al= so be useful for roll back (never delete this first empty environment).

&nb= sp;

Andreas

&nb= sp;

--Boundary-01=_QXz8QqlEK0cCgVx-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Creating user profiles Date: Sun, 13 Jan 2013 23:45:34 +0100 Message-ID: <87wqvgog6p.fsf@gnu.org> References: <201301131423.36130.andreas@enge.fr> <87libwrb66.fsf@gnu.org> <201301132331.44244.andreas@enge.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:56090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuWJC-0006Ay-Lr for bug-guix@gnu.org; Sun, 13 Jan 2013 17:45:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TuWJ6-0000GO-RP for bug-guix@gnu.org; Sun, 13 Jan 2013 17:45:42 -0500 Received: from mail1-relais-roc.national.inria.fr ([192.134.164.82]:40091) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuWJ6-0000G5-K8 for bug-guix@gnu.org; Sun, 13 Jan 2013 17:45:36 -0500 In-Reply-To: <201301132331.44244.andreas@enge.fr> (Andreas Enge's message of "Sun, 13 Jan 2013 23:31:44 +0100") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Andreas Enge Cc: bug-guix@gnu.org Andreas Enge skribis: > I simply applied the patch, and it seems to be part of the solution. > Upon a first run of "guix-package --list-available", I obtained the error= =20 > message inviting me to create the directory, which I did. The next call=20 > succeeded. But now $HOME/.guix-profile points to the non-existing=20 > /usr/local/guix-git/var/nix/profiles/per-user/privat/guix-profile, and I= =20 > get the error: [...] > ?: 0 [symlink "/usr/local/guix-git/var/nix/profiles/per- > user/privat/guix-profile" ...] > > ERROR: In procedure symlink: > ERROR: In procedure symlink: File exists Aah, I see. That=E2=80=99s because it did (file-exists? ".guix-profile"), = but this uses stat(2). So here, because .guix-profile was a dangling symlink, it returned #f, even though the symlink actually existed. I fixed it using =E2=80=98lstat=E2=80=99 instead. [...] > I would suggest the following: Before making the $HOME/.guix-profile=20 > symlink, check for the guix-profile symlink in the per-user profile=20 > directory. If it does not exist, create it as a link to the empty user=20 > environment. So there will always be guix-profile-1-link linking to the=20 > empty directory, which might also be useful for roll back (never delete=20 > this first empty environment). Having this empty user environment on disk should not be needed because internally, =E2=80=98profile-manifests=E2=80=99 explicitly checks whether t= he profile exists, and returns an empty manifest if it doesn=E2=80=99t. So I=E2=80=99m committing the patch, minus the above bug. Thanks for the very quick feedback! Ludo=E2=80=99.