GNU bug report logs - #30728
guix-install.sh doesn't work if run with "sudo"

Previous Next

Package: guix;

Reported by: Clément Lassieur <clement <at> lassieur.org>

Date: Tue, 6 Mar 2018 09:55:02 UTC

Severity: normal

Done: Chris Marusich <cmmarusich <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Marius Bakke <mbakke <at> fastmail.com>
To: Clément Lassieur <clement <at> lassieur.org>, Chris Marusich <cmmarusich <at> gmail.com>
Cc: 30728 <at> debbugs.gnu.org
Subject: bug#30728: guix-install.sh doesn't work if run with "sudo"
Date: Mon, 26 Mar 2018 11:18:50 +0200
[Message part 1 (text/plain, inline)]
Clément Lassieur <clement <at> lassieur.org> writes:

> Hi Chris,
>
> Chris Marusich <cmmarusich <at> gmail.com> writes:
>
>> Clément Lassieur <clement <at> lassieur.org> writes:
>>
>>> Clément Lassieur <clement <at> lassieur.org> writes:
>>>
>>>> Hi,
>>>>
>>>> My system is Ubuntu 16.04.
>>>>
>>>> I ran './guix-install.sh' and got the message: "This script must be run
>>>> as root.".  So I ran 'sudo ./guix-install.sh' and got an error message
>>>> saying that:
>>>>
>>>>     GUIX_PROFILE="${HOME}/.guix-profile"
>>>>     source "${GUIX_PROFILE}/etc/profile"
>>>>
>>>> the 'source' command doesn't work because ${GUIX_PROFILE} was never
>>>> created, ${HOME} being /home/clement, not /root.
>>>>
>>>> To recover from this I had to manually delete /var/guix and /gnu, log as
>>>> root with 'su', and start again.
>>>>
>>>> Clément
>>>
>>> I believe the script should install Guix in the user's home directory,
>>> not in ~root.
>>
>> The manual says (see: (guix) Binary Installation):
>>
>>   3. Make ‘root’’s profile available under ‘~/.guix-profile’:
>>
>>           # ln -sf /var/guix/profiles/per-user/root/guix-profile \
>>                    ~root/.guix-profile
>
> I think the manual is wrong here.  This only makes sense if the user is
> 'root'.  Otherwise, the user would expect Guix to be installed in their
> home, not in root's home.  We could use the HOME and USER environment
> variables like this:
>
>   # ln -sf /var/guix/profiles/per-user/$USER/guix-profile $HOME/.guix-profile
>
> Thus, even if 'sudo' decides to change these environment variables, it
> will still be consistent.

The binary installation tarball only comes with a profile for 'root'.
The problem is that the installation script assumes $HOME will expand to
~root when sourcing the profile, but as you found that isn't always the
case.

~root/.guix-profile is "hard-coded" many other places in the script, so
Tatianas solution seems sensible to me.
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 7 years and 55 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.