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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 30728 in the body.
You can then email your comments to 30728 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Tue, 06 Mar 2018 09:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clément Lassieur <clement <at> lassieur.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Tue, 06 Mar 2018 09:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: bug-guix <at> gnu.org
Subject: guix-install.sh doesn't work if run with "sudo"
Date: Tue, 06 Mar 2018 10:54:04 +0100
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




Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Fri, 23 Mar 2018 13:21:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: bug-guix <at> gnu.org
Subject: Re: guix-install.sh doesn't work if run with "sudo"
Date: Fri, 23 Mar 2018 14:20:38 +0100
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.




Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Sun, 25 Mar 2018 05:18:02 GMT) Full text and rfc822 format available.

Message #11 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Chris Marusich <cmmarusich <at> gmail.com>
To: Clément Lassieur <clement <at> lassieur.org>
Cc: 30728 <at> debbugs.gnu.org
Subject: Re: bug#30728: guix-install.sh doesn't work if run with "sudo"
Date: Sun, 25 Mar 2018 07:16:58 +0200
[Message part 1 (text/plain, inline)]
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

     Source ‘etc/profile’ to augment ‘PATH’ and other relevant
     environment variables:

          # GUIX_PROFILE=$HOME/.guix-profile ; \
            source $GUIX_PROFILE/etc/profile

I believe the expectation here is that $HOME will expand to root's home
directory.  Look at the previous ln invocation: we set up a symlink for
the .guix-profile in root's home directory, so it's pretty clear that
$HOME/.guix-profile is supposed to point to that profile.

I think there is a tacit assumption in the manual and the
guix-install.sh script that the HOME environment variable will refer to
root's home directory, which is not always true.  For example, on
current Ubuntu, if you run sudo with no arguments, you will find that
the HOME environment variable still points to your unprivileged user's
home directory, not to root's home directory.  This is because sudo can
be configured in many ways, and on Ubuntu, they have chosen to configure
it in that way.  On other systems, it might behave differently.

I've attached a patch which should fix this.  Can you confirm whether it
works?

-- 
Chris
[0001-guix-install.sh-Explicitly-set-root-s-home-directory.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Sun, 25 Mar 2018 15:43:02 GMT) Full text and rfc822 format available.

Message #14 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Tatiana Sholokhova <tanja201396 <at> gmail.com>
Cc: guix-devel <at> gnu.org, cmmarusich <at> gmail.com, 30728 <at> debbugs.gnu.org
Subject: Re: Modification for guix installation script.
Date: Sun, 25 Mar 2018 17:26:34 +0200
Hi Tatiana,

> I have installed guix for the first time and noticed that the installation
> script at
> https://git.savannah.gnu.org/cgit/guix.git/tree/etc/guix-install.sh did not
> work for me. So, I had to make some modifications.
>
> There was a problem with the path to root user home directory. Below I
> provide diff output for original script and my modified script.

Thank you.

Could you please make that change on top of the current version of the
Guix sources as a git commit?  Then you can run “git format-patch -1” to
format it as a patch in a format that we can apply.  You can send the
resulting patch file as an attachment to a reply to this email.

This also fixes bug #30728, so please add this line to the commit
message:

Fixes <https://debbugs.gnu.org/30728>.


--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net






Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Sun, 25 Mar 2018 18:59:01 GMT) Full text and rfc822 format available.

Message #17 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: guix-devel <at> gnu.org, 30728 <at> debbugs.gnu.org,
 Tatiana Sholokhova <tanja201396 <at> gmail.com>
Subject: Re: Modification for guix installation script.
Date: Sun, 25 Mar 2018 14:57:53 -0400
Ricardo Wurmus <rekado <at> elephly.net> writes:

>> I have installed guix for the first time and noticed that the installation
>> script at
>> https://git.savannah.gnu.org/cgit/guix.git/tree/etc/guix-install.sh did not
>> work for me. So, I had to make some modifications.
>>
>> There was a problem with the path to root user home directory. Below I
>> provide diff output for original script and my modified script.
>
> Thank you.
>
> Could you please make that change on top of the current version of the
> Guix sources as a git commit?  Then you can run “git format-patch -1” to
> format it as a patch in a format that we can apply.  You can send the
> resulting patch file as an attachment to a reply to this email.
>
> This also fixes bug #30728, so please add this line to the commit
> message:
>
> Fixes <https://debbugs.gnu.org/30728>.

Note that there's also another proposed patch for this same issue, here:

https://bugs.gnu.org/30728#11

    Regards,
      Mark




Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Mon, 26 Mar 2018 08:06:02 GMT) Full text and rfc822 format available.

Message #20 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Chris Marusich <cmmarusich <at> gmail.com>
Cc: 30728 <at> debbugs.gnu.org
Subject: Re: bug#30728: guix-install.sh doesn't work if run with "sudo"
Date: Mon, 26 Mar 2018 10:05:50 +0200
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.

>      Source ‘etc/profile’ to augment ‘PATH’ and other relevant
>      environment variables:
>
>           # GUIX_PROFILE=$HOME/.guix-profile ; \
>             source $GUIX_PROFILE/etc/profile
>
> I believe the expectation here is that $HOME will expand to root's home
> directory.  Look at the previous ln invocation: we set up a symlink for
> the .guix-profile in root's home directory, so it's pretty clear that
> $HOME/.guix-profile is supposed to point to that profile.
>
> I think there is a tacit assumption in the manual and the
> guix-install.sh script that the HOME environment variable will refer to
> root's home directory, which is not always true.  For example, on
> current Ubuntu, if you run sudo with no arguments, you will find that
> the HOME environment variable still points to your unprivileged user's
> home directory, not to root's home directory.  This is because sudo can
> be configured in many ways, and on Ubuntu, they have chosen to configure
> it in that way.  On other systems, it might behave differently.




Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Mon, 26 Mar 2018 08:28:01 GMT) Full text and rfc822 format available.

Message #23 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Tatiana Sholokhova <tanja201396 <at> gmail.com>
Cc: guix-devel <at> gnu.org, Chris Marusich <cmmarusich <at> gmail.com>,
 30728 <at> debbugs.gnu.org
Subject: Re: Modification for guix installation script.
Date: Mon, 26 Mar 2018 10:27:57 +0200
Hi Tatiana,

Tatiana Sholokhova <tanja201396 <at> gmail.com> writes:

> Hello! My name is Tatiana.
>
> I have installed guix for the first time and noticed that the installation
> script at
> https://git.savannah.gnu.org/cgit/guix.git/tree/etc/guix-install.sh did not
> work for me. So, I had to make some modifications.
>
> There was a problem with the path to root user home directory. Below I
> provide diff output for original script and my modified script.

Thank you for working on this!

> 266c266,267
> <     ln -sf /var/guix/profiles/per-user/root/guix-profile
> /root/.guix-profile
> ---
>>     ln -sf /var/guix/profiles/per-user/root/guix-profile \
>>        ~root/.guix-profile
> 268c269
> <     GUIX_PROFILE="/root/.guix-profile"
> ---
>>     GUIX_PROFILE="${HOME}/.guix-profile"
>
> These changes allowed me to install guix via the script.

As I said to Chris (Cc'ed), I don't think it's a good idea to install
Guix in root's home directory.  Instead, we should probably honor the
USER and HOME environment variables, so that the command can be run as a
non-root user (with sudo) in a consistent way.  What do you think?

You can follow the discussion there:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30728.  Every email sent
to 30728 <at> debbugs.gnu.org will appear there.

Clément




Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Mon, 26 Mar 2018 09:13:02 GMT) Full text and rfc822 format available.

Message #26 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Clément Lassieur <clement <at> lassieur.org>
Cc: guix-devel <at> gnu.org, 30728 <at> debbugs.gnu.org,
 Tatiana Sholokhova <tanja201396 <at> gmail.com>
Subject: Re: Modification for guix installation script.
Date: Mon, 26 Mar 2018 11:11:49 +0200
Hi Clément,

> As I said to Chris (Cc'ed), I don't think it's a good idea to install
> Guix in root's home directory.  Instead, we should probably honor the
> USER and HOME environment variables, so that the command can be run as a
> non-root user (with sudo) in a consistent way.  What do you think?

The script should be run as root as it follows the manual’s
instructions, which tell people to install Guix for the root user and
then make it available system-wide.

This is why I think that it would be correct to install it to the root’s
home directory and not to the sudoing user’s HOME.

Or am I missing something?

-- 
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net






Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Mon, 26 Mar 2018 09:19:01 GMT) Full text and rfc822 format available.

Message #29 received at 30728 <at> debbugs.gnu.org (full text, mbox):

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: Re: 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)]

Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Mon, 26 Mar 2018 13:00:03 GMT) Full text and rfc822 format available.

Message #32 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Ricardo Wurmus <rekado <at> elephly.net>, Marius Bakke <mbakke <at> fastmail.com>
Cc: guix-devel <at> gnu.org, 30728 <at> debbugs.gnu.org,
 Tatiana Sholokhova <tanja201396 <at> gmail.com>
Subject: Re: bug#30728: Modification for guix installation script.
Date: Mon, 26 Mar 2018 14:59:30 +0200
Hi Ricardo and Marius,

Marius Bakke <mbakke <at> fastmail.com> writes:

> The binary installation tarball only comes with a profile for 'root'.

Indeed, but it's easy to copy it for any user isn't it?

> 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.

Ricardo Wurmus <rekado <at> elephly.net> writes:

> Hi Clément,
>
>> As I said to Chris (Cc'ed), I don't think it's a good idea to install
>> Guix in root's home directory.  Instead, we should probably honor the
>> USER and HOME environment variables, so that the command can be run as a
>> non-root user (with sudo) in a consistent way.  What do you think?
>
> The script should be run as root as it follows the manual’s
> instructions, which tell people to install Guix for the root user and
> then make it available system-wide.
>
> This is why I think that it would be correct to install it to the root’s
> home directory and not to the sudoing user’s HOME.
>
> Or am I missing something?

Thank you both for your comments. :-)

What I dislike with the present state of things is the need for Guix to
be installed within root's directory.  For two reasons :

  1. I don't think a command should ever install something in another
     user's home directory.  The home directory of a user is for things
     that are specific to that user, I believe.

  2. Users need to update the root profile if they want to update the
     Guix daemon, which is cumbersome.

The systemd configuration file must know where to find the Guix daemon.
If it's not in ~root, it must be in the user's home directory.  Either
way, the Guix daemon, which is system-wide, still depends on a user.

(A way to make the daemon user-independant would be to add a new command
that would update, say, /var/guix/guix-daemon, with the systemd
configuration file pointing to it.)

I personally prefer that the Guix daemon points to my home directory
because I don't want to update root's profile.  Some other people might
prefer that it points to ~root because they might later delete their
profile and want Guix to keep working.

Do we have to take a decision here?  Can't we just let the user decide
by letting them customize their environment variables?  I think it is
the point of environment variables: giving freedom to users.




Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Mon, 26 Mar 2018 16:33:02 GMT) Full text and rfc822 format available.

Message #35 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Tatiana Sholokhova <tanja201396 <at> gmail.com>
To: Clément Lassieur <clement <at> lassieur.org>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, guix-devel <guix-devel <at> gnu.org>,
 Marius Bakke <mbakke <at> fastmail.com>, 30728 <at> debbugs.gnu.org
Subject: Re: bug#30728: Modification for guix installation script.
Date: Mon, 26 Mar 2018 19:09:38 +0300
[Message part 1 (text/plain, inline)]
Hello!

Could you please make that change on top of the current version of the
> Guix sources as a git commit?  Then you can run “git format-patch -1” to
> format it as a patch in a format that we can apply.  You can send the
> resulting patch file as an attachment to a reply to this email.
> This also fixes bug #30728, so please add this line to the commit
> message:
> --
> Ricardo


I have attached the patch file to this email. This patch fixes the
installation process but it place guix within root's directory.

I personally prefer that the Guix daemon points to my home directory
> because I don't want to update root's profile.  Some other people might
> prefer that it points to ~root because they might later delete their
> profile and want Guix to keep working.


> Do we have to take a decision here?  Can't we just let the user decide
> by letting them customize their environment variables?  I think it is
> the point of environment variables: giving freedom to users.


We can further work on the script's flexibility using the environment
variable solution.

--
Tatiana
[Message part 2 (text/html, inline)]
[0001-Fixes-https-debbugs.gnu.org-30728.patch (text/x-patch, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Tue, 27 Mar 2018 07:48:02 GMT) Full text and rfc822 format available.

Message #38 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Clément Lassieur <clement <at> lassieur.org>
Cc: Chris Marusich <cmmarusich <at> gmail.com>, 30728 <at> debbugs.gnu.org
Subject: Re: bug#30728: guix-install.sh doesn't work if run with "sudo"
Date: Tue, 27 Mar 2018 09:46:54 +0200
Clément Lassieur <clement <at> lassieur.org> writes:

>> 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.

Step 2 says “As root, run: […]”.  “~root” resolves to “/root”, not to
“$HOME/root”, so it even works when run as a regular user.

The manual seems correct to me and this is what the script aims to
implement.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net






Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Tue, 27 Mar 2018 09:12:02 GMT) Full text and rfc822 format available.

Message #41 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: Chris Marusich <cmmarusich <at> gmail.com>, 30728 <at> debbugs.gnu.org
Subject: Re: bug#30728: guix-install.sh doesn't work if run with "sudo"
Date: Tue, 27 Mar 2018 11:11:36 +0200
Ricardo Wurmus <rekado <at> elephly.net> writes:

> Clément Lassieur <clement <at> lassieur.org> writes:
>
>>> 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.
>
> Step 2 says “As root, run: […]”.  “~root” resolves to “/root”, not to
> “$HOME/root”, so it even works when run as a regular user.
>
> The manual seems correct to me and this is what the script aims to
> implement.

But ~/.guix-profile may resolve to /home/user/.guix-profile.  So it
should be ~root/.guix-profile instead of ~/.guix-profile.




Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Tue, 27 Mar 2018 11:54:01 GMT) Full text and rfc822 format available.

Message #44 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Gábor Boskovits <boskovits <at> gmail.com>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: Guix-devel <guix-devel <at> gnu.org>, 30728 <at> debbugs.gnu.org,
 Clément Lassieur <clement <at> lassieur.org>,
 Tatiana Sholokhova <tanja201396 <at> gmail.com>
Subject: Re: Modification for guix installation script.
Date: Tue, 27 Mar 2018 13:53:32 +0200
[Message part 1 (text/plain, inline)]
2018-03-26 11:11 GMT+02:00 Ricardo Wurmus <rekado <at> elephly.net>:

>
> Hi Clément,
>
> > As I said to Chris (Cc'ed), I don't think it's a good idea to install
> > Guix in root's home directory.  Instead, we should probably honor the
> > USER and HOME environment variables, so that the command can be run as a
> > non-root user (with sudo) in a consistent way.  What do you think?
>
> The script should be run as root as it follows the manual’s
> instructions, which tell people to install Guix for the root user and
> then make it available system-wide.
>
> This is why I think that it would be correct to install it to the root’s
> home directory and not to the sudoing user’s HOME.
>
> Or am I missing something?
>
>
I think Ricardo is right on this one. I would also recommend installing in
root's home directory. Ibelieve, that installing in a user home would make
sense only with a big amount of additional instrumentation and
documentation changes, along with arrangements to allow guix in
userspace. This is a straightforward way to make the script do what it's
purpose is.


> --
> Ricardo
>
> GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
> https://elephly.net
>
>
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Tue, 27 Mar 2018 16:09:02 GMT) Full text and rfc822 format available.

Message #47 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Chris Marusich <cmmarusich <at> gmail.com>
To: Clément Lassieur <clement <at> lassieur.org>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, 30728 <at> debbugs.gnu.org
Subject: Re: bug#30728: guix-install.sh doesn't work if run with "sudo"
Date: Tue, 27 Mar 2018 18:08:40 +0200
[Message part 1 (text/plain, inline)]
Clément Lassieur <clement <at> lassieur.org> writes:

> Ricardo Wurmus <rekado <at> elephly.net> writes:
>
>> Clément Lassieur <clement <at> lassieur.org> writes:
>>
>>>> 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.
>>
>> Step 2 says “As root, run: […]”.  “~root” resolves to “/root”, not to
>> “$HOME/root”, so it even works when run as a regular user.
>>
>> The manual seems correct to me and this is what the script aims to
>> implement.
>
> But ~/.guix-profile may resolve to /home/user/.guix-profile.  So it
> should be ~root/.guix-profile instead of ~/.guix-profile.

Ah, I think I now see the cause of our miscommunication.

It's possible to interpret the manual's use of ~ and $HOME to mean "the
unprivileged user's home directory", instead of "root's home directory".
I think that's a mistake in the manual, since the "ln" clearly makes
root's profile available under root's home directory, and the step
involving $HOME doesn't make sense unless $HOME expands to root's home
directory.

I've updated my patch; it now also changes the following line...

  3. Make ‘root’’s profile available under ‘~/.guix-profile’:

...to this:

  3. Make ‘root’’s profile available under ‘~root/.guix-profile’:

How does that sound?

-- 
Chris
[0001-guix-install.sh-Explicitly-set-root-s-home-directory.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Wed, 28 Mar 2018 19:25:01 GMT) Full text and rfc822 format available.

Message #50 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Chris Marusich <cmmarusich <at> gmail.com>
Cc: 30728 <at> debbugs.gnu.org,
 Clément Lassieur <clement <at> lassieur.org>
Subject: Re: bug#30728: guix-install.sh doesn't work if run with "sudo"
Date: Wed, 28 Mar 2018 21:24:21 +0200
Hi Chris,

> I've updated my patch; it now also changes the following line...
>
>   3. Make ‘root’’s profile available under ‘~/.guix-profile’:
>
> ...to this:
>
>   3. Make ‘root’’s profile available under ‘~root/.guix-profile’:
>
> How does that sound?

This looks good to me.  Thank you!

-- 
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net






Reply sent to Chris Marusich <cmmarusich <at> gmail.com>:
You have taken responsibility. (Thu, 29 Mar 2018 05:08:02 GMT) Full text and rfc822 format available.

Notification sent to Clément Lassieur <clement <at> lassieur.org>:
bug acknowledged by developer. (Thu, 29 Mar 2018 05:08:02 GMT) Full text and rfc822 format available.

Message #55 received at 30728-done <at> debbugs.gnu.org (full text, mbox):

From: Chris Marusich <cmmarusich <at> gmail.com>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: Clément Lassieur <clement <at> lassieur.org>,
 30728-done <at> debbugs.gnu.org
Subject: Re: bug#30728: guix-install.sh doesn't work if run with "sudo"
Date: Thu, 29 Mar 2018 07:07:29 +0200
[Message part 1 (text/plain, inline)]
Hi everyone,

Ricardo Wurmus <rekado <at> elephly.net> writes:

> This looks good to me.  Thank you!

I've committed this as 3cd4447f5639f45b7d833f6fb2adce11ea15ba1d.  If
anybody has additional concerns about the installation script or the
installation instructions, please open a new bug report for it and we
can discuss the topic further there.

Thank you for reporting this issue, Clément!

-- 
Chris
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Thu, 29 Mar 2018 07:49:02 GMT) Full text and rfc822 format available.

Message #58 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: Chris Marusich <cmmarusich <at> gmail.com>, 30728 <at> debbugs.gnu.org
Subject: Re: bug#30728: guix-install.sh doesn't work if run with "sudo"
Date: Thu, 29 Mar 2018 09:48:30 +0200
Ricardo Wurmus <rekado <at> elephly.net> writes:

> Hi Chris,
>
>> I've updated my patch; it now also changes the following line...
>>
>>   3. Make ‘root’’s profile available under ‘~/.guix-profile’:
>>
>> ...to this:
>>
>>   3. Make ‘root’’s profile available under ‘~root/.guix-profile’:
>>
>> How does that sound?
>
> This looks good to me.  Thank you!

I am surprised that you didn't comment on
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30728#32 (where I explain
to you why I disagree with Guix being installed in ~root) before saying
LGTM.




Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Thu, 29 Mar 2018 08:05:02 GMT) Full text and rfc822 format available.

Message #61 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Chris Marusich <cmmarusich <at> gmail.com>
Cc: 30728 <at> debbugs.gnu.org
Subject: Re: bug#30728: guix-install.sh doesn't work if run with "sudo"
Date: Thu, 29 Mar 2018 10:04:32 +0200
Chris Marusich <cmmarusich <at> gmail.com> writes:

> Clément Lassieur <clement <at> lassieur.org> writes:
>
>> Ricardo Wurmus <rekado <at> elephly.net> writes:
>>
>>> Clément Lassieur <clement <at> lassieur.org> writes:
>>>
>>>>> 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.
>>>
>>> Step 2 says “As root, run: […]”.  “~root” resolves to “/root”, not to
>>> “$HOME/root”, so it even works when run as a regular user.
>>>
>>> The manual seems correct to me and this is what the script aims to
>>> implement.
>>
>> But ~/.guix-profile may resolve to /home/user/.guix-profile.  So it
>> should be ~root/.guix-profile instead of ~/.guix-profile.
>
> Ah, I think I now see the cause of our miscommunication.
>
> It's possible to interpret the manual's use of ~ and $HOME to mean "the
> unprivileged user's home directory", instead of "root's home directory".
> I think that's a mistake in the manual, since the "ln" clearly makes
> root's profile available under root's home directory, and the step
> involving $HOME doesn't make sense unless $HOME expands to root's home
> directory.
>
> I've updated my patch; it now also changes the following line...
>
>   3. Make ‘root’’s profile available under ‘~/.guix-profile’:
>
> ...to this:
>
>   3. Make ‘root’’s profile available under ‘~root/.guix-profile’:
>
> How does that sound?

This fixes the documentation inconsistency, but I still think Guix
shouldn't be installed in ~root (as I explain there:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30728#32).




Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Thu, 29 Mar 2018 08:12:02 GMT) Full text and rfc822 format available.

Message #64 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Gábor Boskovits <boskovits <at> gmail.com>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, Guix-devel <guix-devel <at> gnu.org>,
 30728 <at> debbugs.gnu.org, Tatiana Sholokhova <tanja201396 <at> gmail.com>
Subject: Re: Modification for guix installation script.
Date: Thu, 29 Mar 2018 10:11:35 +0200
Gábor Boskovits <boskovits <at> gmail.com> writes:

> 2018-03-26 11:11 GMT+02:00 Ricardo Wurmus <rekado <at> elephly.net>:
>
>>
>> Hi Clément,
>>
>> > As I said to Chris (Cc'ed), I don't think it's a good idea to install
>> > Guix in root's home directory.  Instead, we should probably honor the
>> > USER and HOME environment variables, so that the command can be run as a
>> > non-root user (with sudo) in a consistent way.  What do you think?
>>
>> The script should be run as root as it follows the manual’s
>> instructions, which tell people to install Guix for the root user and
>> then make it available system-wide.
>>
>> This is why I think that it would be correct to install it to the root’s
>> home directory and not to the sudoing user’s HOME.
>>
>> Or am I missing something?
>>
>>
> I think Ricardo is right on this one. I would also recommend installing in
> root's home directory.

But you don't explain why.  And "as it follows the manual's
instructions" isn't a good reason to me.

> I believe, that installing in a user home would make sense only with a
> big amount of additional instrumentation and documentation changes,
> along with arrangements to allow guix in userspace.

I think it would be fairly easy.  The kind of edit we do all the time
when patches are being reviewed.




Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Thu, 29 Mar 2018 08:25:02 GMT) Full text and rfc822 format available.

Message #67 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Tatiana Sholokhova <tanja201396 <at> gmail.com>
Cc: guix-devel <guix-devel <at> gnu.org>, 30728 <at> debbugs.gnu.org
Subject: Re: bug#30728: Modification for guix installation script.
Date: Thu, 29 Mar 2018 10:24:57 +0200
Hi Tatiana,

Tatiana Sholokhova <tanja201396 <at> gmail.com> writes:

> Hello!
>
>
>     Could you please make that change on top of the current version of the
>     Guix sources as a git commit? Then you can run “git format-patch -1” to
>     format it as a patch in a format that we can apply. You can send the
>     resulting patch file as an attachment to a reply to this email.
>     This also fixes bug #30728, so please add this line to the commit
>     message:
>     --
>     Ricardo
>
>
> I have attached the patch file to this email. This patch fixes the installation
> process but it placeguixwithin root's directory.
>
>
>     I personally prefer that the Guix daemon points to my home directory
>     because I don't want to update root's profile. Some other people might
>     prefer that it points to ~root because they might later delete their
>     profile and want Guix to keep working.
>
>
>     Do we have to take a decision here? Can't we just let the user decide
>     by letting them customize their environment variables? I think it is
>     the point of environment variables: giving freedom to users.
>
>
> We can further work on the script's flexibility using the environment variable
> solution.

Thank you for your patch.  The one Chris did has been pushed, but if you
want, you can still work on improving the script's flexibility.  I still
haven't seen any valid argument for or against it, though, so I don't
know if it's a good idea.  Maybe we can wait until someone says
something about it!

Clément




Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Thu, 29 Mar 2018 08:27:01 GMT) Full text and rfc822 format available.

Message #70 received at 30728-done <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Chris Marusich <cmmarusich <at> gmail.com>
Cc: Ricardo Wurmus <rekado <at> elephly.net>, 30728-done <at> debbugs.gnu.org
Subject: Re: bug#30728: guix-install.sh doesn't work if run with "sudo"
Date: Thu, 29 Mar 2018 10:26:48 +0200
Chris Marusich <cmmarusich <at> gmail.com> writes:

> Hi everyone,
>
> Ricardo Wurmus <rekado <at> elephly.net> writes:
>
>> This looks good to me.  Thank you!
>
> I've committed this as 3cd4447f5639f45b7d833f6fb2adce11ea15ba1d.  If
> anybody has additional concerns about the installation script or the
> installation instructions, please open a new bug report for it and we
> can discuss the topic further there.
>
> Thank you for reporting this issue, Clément!

You're welcome Chris, thanks for the patch. :-)




Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Thu, 29 Mar 2018 10:09:02 GMT) Full text and rfc822 format available.

Message #73 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Ricardo Wurmus <rekado <at> elephly.net>
To: Clément Lassieur <clement <at> lassieur.org>
Cc: Chris Marusich <cmmarusich <at> gmail.com>, 30728 <at> debbugs.gnu.org
Subject: Re: bug#30728: guix-install.sh doesn't work if run with "sudo"
Date: Thu, 29 Mar 2018 12:07:50 +0200
Hi Clément,

> I am surprised that you didn't comment on
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30728#32 (where I explain
> to you why I disagree with Guix being installed in ~root) before saying
> LGTM.

Don’t be surprised: there are too many emails and I’m bound to forget
about some.  My apologies for not repyling to your email earlier.

I read your mail but I disagree with the conclusions.  It is not the job
of the installer script to install Guix for a particular user.  It is
for a site-wide installation, including the set up of the daemon and a
service script.  These things must happen as root.  The idea is that
Guix is installed for the whole site and made available to all users.

Individual users can then choose to use “guix pull” to control their own
version of Guix.

I consider it inelegant and dangerous to make the Guix installation of
an unprivileged user the variant of Guix that is used by all users on
the system.  Having it managed by the root user avoids surprises, even
on single-user systems, because the implication is that changes to the
root user’s Guix installation have system-wide effects.

The proposed patch is small and fixes the bug with regard to the
intention behind the script, so I’m happy to accept it.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net






Information forwarded to bug-guix <at> gnu.org:
bug#30728; Package guix. (Fri, 30 Mar 2018 22:08:01 GMT) Full text and rfc822 format available.

Message #76 received at 30728 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 30728 <at> debbugs.gnu.org
Subject: Re: bug#30728: guix-install.sh doesn't work if run with "sudo"
Date: Sat, 31 Mar 2018 00:07:45 +0200
Hi Ricardo,

Ricardo Wurmus <rekado <at> elephly.net> writes:

> Hi Clément,
>
>> I am surprised that you didn't comment on
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30728#32 (where I explain
>> to you why I disagree with Guix being installed in ~root) before saying
>> LGTM.
>
> Don’t be surprised: there are too many emails and I’m bound to forget
> about some.  My apologies for not repyling to your email earlier.

Thank you for your reply. :-)  I definitely understand.

> I read your mail but I disagree with the conclusions.  It is not the job
> of the installer script to install Guix for a particular user.  It is
> for a site-wide installation, including the set up of the daemon and a
> service script.  These things must happen as root.  The idea is that
> Guix is installed for the whole site and made available to all users.

The installation must happen with root privileges, but that doesn't mean
that Guix should be installed in ~root, because root is a particular
user.  See http://www.linfo.org/root.html:

    "/root contains configuration files for the root account, just as
    each ordinary user's home directory."

Thus I don't think things in ~root should be site-wide, and I have never
seen such things.  Site-wide stuff is usually in /var, /etc, etc.
(Which is not what I'm asking for, but in the long term it would be
better, in my opinion.)

> Individual users can then choose to use “guix pull” to control their own
> version of Guix.

And they will typically forget to update the daemon (and the site-wide
Guix).  Allowing a user to be responsible for updating Guix makes it
more likely to be updated.  Much more likely if the user doesn't need to
handle two different Guix installations.

> I consider it inelegant and dangerous to make the Guix installation of
> an unprivileged user the variant of Guix that is used by all users on
> the system.  Having it managed by the root user avoids surprises, even
> on single-user systems, because the implication is that changes to the
> root user’s Guix installation have system-wide effects.

I agree that those system-wide effects are not ideal, but I don't think
it's worse than the system-wide effects from ~root.  The implication you
are talking about isn't obvious to me, because root is a user as every
other, the only difference being its power.  Things root does shouldn't
have system-wide effects either.

And I wasn't asking to install Guix in the user's home, rather to let
them choose between two imperfect solutions.  In other words, to give
them more freedom.  For example if the user does 'sudo -E
./guix-install.sh', Guix would be installed in their home, whereas if
the user does 'sudo -H ./guix-install.sh', Guix would be installed in
~root.

Your script is very useful anyway, thank you for it!

Clément




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 28 Apr 2018 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 363 days ago.

Previous Next


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