Need help diagnosing the error I got from first install attempt

The floxmeta private repo was created alright, though I wasn’t expecting flox to run the gh CLI on my behalf as a newcomer. I expect that’s covered in a user manual I haven’t read yet.

I think Git is trying to insist on signing something because of the global config.

❯ sudo apt install /tmp/flox.x86_64-linux.deb
# ...

❯ flox install cowsay
Updating git config "/home/kbingham/.config/flox/gitconfig"
> Do you consent to the collection of basic usage metrics? Yes

    Thank you for helping to improve flox!
    
Did not find "/home/kbingham/.config/flox/floxUserMeta.json", continuing without user channels
Updating /home/kbingham/.config/flox/nix.conf
error: gpg failed to sign the data
fatal: failed to write commit object
++++ /nix/store/l5h79qqg73cgjvhkyp1g93r1kg2j10qa-flox-0.0.10-r205/libexec/flox/gh repo create --private https://github.com/qrkourier/floxmeta --template https://github.com/flox/floxmeta-template.git
error: pathspec 'floxmain' did not match any file(s) known to git
error: gpg failed to sign the data
fatal: failed to write commit object
fatal: invalid object name 'floxmain'.
error: pathspec 'floxmain' did not match any file(s) known to git

❯ flox install cowsay
ERROR: missing field `channels` at line 4 column 1

❯ which cowsay
cowsay not found

❯ git config --global commit.gpgSign
true

This seems to confirm it was a global Git option.

❮ rm -rfv ~/.config/flox/        
removed '/home/kbingham/.config/flox/floxUserMeta.json'
removed '/home/kbingham/.config/flox/nix.conf'
removed '/home/kbingham/.config/flox/gitconfig'
removed directory '/home/kbingham/.config/flox/'

❯ GIT_CONFIG_GLOBAL=/dev/null flox install cowsay
Updating git config "/home/kbingham/.config/flox/gitconfig"
Did not find "/home/kbingham/.config/flox/floxUserMeta.json", continuing without user channels
Updating /home/kbingham/.config/flox/nix.conf
error: pathspec 'floxmain' did not match any file(s) known to git
created generation 1

❯ flox activate
flox [default] 

❯ cowsay more\ better
 _____________ 
< more better >
 ------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
flox [default] 

I wondered whether flox was failing because git couldn’t get a tty, so I tried it with the signing cred cached so it wouldn’t need to prompt for pinentry. If I can figure out where the git working copy is located I can set a local git config to not attempt signing. I’d like to avoid changing the global config.

❯ flox destroy --environment qrkourier/default
flox [default] 

❯ rm -rfv ~/.config/flox/
removed '/home/kbingham/.config/flox/floxUserMeta.json'
removed '/home/kbingham/.config/flox/nix.conf'
removed '/home/kbingham/.config/flox/gitconfig'
removed '/home/kbingham/.config/flox/floxFlakeRegistry.json'
removed directory '/home/kbingham/.config/flox/'

❯ gpg --clearsign
gpg: using "5489E13F810564DF47FB9841B69403FA957C5E46" as default secret key for signing
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512


-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEVInhP4EFZN9H+5hBtpQD+pV8XkYFAmQeA2QACgkQtpQD+pV8
XkbMahAAlfsldUvl7lMyfmmxNTy6AzVFX/D7ctjp31v3D64idY14AeUA3L32SzPg
hkEhMdukxAxG6NpT13Bk6ykGdzlFSNmwhvWyqv5lellPHt2eb8xdiasbJPqjiMld
FzsotdK3OW1IwlGmqKM/2fiNKm3/PUAC98IxETxopVaCqEr3kj/jzFS5swXNw7ZQ
akNyCAd7qRjDPyQJHIYKoLR36AvlKoxptc9sJgOBPAme74XT0650Wlcov6Rcm5f9
dezMXFdNuaVPFIrFxuIOOBiBhVPpLbiAQotOZJZuYSJ2sHid1CS6smip+N9kb/uf
S9q1MwkDTuYX84O35GV48V+Ci/BMvnK2PMebW2Wdj9WRATYDkR2ajFbVcZGwGC6a
UQ6kKyP3Dn5pVcahnyahcEScgA+euipmrFPxH4T1/ugetEowDH/QRHmHoIoCHP3h
U1/xR8D8Ezsx4s0RYDyekZROZ/YUFAzZlRW+PorptG3HaBm33friYMUWAbRoUQZE
zNK4wBukcdx9Km4QuRtXpmflh29T+nZGyYDw6c32yyhMvkRzv22B7KDi5vWrB9uh
lz8UgpVq55HfGVVsodNWD6pXVsDScgTl3O546Tw9QUwyocMd0lnMI5A9KPmwwu1+
yv2nkBI8M8dEo9ULYAoXbo3sQpzi1V0+Ux5nulHRb4sEYpLmmk8=
=Bbd3
-----END PGP SIGNATURE-----

❯ flox install cowsay
Updating git config "/home/kbingham/.config/flox/gitconfig"
Did not find "/home/kbingham/.config/flox/floxUserMeta.json", continuing without user channels
Updating /home/kbingham/.config/flox/nix.conf
error: gpg failed to sign the data
fatal: failed to write commit object

Howdy, sorry to hear that you’re having install troubles. I’ll send this along to the engineers to get you some help.

We’ll do some debugging with you on Monday.

Hmm, I also use GPG signing and didn’t have problems with Flox. I use gpg for windows though that is used through WSL binding and win-gpg-agent. Maybe the gpg-agent is not saving data in this special case ? Have you tried pinnning gpg binary in .gitconfig to one you use outside flox ?

Thanks!

I encountered the same error after pinning the gpg executable. Additionally, I tried installing a GTK pinentry program, restarted gpg-agent. I get the same result whether or not the default signing key is cached by a recent, prior signing action.

❯ git config --global gpg.program $(which gpg)

❯ git config --global gpg.program             
/usr/bin/gpg

❯ flox install cowsay
Updating git config "/home/kbingham/.config/flox/gitconfig"
Did not find "/home/kbingham/.config/flox/floxUserMeta.json", continuing without user channels
Updating /home/kbingham/.config/flox/nix.conf
error: gpg failed to sign the data
fatal: failed to write commit object

❯ git config --global --list    
init.defaultbranch=main
init.templatedir=~/.git_template
push.default=current
color.ui=auto
alias.aa=add --all
alias.ap=add --patch
alias.branches=for-each-ref --sort=-committerdate --format="%(color:blue)%(authordate:relative)	%(color:red)%(authorname)	%(color:white)%(color:bold)%(refname:short)" refs/remotes
alias.ci=commit -v
alias.co=checkout
alias.pf=push --force-with-lease
alias.st=status
alias.br=branch
core.excludesfile=~/.gitignore
core.autocrlf=input
merge.ff=only
commit.template=~/.gitmessage
commit.gpgsign=true
fetch.prune=true
rebase.autosquash=true
rebase.instructionformat=(%an <%ae>) %s
include.path=~/.gitconfig.local
diff.colormoved=zebra
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
pager.log=less --quit-if-one-screen --no-init
gpg.program=/usr/bin/gpg

I was able to reproduce your issue by running:

git config commit.gpgsign true;
flox create -e foo;

For the time being you could do something like:

GIT_CONFIG_TMP="$( mktemp; )";
cp "${GIT_CONFIG_SYSTEM:-/etc/gitconfig}" "$GIT_CONFIG_TMP";
git config -f "$GIT_CONFIG_TMP" commit.gpgsign false;
GIT_CONFIG_SYSTEM="$GIT_CONFIG_TMP" flox <CMD>;

Having said that, this is obnoxious and I’ll be chasing down a real solution.
I’ll pass this off to the engineering team to investigate; hopefully we can get a quick fix.

1 Like

I just tested out my local cached repo and it is signed

λ C:\Users\dgoslawski\scoop\apps\gpg\current\bin\gpg.exe --version
gpg (GnuPG) 2.4.0
libgcrypt 1.10.1

with win-gpg-agent from scoop also

Thank you! I’m unblocked with this workaround. It was the global config causing my issue so I adapted your script to use a temporary modification of that file.

❯ which flox_install
flox_install () {
        [[ $# -eq 1 ]] || {
                echo "ERROR: usage: flox_install PACKAGE" >&2
                return 1
        }
        (
                set -euo pipefail
                GIT_CONFIG_TMP="$( mktemp )" 
                cp "${GIT_CONFIG_GLOBAL:-${HOME}/.gitconfig}" "$GIT_CONFIG_TMP"
                GIT_CONFIG_GLOBAL="$GIT_CONFIG_TMP" git config --global commit.gpgsign false
                GIT_CONFIG_GLOBAL="$GIT_CONFIG_TMP" flox install $1
        )
}

❯ git config --global commit.gpgSign
true

❯ flox_install cowsay
Did not find 'channels' in "/home/kbingham/.config/flox/floxUserMeta.json", consider running 'flox subscribe'
Installed 'cowsay' package(s) into 'default' environment.

❯ git config --global commit.gpgSign 
true

❯ flox activate
Did not find 'channels' in "/home/kbingham/.config/flox/floxUserMeta.json", consider running 'flox subscribe'

flox [default] 
❯ cowsay more\ better
 _____________ 
< more better >
 ------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
2 Likes

Hi @qrKourier - so glad to hear you are unblocked!
We have logged the bug to sort a proper fix and look forward to rolling it out in a future release.