First installed package on guix system is not instantly usable

  • Open
  • quality assurance status badge
Details
2 participants
  • Marius Bakke
  • Stefan
Owner
unassigned
Submitted by
Stefan
Severity
normal
S
S
Stefan wrote on 26 Apr 2020 14:38
(address . bug-guix@gnu.org)
73CADE52-3A2F-433F-A2FD-491AC81C7A8A@vodafonemail.de
Hi!

I have a guix system and my user account has no package installed yet. After installing the first package – git-minimal in my case – this message is printed and I get this error when trying to use the new command:

building profile with 1 package...
Hinweis: Vielleicht möchten Sie die nötigen Umgebungsvariablen festlegen, indem Sie dies ausführen:

GUIX_PROFILE="/home/stefan/.guix-profile"
. "$GUIX_PROFILE/etc/profile"

Sie können sie auch mit `guix package --search-paths -p "/home/stefan/.guix-profile"' nachlesen.

stefan@guix ~$ git show
-bash: git: Kommando nicht gefunden.


The problem is that without a single package installed there is no user profile-link present:


stefan@guix ~$ echo $PATH
/run/setuid-programs:/home/stefan/.config/guix/current/bin:/run/current-system/profile/bin:/run/current-system/profile/sbin


This is of course easily solved by either following the hint or a logout and login:


stefan@guix ~$ exit
Abgemeldet
Connection to raspberry closed.
Computer:~ stefan$ ssh stefan@raspberry
Last login: Sun Apr 26 13:59:31 2020
stefan@guix ~$ echo $PATH
/run/setuid-programs:/home/stefan/.config/guix/current/bin:/home/stefan/.guix-profile/bin:/run/current-system/profile/bin:/run/current-system/profile/sbin


However, this gives a bad first impression to users. Moreover users may think that a logout/login cycle or manually following the hint could be necessary after each package installation. They may get annoyed by this.


Bye

Stefan
M
M
Marius Bakke wrote on 28 Apr 2020 18:12
87sggn613q.fsf@devup.no
Stefan <stefan-guix@vodafonemail.de> writes:

Toggle quote (22 lines)
> Hi!
>
> I have a guix system and my user account has no package installed yet. After installing the first package – git-minimal in my case – this message is printed and I get this error when trying to use the new command:
>
> building profile with 1 package...
> Hinweis: Vielleicht möchten Sie die nötigen Umgebungsvariablen festlegen, indem Sie dies ausführen:
>
> GUIX_PROFILE="/home/stefan/.guix-profile"
> . "$GUIX_PROFILE/etc/profile"
>
> Sie können sie auch mit `guix package --search-paths -p "/home/stefan/.guix-profile"' nachlesen.
>
> stefan@guix ~$ git show
> -bash: git: Kommando nicht gefunden.
>
>
> The problem is that without a single package installed there is no user profile-link present:
>
>
> stefan@guix ~$ echo $PATH
> /run/setuid-programs:/home/stefan/.config/guix/current/bin:/run/current-system/profile/bin:/run/current-system/profile/sbin

This is odd, as /etc/profile contains a workaround for this exact
problem (notice the else clause):

# Arrange so that ~/.config/guix/current comes first.
for profile in "$HOME/.guix-profile" "$HOME/.config/guix/current"
do
if [ -f "$profile/etc/profile" ]
then
# Load the user profile's settings.
GUIX_PROFILE="$profile" ; \
. "$profile/etc/profile"
else
# At least define this one so that basic things just work
# when the user installs their first package.
export PATH="$profile/bin:$PATH"
fi
done

Can you investigate why this is ineffective on your system?
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl6oVekACgkQoqBt8qM6
VProNgf/ZvnlCdPRXww+O7nwNqjdpuZK9QvlXjr1+BcFTfZSlJ6GKKJL3OYNBDiV
aWj+OLhLfF8YLv95nmaM8OteSU1cAsz3ubokHdSmrEdjrXKyiL681r+HRYhQHITU
K4RqmBvaZDi1jczBdh+qnuwmauaZNOZM5QgwmFXkuE/wTIbVkTxBvWPvNRUB+ndU
Azksmi1Q1oW02Q8HQyl8fXW30xjsOXDBbutUrxL9fzudAmCgvF7J+HhCVauSPhxA
Bbep/7xZ0rBj7A0XTJO0WyXgU9V5Xhz7/a15NhOxf798hSq/bVVqqc7aO8ZudxhV
4vMU3V5Wg1ISJyWJVFDS/PaXlT1uhQ==
=3rqB
-----END PGP SIGNATURE-----

S
S
Stefan wrote on 28 Apr 2020 21:50
(name . Marius Bakke)(address . mbakke@fastmail.com)(address . 40872@debbugs.gnu.org)
EDA4C18A-3733-4012-828E-C04FF76F8B76@vodafonemail.de
Hi Marius!

Toggle quote (20 lines)
> This is odd, as /etc/profile contains a workaround for this exact
> problem (notice the else clause):
>
> # Arrange so that ~/.config/guix/current comes first.
> for profile in "$HOME/.guix-profile" "$HOME/.config/guix/current"
> do
> if [ -f "$profile/etc/profile" ]
> then
> # Load the user profile's settings.
> GUIX_PROFILE="$profile" ; \
> . "$profile/etc/profile"
> else
> # At least define this one so that basic things just work
> # when the user installs their first package.
> export PATH="$profile/bin:$PATH"
> fi
> done
>
> Can you investigate why this is ineffective on your system?

Previously I had some packages installed, but I rolled-back to generation 0. I found this in my scroll-back buffer:

stefan@guix ~/development/guix$ guix package --roll-back
Folgende Ableitung wird erstellt:
/gnu/store/l0n6l104ldj7nz6kdyi7l8v5yjnc9p9g-profile.drv
building profile with 0 packages...
Von Generation „1“ zu „0“ gewechselt

By rolling back it created a new generation 0 profile which is now lying around with this kind of empty file:

stefan@guix ~$ cat .guix-profile/etc/profile
# Source this file to define all the relevant environment variables in Bash
# for this profile. You may want to define the 'GUIX_PROFILE' environment
# variable to point to the "visible" name of the profile, like this:
#
# GUIX_PROFILE=/path/to/profile ; \
# source /path/to/profile/etc/profile
#
# When GUIX_PROFILE is undefined, the various environment variables refer
# to this specific profile generation.

So the test for the existence of this file does not fail, but it doesn't change PATH either. This is the profile content, it has no bin/ folder to add to PATH:

stefan@guix ~$ ls -lA /gnu/store/yyxqc1rhz2i062xq8lbfrhhmiyf6pzvp-profile
insgesamt 12
dr-xr-xr-x 2 root root 4096 1. Jan 1970 etc/
-r--r--r-- 4 root root 37 1. Jan 1970 manifest


Bye

Stefan
M
M
Marius Bakke wrote on 2 May 2020 16:20
(name . Stefan)(address . stefan-guix@vodafonemail.de)(address . 40872@debbugs.gnu.org)
87pnbm2zc3.fsf@devup.no
Stefan <stefan-guix@vodafonemail.de> writes:

Toggle quote (45 lines)
> Hi Marius!
>
>> This is odd, as /etc/profile contains a workaround for this exact
>> problem (notice the else clause):
>>
>> # Arrange so that ~/.config/guix/current comes first.
>> for profile in "$HOME/.guix-profile" "$HOME/.config/guix/current"
>> do
>> if [ -f "$profile/etc/profile" ]
>> then
>> # Load the user profile's settings.
>> GUIX_PROFILE="$profile" ; \
>> . "$profile/etc/profile"
>> else
>> # At least define this one so that basic things just work
>> # when the user installs their first package.
>> export PATH="$profile/bin:$PATH"
>> fi
>> done
>>
>> Can you investigate why this is ineffective on your system?
>
> Previously I had some packages installed, but I rolled-back to generation 0. I found this in my scroll-back buffer:
>
> stefan@guix ~/development/guix$ guix package --roll-back
> Folgende Ableitung wird erstellt:
> /gnu/store/l0n6l104ldj7nz6kdyi7l8v5yjnc9p9g-profile.drv
> building profile with 0 packages...
> Von Generation „1“ zu „0“ gewechselt
>
> By rolling back it created a new generation 0 profile which is now lying around with this kind of empty file:
>
> stefan@guix ~$ cat .guix-profile/etc/profile
> # Source this file to define all the relevant environment variables in Bash
> # for this profile. You may want to define the 'GUIX_PROFILE' environment
> # variable to point to the "visible" name of the profile, like this:
> #
> # GUIX_PROFILE=/path/to/profile ; \
> # source /path/to/profile/etc/profile
> #
> # When GUIX_PROFILE is undefined, the various environment variables refer
> # to this specific profile generation.
>
> So the test for the existence of this file does not fail, but it doesn't change PATH either. This is the profile content, it has no bin/ folder to add to PATH:

I see. We could extend the test in /etc/profile to look for a /bin
directory of the profile, but arguably rolling back to generation 0 is
not a very common case. So I'm in favor of just keeping the status quo.

WDYT?
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl6tgZwACgkQoqBt8qM6
VPrX2Qf7BEKyWX887qCmjkbSMAQQvI6IOQ3AjtJuktl5s/NankRw7j9duAvYWVBr
njFoMYmBRZPX4leHEVs/EPBsd6/ozqylI1nhrtUuiq736aFCwTmfupOl2pVYYBcW
MdXVZGa2IIyvXyafxmiiyRTR3RmCsDPR5bCZylr8tESBDOoSWg0OQm7mP9EUoqdK
xrS+a7/quzJe9ZAIbBIT0FEzEWCc2ulaJ170uKhj/N86Bn0uLLLgUD0bfrV1bX3C
rW4W/sD0Eh9gcfu/ndEMx1x2LOPyi/xJIXCdfchRfGEr6gyByh+i7UsabiBmgrKZ
ie69a10sKKRN+OzuD1SoQwwdDZOdPA==
=+fkq
-----END PGP SIGNATURE-----

S
S
Stefan wrote on 2 May 2020 18:59
Subject: [PATCH] gnu: system: Fix PATH export if the profile has no bin directory.
(address . 40872@debbugs.gnu.org)(name . Marius Bakke)(address . mbakke@fastmail.com)
41DF61AE-B00F-43DF-BF7A-17473874701C@vodafonemail.de
* gnu/system.scm (operating-system-etc-service): Testing for $profile/bin.

---
gnu/system.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Toggle diff (16 lines)
diff --git a/gnu/system.scm b/gnu/system.scm
index 540f0e4a9e..0eb5731c82 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -725,7 +725,8 @@ do
# Load the user profile's settings.
GUIX_PROFILE=\"$profile\" ; \\
. \"$profile/etc/profile\"
- else
+ fi
+ if [ ! -d \"$profile/bin\" ]
# At least define this one so that basic things just work
# when the user installs their first package.
export PATH=\"$profile/bin:$PATH\"
--
2.26.0
S
S
Stefan wrote on 4 May 2020 01:32
Re: bug#40872: First installed package on guix system is not instantly usable
(name . Marius Bakke)(address . mbakke@fastmail.com)(address . 40872@debbugs.gnu.org)
3EE75A5A-9B86-4648-BB30-5C4C79F3954C@vodafonemail.de
Hi Marius!

Toggle quote (5 lines)
> Am 02.05.2020 um 16:20 schrieb Marius Bakke <mbakke@fastmail.com>:
>
> We could extend the test in /etc/profile to look for a /bin
> directory of the profile

I think this is the right solution, as that’s the actual aim of the else-part: Provide a path to a bin directory if the profile doesn’t do this by itself – there is just the implicit (but wrong) assumption that it would, if the profile is existing. I sent a patch, probably you saw it already.


Bye

Stefan
S
S
Stefan wrote on 10 May 2020 00:50
[PATCH] gnu: system: Fix PATH export if the profile has no bin directory.
(address . 40872@debbugs.gnu.org)(name . Marius Bakke)(address . mbakke@fastmail.com)
4DBA2659-453A-4621-BE86-E6AF07FC3BAE@vodafonemail.de
Hi!

Toggle quote (21 lines)
> Am 02.05.2020 um 18:59 schrieb Stefan <stefan-guix@vodafonemail.de>:
>
> * gnu/system.scm (operating-system-etc-service): Testing for $profile/bin.
>
> Fixes <https://debbugs.gnu.org/40872>.
> ---
> gnu/system.scm | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/system.scm b/gnu/system.scm
> index 540f0e4a9e..0eb5731c82 100644
> --- a/gnu/system.scm
> +++ b/gnu/system.scm
> @@ -725,7 +725,8 @@ do
> # Load the user profile's settings.
> GUIX_PROFILE=\"$profile\" ; \\
> . \"$profile/etc/profile\"
> - else
> + fi
> + if [ ! -d \"$profile/bin\" ]

I just realised that I missed the necessary

then

between these lines.

Toggle quote (8 lines)
> # At least define this one so that basic things just work
> # when the user installs their first package.
> export PATH=\"$profile/bin:$PATH\"
> --
> 2.26.0
>


Bye

Stefan
?