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: Ricardo Wurmus
Subject: Re: ‘sudo’ leaves PATH unchanged… so what?
Date: Thu, 17 Jan 2019 12:14:18 +0100
User-agent: mu4e 1.0; emacs 26.1

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.

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

--
Ricardo




reply via email to

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