unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* Root guix dereferencing
@ 2018-11-17 11:17 Thorsten Wilms
  2018-11-18 23:06 ` Leo Famulari
  0 siblings, 1 reply; 10+ messages in thread
From: Thorsten Wilms @ 2018-11-17 11:17 UTC (permalink / raw)
  To: help-guix

Hi!

It took me embarrassingly long to understand that I have been updating 
guix for the root profile numerous times without `sudo guix ...` ever 
pointing to the latest version. This is on Ubuntu 18.04, so there's not 
a full root account.

The state of things, bash output reduced to the relevant parts:

~: sudo ls -l /root/.guix-profile
/root/.guix-profile -> /var/guix/profiles/per-user/root/guix-profile

~: ls -l /var/guix/profiles/per-user/root/guix-profile
/var/guix/profiles/per-user/root/guix-profile -> guix-profile-3-link

~: ls -l /var/guix/profiles/per-user/root/guix-profile-3-link
/var/guix/profiles/per-user/root/guix-profile-3-link -> 
/gnu/store/9gnbk30krxri2rnslpy9pjqrn0dgpzz9-profile

~: stat /gnu/store/9gnbk30krxri2rnslpy9pjqrn0dgpzz9-profile
Change: 2018-09-13 19:23:18.128577196 +0200


2018-09-13 seems to be the date of installation. The last `sudo guix 
pull` happened yesterday.


~: sudo which guix
/usr/local/bin/guix

~: ls -l /usr/local/bin/guix
/usr/local/bin/guix -> 
/var/guix/profiles/per-user/root/guix-profile/bin/guix

~: ls -l /var/guix/profiles/per-user/root/guix-profile/bin/guix
/var/guix/profiles/per-user/root/guix-profile/bin/guix -> 
/gnu/store/xdgjm8slg17gvwqnask6y4fzz7shkf1p-guix-0.15.0-2.8bbb79c/bin/guix

~: stat 
/gnu/store/xdgjm8slg17gvwqnask6y4fzz7shkf1p-guix-0.15.0-2.8bbb79c/bin/guix
Change: 2018-09-13 19:23:15.888610656 +0200


~: sudo env | grep GUIX
<empty>

~: sudo env | grep PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin


Puzzling to me: things are quite different after `sudo -i`:

root@charly:~# which guix
/root/.guix-profile/bin/guix

root@charly:~# ls -l /root/.guix-profile/bin/guix
/gnu/store/xdgjm8slg17gvwqnask6y4fzz7shkf1p-guix-0.15.0-2.8bbb79c/bin/guix

root@charly:~# stat 
/gnu/store/xdgjm8slg17gvwqnask6y4fzz7shkf1p-guix-0.15.0-2.8bbb79c/bin/guix
Change: 2018-09-13 19:23:15.888610656 +0200

root@charly:~# env|grep GUIX
GUIX_LOCPATH=/root/.guix-profile/lib/locale

root@charly:~# env|grep PATH
GUIX_LOCPATH=/root/.guix-profile/lib/locale
PATH=/root/.guix-profile/bin:/root/.guix-profile/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin


How may I fix my installation?

-- 
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Root guix dereferencing
  2018-11-17 11:17 Root guix dereferencing Thorsten Wilms
@ 2018-11-18 23:06 ` Leo Famulari
  2018-11-19  9:12   ` Thorsten Wilms
  0 siblings, 1 reply; 10+ messages in thread
From: Leo Famulari @ 2018-11-18 23:06 UTC (permalink / raw)
  To: Thorsten Wilms; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 336 bytes --]

On Sat, Nov 17, 2018 at 12:17:58PM +0100, Thorsten Wilms wrote:
> How may I fix my installation?

Can you help us by clarifying exactly what is wrong?

In general, using sudo without either the --preserve-env or --login
options is not recommended, because it won't do what you want in any
case where environment variables are involved.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Root guix dereferencing
  2018-11-18 23:06 ` Leo Famulari
@ 2018-11-19  9:12   ` Thorsten Wilms
  2018-11-19 10:20     ` Clément Lassieur
  0 siblings, 1 reply; 10+ messages in thread
From: Thorsten Wilms @ 2018-11-19  9:12 UTC (permalink / raw)
  Cc: help-guix

On 19/11/2018 00.06, Leo Famulari wrote:
> Can you help us by clarifying exactly what is wrong?
> 
> In general, using sudo without either the --preserve-env or --login
> options is not recommended, because it won't do what you want in any
> case where environment variables are involved.

/usr/local/bin/guix and /root/.guix-profile/bin/guix keep pointing to 
the original guix installation.

I tried all of these, each time with
--commit=0a41123f01d5d2466d6f533be3644ac8c9a2bdf9:

sudo guix pull
sudo -i guix pull
sudo -E
   guix pull

None of these changed what /usr/local/bin/guix and/or 
/root/.guix-profile/bin/guix are pointing to.


-- 
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Root guix dereferencing
  2018-11-19  9:12   ` Thorsten Wilms
@ 2018-11-19 10:20     ` Clément Lassieur
  2018-11-19 11:47       ` Thorsten Wilms
  0 siblings, 1 reply; 10+ messages in thread
From: Clément Lassieur @ 2018-11-19 10:20 UTC (permalink / raw)
  To: t_w_; +Cc: help-guix

Hi Thorsten,

This is because the result of running guix pull is a profile available
under ~/.config/guix/current containing the latest Guix[1].

So you may need to make sure it is at the beginning of your search path.

[1]: https://www.gnu.org/software/guix/manual/en/html_node/Invoking-guix-pull.html

Thorsten Wilms <t_w_@freenet.de> writes:

> On 19/11/2018 00.06, Leo Famulari wrote:
>> Can you help us by clarifying exactly what is wrong?
>>
>> In general, using sudo without either the --preserve-env or --login
>> options is not recommended, because it won't do what you want in any
>> case where environment variables are involved.
>
> /usr/local/bin/guix and /root/.guix-profile/bin/guix keep pointing to the
> original guix installation.
>
> I tried all of these, each time with
> --commit=0a41123f01d5d2466d6f533be3644ac8c9a2bdf9:
>
> sudo guix pull
> sudo -i guix pull
> sudo -E
>   guix pull
>
> None of these changed what /usr/local/bin/guix and/or
> /root/.guix-profile/bin/guix are pointing to.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Root guix dereferencing
  2018-11-19 10:20     ` Clément Lassieur
@ 2018-11-19 11:47       ` Thorsten Wilms
  2018-11-19 14:07         ` Clément Lassieur
  0 siblings, 1 reply; 10+ messages in thread
From: Thorsten Wilms @ 2018-11-19 11:47 UTC (permalink / raw)
  To: help-guix

On 19/11/2018 11.20, Clément Lassieur wrote:

> This is because the result of running guix pull is a profile available
> under ~/.config/guix/current containing the latest Guix[1].
> 
> So you may need to make sure it is at the beginning of your search path.

Thanks, but the plain user `guix pull` works fine and 
~/.config/guix/current is up-to-date.


> [1]: https://www.gnu.org/software/guix/manual/en/html_node/Invoking-guix-pull.html

I note that this page doesn't contain "sudo" at all and "root" only 
once, in "For instance, when user root runs guix pull, this has no 
effect on the version of Guix that user alice sees, and vice versa.".

> Thorsten Wilms <t_w_@freenet.de> writes:

>> I tried all of these, each time with
>> --commit=0a41123f01d5d2466d6f533be3644ac8c9a2bdf9:
>>
>> sudo guix pull
>> sudo -i guix pull
>> sudo -E
>>    guix pull
>>
>> None of these changed what /usr/local/bin/guix and/or
>> /root/.guix-profile/bin/guix are pointing to.

I mixed -i and -E up, it was of course

sudo -E guix pull
sudo -i
   guix pull

That is, first attempt with -E, same as --preserve-env, then sudo -i to 
log into root before `guix pull`.


-- 
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Root guix dereferencing
  2018-11-19 11:47       ` Thorsten Wilms
@ 2018-11-19 14:07         ` Clément Lassieur
  2018-11-19 14:32           ` Thorsten Wilms
  0 siblings, 1 reply; 10+ messages in thread
From: Clément Lassieur @ 2018-11-19 14:07 UTC (permalink / raw)
  To: t_w_; +Cc: help-guix

Thorsten Wilms <t_w_@freenet.de> writes:

> On 19/11/2018 11.20, Clément Lassieur wrote:
>
>> This is because the result of running guix pull is a profile available
>> under ~/.config/guix/current containing the latest Guix[1].
>>
>> So you may need to make sure it is at the beginning of your search path.
>
> Thanks, but the plain user `guix pull` works fine and ~/.config/guix/current
> is up-to-date.

In case it's not clear, '~' refers to root's home as well.  'root' is
just a user.  You don't even have to use it at all.  (I personally never
use it.)

>> [1]: https://www.gnu.org/software/guix/manual/en/html_node/Invoking-guix-pull.html
>
> I note that this page doesn't contain "sudo" at all and "root" only once, in
> "For instance, when user root runs guix pull, this has no effect on the
> version of Guix that user alice sees, and vice versa.".

It doesn't need to contain 'sudo' and 'root', because 'root' is just a
user, so everything works the same way.

Clément

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Root guix dereferencing
  2018-11-19 14:07         ` Clément Lassieur
@ 2018-11-19 14:32           ` Thorsten Wilms
  2018-11-19 15:06             ` Clément Lassieur
  0 siblings, 1 reply; 10+ messages in thread
From: Thorsten Wilms @ 2018-11-19 14:32 UTC (permalink / raw)
  To: Clément Lassieur; +Cc: help-guix

On 19/11/2018 15.07, Clément Lassieur wrote:
> It doesn't need to contain 'sudo' and 'root', because 'root' is just a
> user, so everything works the same way.

$: which guix
/home/thorwil/.config/guix/current/bin/guix

$: sudo which guix
/usr/local/bin/guix

$ sudo -E which guix
/usr/local/bin/guix

$: sudo -i
root@charly:~# which guix
/root/.guix-profile/bin/guix

I wouldn't describe that as working the same way, especially since only 
the symlinks for the plain user are being updated.


-- 
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Root guix dereferencing
  2018-11-19 14:32           ` Thorsten Wilms
@ 2018-11-19 15:06             ` Clément Lassieur
  2018-11-19 17:08               ` Thorsten Wilms
  0 siblings, 1 reply; 10+ messages in thread
From: Clément Lassieur @ 2018-11-19 15:06 UTC (permalink / raw)
  To: t_w_; +Cc: help-guix

Thorsten Wilms <t_w_@freenet.de> writes:

> On 19/11/2018 15.07, Clément Lassieur wrote:
>> It doesn't need to contain 'sudo' and 'root', because 'root' is just a
>> user, so everything works the same way.
>
> $: which guix
> /home/thorwil/.config/guix/current/bin/guix
>
> $: sudo which guix
> /usr/local/bin/guix
>
> $ sudo -E which guix
> /usr/local/bin/guix
>
> $: sudo -i
> root@charly:~# which guix
> /root/.guix-profile/bin/guix
>
> I wouldn't describe that as working the same way, especially since only the
> symlinks for the plain user are being updated.

If you check ~root/.config/guix/current/bin/guix, you'll see that it's
updated when you run 'guix pull' as root.  If you want that guix to be
used for your 'root' user, you just need to make sure
~root/.config/guix/current/bin/ is first in root's $PATH.

You can substitute 'root' with whatever else in the above statement.

'sudo', however, is more tricky to use.  I only use it for 'guix system
reconfigure' because it requires root's privileges.  'sudo -E guix
system reconfigure config.scm' would for example use my own environment
variables, thus my own guix, with root's privileges.

If you are using Ubuntu, you don't need to use that command though, but
you need your systemd's guix-daemon to point to a recent guix.  It could
be either the one updated by root's 'guix pull', or the one updated by
your current user's 'guix pull'.  I chose the latter because I want to
run 'guix pull' only once.

Does it make more sense?
Clément

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Root guix dereferencing
  2018-11-19 15:06             ` Clément Lassieur
@ 2018-11-19 17:08               ` Thorsten Wilms
  2018-11-19 18:27                 ` Clément Lassieur
  0 siblings, 1 reply; 10+ messages in thread
From: Thorsten Wilms @ 2018-11-19 17:08 UTC (permalink / raw)
  To: help-guix

On 19/11/2018 16.06, Clément Lassieur wrote:
> If you check ~root/.config/guix/current/bin/guix, you'll see that it's
> updated when you run 'guix pull' as root.  If you want that guix to be
> used for your 'root' user, you just need to make sure
> ~root/.config/guix/current/bin/ is first in root's $PATH.

I could bet last time I checked, there was not "current", only "latest", 
below ~root/.config/guix, but indeed, there's a recently changed 
~root/.config/guix/current/bin/guix.


> If you are using Ubuntu, you don't need to use that command though, but
> you need your systemd's guix-daemon to point to a recent guix.  It could
> be either the one updated by root's 'guix pull', or the one updated by
> your current user's 'guix pull'.  I chose the latter because I want to
> run 'guix pull' only once.

You mean edit /etc/systemd/guix-daemin.service and change 
"/var/guix/profiles/per-user/root/guix-profile/bin/guix-daemon"?

If so, to what, as there's no guix-daemon in 
/var/guix/profiles/per-user/root/guix-profile/bin/.

Is the whole reason to have /usr/local/bin/guix to make guix available 
for root without modifying root's PATH?


Things are a bit clearer now, thanks, Clément.

-- 
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Root guix dereferencing
  2018-11-19 17:08               ` Thorsten Wilms
@ 2018-11-19 18:27                 ` Clément Lassieur
  0 siblings, 0 replies; 10+ messages in thread
From: Clément Lassieur @ 2018-11-19 18:27 UTC (permalink / raw)
  To: t_w_; +Cc: help-guix

Thorsten Wilms <t_w_@freenet.de> writes:

>> If you are using Ubuntu, you don't need to use that command though, but
>> you need your systemd's guix-daemon to point to a recent guix.  It could
>> be either the one updated by root's 'guix pull', or the one updated by
>> your current user's 'guix pull'.  I chose the latter because I want to
>> run 'guix pull' only once.
>
> You mean edit /etc/systemd/guix-daemin.service and change
> "/var/guix/profiles/per-user/root/guix-profile/bin/guix-daemon"?

Well...  The problem with the default one is that it's not updated by
'guix pull', rather it's updated when root's guix package[1] is updated
(that is: less often).  It's not a big deal though, because
'guix-daemon' is very stable, rarely changed.

(Actually, there is no difference at the moment, because I believe 'guix
pull' uses the daemon of the guix package.  But there might be a
difference in the future.)

tldr: you don't need to change your guix-daemon :/

> If so, to what, as there's no guix-daemon in
> /var/guix/profiles/per-user/root/guix-profile/bin/.

To /home/<your-user>/.config/guix/current/bin/guix-daemon or
/root/.config/guix/current/bin/guix-daemon, depending on whether you
want to use your user's Guix-daemon or root's Guix-daemon.

But your current situation is fine :)

> Is the whole reason to have /usr/local/bin/guix to make guix available for
> root without modifying root's PATH?

The reason is to make the 'guix' command available to every user,
because /usr/local/bin is supposedly in every user's PATH.  You don't
need it anymore if all your users already have their own 'guix' command.

> Things are a bit clearer now, thanks, Clément.

This stuff is pretty complicated anyway.  You're welcome :-)

Clément

[1]: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/package-management.scm#n100

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-11-19 18:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-17 11:17 Root guix dereferencing Thorsten Wilms
2018-11-18 23:06 ` Leo Famulari
2018-11-19  9:12   ` Thorsten Wilms
2018-11-19 10:20     ` Clément Lassieur
2018-11-19 11:47       ` Thorsten Wilms
2018-11-19 14:07         ` Clément Lassieur
2018-11-19 14:32           ` Thorsten Wilms
2018-11-19 15:06             ` Clément Lassieur
2018-11-19 17:08               ` Thorsten Wilms
2018-11-19 18:27                 ` Clément Lassieur

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