guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ‘sudo’ leaves PATH unchanged… so what?


From: Ludovic Courtès
Subject: Re: ‘sudo’ leaves PATH unchanged… so what?
Date: Thu, 17 Jan 2019 13:35:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Ricardo Wurmus <address@hidden> skribis:

> Ludovic Courtès <address@hidden> writes:
>
>> Hello Guix,
>>
>> I’m not sure if this is a bug, but on Guix System, ‘sudo’ leaves PATH
>> unchanged:
>>
>> --8<---------------cut here---------------start------------->8---
>> $ sudo env|grep '^PATH='|sha1sum
>> 5236ce49c388ade7c3e8f767d8136c1c38a97c6a  -
>> $ env|grep '^PATH='|sha1sum
>> 5236ce49c388ade7c3e8f767d8136c1c38a97c6a  -
>> --8<---------------cut here---------------end--------------->8---
>>
>> I think that’s because the shell spawned by ‘sudo’ is not a login shell,
>> so ~root/.bash_profile and other files that define/modify environment
>> variables are not sourced.  So I think this is expected behavior.
>
> Yes, this is expected and desired behaviour.  Sysadmins generally use
> “su -” or “sudo -i” to get a “proper” root login shell because of this.

OK.

>> However, it trips up many people.  In particular, people are surprised
>> that “sudo guix system reconfigure …” does not use ~root/.config/guix,
>> and instead uses theirs (or /run/current-system/profile/…).
>>
>> My take on this is that this is normal behavior, but that we should
>> maybe recommend “sudo -i guix system reconfigure …” instead of
>> “sudo guix system reconfigure” in the manual, and/or add a warning in
>> the manual.
>
> Why would we want to recommend the use of the root user’s installation
> of Guix, though?  I usually don’t care at all about the root user’s
> Guix.

Yeah, you’re right.

I think the main reason would be this bit in the manual:

--8<---------------cut here---------------start------------->8---
@cindex upgrading GuixSD
>From then on, you can update GuixSD whenever you want by running @command{guix
pull} as @code{root} (@pxref{Invoking guix pull}), and then running
@command{guix system reconfigure /etc/config.scm}, as @code{root} too, to
--8<---------------cut here---------------end--------------->8---

To many, this translates to:

  sudo guix pull
  sudo guix system …

… which doesn’t do what one might think before “sudo guix pull” updates
root’s ‘guix’ whereas “sudo guix system” uses the user’s ‘guix’.

Either we should rephrase it or perhaps explicitly write:

  From then on, you can update GuixSD whenever you want by running:

  @example
  guix pull
  sudo guix system reconfigure /etc/config.scm
  @end example

WDYT?

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]