gopasspw / gopass

The slightly more awesome standard unix password manager for teams
https://www.gopass.pw/
MIT License
5.95k stars 496 forks source link

panic: invalid argument - initializing #786

Closed klauern closed 6 years ago

klauern commented 6 years ago

I get this when using both master and the 1.7.0 alpha version. I don't have any GPG keys defined on this box, so it appears to be part of the initialization steps:

$ gopass
It seems you are new to gopass. Do you want to run the onboarding wizard? [Y/n/q]: Y
[init] No useable crypto keys. Generating new key pair
[init] [crypto] Key generation may take up to a few minutes
[init] [crypto] Creating key pair ...
[init] [crypto] WARNING: We are about to generate some GPG keys.
[init] [crypto] However, the GPG program can sometimes lock up, displaying the following:
"We need to generate a lot of random bytes."
If this happens, please see the following tips:
https://github.com/justwatchcom/gopass/blob/master/docs/entropy.md
Continue? [Y/n/q]: Y
gpg (GnuPG) 2.1.11; Copyright (C) 2016 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Note: Use "gpg2 --full-gen-key" for a full featured key generation dialog.

GnuPG needs to construct a user ID to identify your key.

Real name: Nick Klauer
Email address: klauer@gmail.com
You selected this USER-ID:
    "Nick Klauer <klauer@gmail.com>"

Change (N)ame, (E)mail, or (O)kay/(Q)uit? O
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: key 8161CFC4 marked as ultimately trusted
gpg: directory '/home/klauer/.gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/home/klauer/.gnupg/openpgp-revocs.d/A559E4A5D4B7AE47FCB2595AB48474AD8161CFC4.rev'
public and secret key created and signed.

gpg: checking the trustdb
gpg: marginals needed: 3  completes needed: 1  trust model: PGP
gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
pub   rsa2048/8161CFC4 2018-05-18 [S]
      Key fingerprint = A559 E4A5 D4B7 AE47 FCB2  595A B484 74AD 8161 CFC4
uid         [ultimate] Nick Klauer <klauer@gmail.com>
sub   rsa2048/70FFC389 2018-05-18 []

 -> OK
[init] [crypto] Public key exported to '0xB48474AD8161CFC4.pub.key'
[init] [crypto] Done
panic: invalid argument

goroutine 1 [running]:
github.com/justwatchcom/gopass/pkg/cui.GetSelection(0xdb9600, 0xc42036c630, 0xd149bb, 0xd, 0xd39814, 0x41, 0xc42036ca80, 0x3, 0x3, 0x0, ...)
        /home/tex/src/go/src/github.com/justwatchcom/gopass/pkg/cui/cui.go:177 +0x4af
github.com/justwatchcom/gopass/pkg/action.(*Action).InitOnboarding(0xc4202e1d50, 0xdb9600, 0xc42036c630, 0xc4201c8840, 0x1, 0x1)
        /home/tex/src/go/src/github.com/justwatchcom/gopass/pkg/action/init.go:194 +0x848
github.com/justwatchcom/gopass/pkg/action.(*Action).Initialized(0xc4202e1d50, 0xdb9600, 0xc42017dbc0, 0xc4201c8840, 0xc42017dbc0, 0xc42018bc80)
        /home/tex/src/go/src/github.com/justwatchcom/gopass/pkg/action/init.go:32 +0x1c0
main.setupApp.func2(0xc4201c8840, 0xc4201c8840, 0xc42018bc67)
        /home/tex/src/go/src/github.com/justwatchcom/gopass/app.go:66 +0x196
github.com/justwatchcom/gopass/vendor/github.com/urfave/cli.HandleAction(0xbbd980, 0xc4201f76e0, 0xc4201c8840, 0xc420087aa0, 0x0)
        /home/tex/src/go/src/github.com/justwatchcom/gopass/vendor/github.com/urfave/cli/app.go:501 +0xc8
github.com/justwatchcom/gopass/vendor/github.com/urfave/cli.(*App).Run(0xc4201b41c0, 0xc4200a6190, 0x1, 0x1, 0x0, 0x0)
        /home/tex/src/go/src/github.com/justwatchcom/gopass/vendor/github.com/urfave/cli/app.go:268 +0x60c
main.main()
        /home/tex/src/go/src/github.com/justwatchcom/gopass/main.go:64 +0x2d7
dominikschulz commented 6 years ago

Thanks a lot for your bug report. This feedback is very valuable for us! We'll look into it and try to fix it for the next release.

dominikschulz commented 6 years ago

It looks like some issue with your environment or the UI libs we're using. Could you please try running with GOPASS_CUI_TERMWIZ=true set?

klauern commented 6 years ago

I wasn't getting that prompt for Local, Create Team, etc., but adding that GOPASS_CUI_TERMWIZ variable, I can now create stuff with it and initialize the passwordstore.

That seems to work.

klauern commented 6 years ago

Does this dialog only come up on the first run of gopass on a new system? When else would you be able to select to join another team or create a team? I'm having trouble seeing where you could run this command outside of a fresh install.

dominikschulz commented 6 years ago

Thanks for trying this out. Unfortunately I don't see a way to "fix" this unless we can reproduce it somehow. These CLI UI libs sometimes have issues with certain terminal configurations. The stacktrace clearly points to an initialization problem in the UI lib and there seems to be nothing wrong with what gopass is doing.

This dialog should be brought up as part of the onboarding process if gopass detects that there is neither an existing store nor a config file.

dominikschulz commented 6 years ago

We've updated the terminal libs a few days ago in https://github.com/gopasspw/gopass/commit/87b643f683bc238a31d9e6c81525a422a4614a01

Could you please check if this problem still occurs with the current master?

espoelstra commented 6 years ago

@klauern if available can you run infocmp and echo $TERM to see what terminal type your system is reporting?

pjoe commented 6 years ago

I've been seeing similar error running on byobu in WSL (ubuntu 16.04).

$ echo $TERM
screen
$ infocmp
#       Reconstructed via infocmp from file: /lib/terminfo/s/screen
screen|VT 100/ANSI X3.64 virtual terminal,
        am, km, mir, msgr, xenl,
        colors#8, cols#80, it#8, lines#24, ncv@, pairs#64,
        acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
        bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l,
        clear=\E[H\E[J, cnorm=\E[34h\E[?25h, cr=^M,
        csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H,
        cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C,
        cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM,
        cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m,
        dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K,
        enacs=\E(B\E)0, flash=\Eg, home=\E[H, ht=^I, hts=\EH,
        ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0,
        kbs=\177, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC,
        kcuu1=\EOA, kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~,
        kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS,
        kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~,
        khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~,
        nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O,
        rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m,
        rmul=\E[24m, rs2=\Ec\E[?1000l\E[?25h, sc=\E7,
        setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
        sgr=\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;m%?%p9%t\016%e\017%;,
        sgr0=\E[m\017, smacs=^N, smcup=\E[?1049h, smir=\E[4h,
        smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g,
$ gopass --version
gopass 1.8.0-alpha.0 (087ac3820d05813ef8c90f3bbd087fb6efe77dd5) go1.10 linux amd64
stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.