Subject: bug#37939: guix-install.sh: Fails to detect signing key on Debian10.

From: Bengt Richter <[email-masked]>
Date: Sun, 27 Oct 2019 05:15:17 -0700

Hi again Kai,

On +2019-10-27 09:59:39 +0100, Kai Mertens wrote:
> Dear GNU Guix developers,
> 
> I just tried to install guix on top of a fresh debian10 system, which
> has been installed from debian-live-10.0.0-amd64-gnome.iso and updated.
> 
> The guix install script fails in function chk_gpg_keyring(), although
> the key is present.
> 
> If I remove the discard redirection >/dev/null 2>&1 from the gpg
> command, the following message occurs:
> 
>  gpg: keyblock resource '/root/.gnupg/pubring.kbx': No such file or directory
>  gpg: Fatal: /root/.gnupg: directory does not exist!
> 
> Of course these files do not exist, as I imported the key to the user
> account, not to the root account. Then I executed the script as user,
> using sudo.
> 
> This procedure works fine on trisquel7 or 8, but it fails on debian10.
> 
> I wonder why ‘sudo gpg’ does not make a difference between being called
> via sudo versus being called as root.
>

man sudo ;-)

specifically the -i option

I think if you are a "sudoer" plain sudo switches you to root,
but keeps the environment you were in, with PATH etc, but
sudo -i will set the environment as if you logged in as root.

try "sudo set" and compare with "sudo -i set" 
(or env in place of set)

HTH
--
Regards,
Bengt Richter