keybase / keybase-issues

A single repo for managing publicly recognized issues with the keybase client, installer, and website.
902 stars 37 forks source link

Inappropriate ioctl for device #1712

Open kusold opened 9 years ago

kusold commented 9 years ago

I'm getting the following error when trying to decrypt using keybase. Please let me know what debugging logs/steps you need.

❯ echo "foo" | keybase encrypt mike | keybase decrypt
warn: [GNUPG:] ENC_TO 8F5A1E88E78559A3 1 0
warn: [GNUPG:] PINENTRY_LAUNCHED 31254
warn: gpg: encrypted with 4096-bit RSA key, ID 8F5A1E88E78559A3, created 2014-02-19
warn:       "keybase.io/mike <mike@keybase.io>"
warn: gpg: public key decryption failed: Inappropriate ioctl for device
warn: [GNUPG:] ERROR pkdecrypt_failed 83918950
warn: [GNUPG:] BEGIN_DECRYPTION
warn: [GNUPG:] DECRYPTION_FAILED
warn: gpg: decryption failed: No secret key
warn: [GNUPG:] END_DECRYPTION
error: `gpg` exited with code 2

~
❯ echo "foo" | keybase encrypt mike | gpg -d

You need a passphrase to unlock the secret key for
user: "keybase.io/mike <mike@keybase.io>"
4096-bit RSA key, ID E78559A3, created 2014-02-19 (main key ID 5E57FEBF)

gpg: encrypted with 4096-bit RSA key, ID E78559A3, created 2014-02-19
      "keybase.io/mike <mike@keybase.io>"
foo
❯ keybase version
keybase (keybase.io CLI) v0.8.15
- node.js v0.10.25
- gpg (GnuPG) 2.1.5
- libgcrypt 1.6.3
Identifies as: 'keybase.io node.js client v0.8.15 linux'
❯ gpg -h
gpg (GnuPG) 1.4.19
oconnor663 commented 9 years ago

Could you do this for us please, and copy in all the output?

echo foo | keybase encrypt mike > /tmp/message
keybase -d decrypt /tmp/message
kusold commented 9 years ago

I must be going crazy (or a reboot fixed this), but it works now. I can still provide the debug output, but I doubt it will be useful.

❯ echo "foo" | keybase encrypt mike | keybase decrypt
foo
oconnor663 commented 9 years ago

Haven't seen that Inappropriate ioctl for device error before. Maybe you did a kernel update but hadn't rebooted yet? Thanks for the report either way.

kusold commented 9 years ago

I'm not finding any yum updates in my history near the time this issue started showing up. It is a possibility though. I often update then don't restart for a week. I also have a yubikey that is configured, although I tried the decrypt with both it plugged in and unplugged (my keybase private key isn't on it)

kusold commented 9 years ago

I managed to reproduce this again. I got the Inappropriate ioctl for device error, and immediately came here for the debug steps. The debug steps prompted me to enter my passphrase and decrypted properly. After running the debug steps, I am able to decrypt messages like normal.

I think the issue has something to do with keybase not prompting me to enter my passphrase. However, something is different in the debugging steps, because that does do the prompt.

❯ echo foo | keybase encrypt mike > /tmp/message

~
❯ keybase -d decrypt /tmp/message
debug:  Fallback to layout_v1
debug: + opening config file: /home/mike/.keybase/config.json
debug: ++ loading config file /home/mike/.keybase/config.json
debug: -- loaded config file -> {"generated":{"by":"keybase v0.0.7","on":"Thu Feb 13 2014 17:45:15 GMT-0700 (MST)"},"user":{"name":"mike","salt":"d5e92a23ce785019c96fe6983bcbff1b","id":"727d8ba0a75bfb7a48272fe766f64b00"}}
debug: - opened config file; found=true
debug: + testing GPG command-line client <default: gpg2 or gpg>
debug: | using GPG command: gpg2
debug: - tested GPG command-line client -> null
debug: Setting GPG_TTY=/dev/pts/32
debug: + Load proxy CAs
debug: - Loaded proxy CAs
debug: + startup message
debug: | CLI version: 0.8.15
debug: | Platform info: {"versions":{"http_parser":"1.0","node":"0.10.25","v8":"3.14.5.9","ares":"1.9.0-DEV","uv":"0.10.23","zlib":"1.2.3","modules":"11","openssl":"1.0.1e"},"arch":"x64","platform":"linux","features":{"debug":false,"uv":true,"ipv6":true,"tls_npn":true,"tls_sni":true,"tls":true}}
debug: | Version info: ["keybase (keybase.io CLI) v0.8.15","- node.js v0.10.25","- gpg (GnuPG) 2.1.5","- libgcrypt 1.6.3","Identifies as: 'keybase.io node.js client v0.8.15 linux'"]
debug: - startup message
debug: + opening database file: /home/mike/.keybase/keybase.idb
debug: ++ DB::_init_db
debug: -- DB::_init_db -> 0
debug: - DB opened
debug: + HKPLoopback::init; hunt for a port
debug: | found 56000
debug: - HKPLoopback::init -> null
debug: + KeyPull::run
debug: ++ KeyPull::load_user
debug: +++ mike: load user
debug: ++++ mike: load user from local storage
debug: +++++ load sig chain from local storage
debug: ||||| loading sig chain w/ payload hash 3786ffcc9c61e3658f4e46aefc5bf071f7d24d29a6a7f697efcd3d1ff796a6c6
debug: ++++++ 727d8ba0a75bfb7a48272fe766f64b00: load signature chain
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link 3786ffcc9c61e3658f4e46aefc5bf071f7d24d29a6a7f697efcd3d1ff796a6c6
debug: |||||| -> found link and previous; prev=d1466c614b338badb203d2c67ae67c30522915a34d399681c052618e32e1c6ba
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link d1466c614b338badb203d2c67ae67c30522915a34d399681c052618e32e1c6ba
debug: |||||| -> found link and previous; prev=27d362c06b5209347960e566d935dad171e9705e7414cccbf1ce6a66a16da1dd
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link 27d362c06b5209347960e566d935dad171e9705e7414cccbf1ce6a66a16da1dd
debug: |||||| -> found link and previous; prev=6d5747060a2822a8d799d8e642729c344d3b12f1f46076f5d36c4798c2c4d3e0
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link 6d5747060a2822a8d799d8e642729c344d3b12f1f46076f5d36c4798c2c4d3e0
debug: |||||| -> found link and previous; prev=59b2ae1e3a62a43580038396a93c874e64363aa939a6cd98aebf11426bde5759
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link 59b2ae1e3a62a43580038396a93c874e64363aa939a6cd98aebf11426bde5759
debug: |||||| -> found link and previous; prev=f1452ea169ad41a1274d819994015fabc800deee1c00ac912d44042fb19c289f
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link f1452ea169ad41a1274d819994015fabc800deee1c00ac912d44042fb19c289f
debug: |||||| -> found link and previous; prev=fff4e5b0e823c07222fed1176247329e8ff8ddfc3e659bde6e388446020c89b2
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link fff4e5b0e823c07222fed1176247329e8ff8ddfc3e659bde6e388446020c89b2
debug: |||||| -> found link and previous; prev=86bcd686f027adeda106a818309e3392e1035b0124579049407274f7a12081f2
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link 86bcd686f027adeda106a818309e3392e1035b0124579049407274f7a12081f2
debug: |||||| -> found link and previous; prev=53240e003264f6f971a1cb7e0585eb7b748443e11fd2dd16cc9d8e880888f0d7
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link 53240e003264f6f971a1cb7e0585eb7b748443e11fd2dd16cc9d8e880888f0d7
debug: |||||| -> found link and previous; prev=c230a7039e2f9a876147db9e8664832d45f0be3c0380191c35f78b25a4ba9c9b
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link c230a7039e2f9a876147db9e8664832d45f0be3c0380191c35f78b25a4ba9c9b
debug: |||||| -> found link and previous; prev=8e575fc79f46cc185f9ebf6deb9a53d30dd79a131df0da5f1bcec2c9c120723d
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link 8e575fc79f46cc185f9ebf6deb9a53d30dd79a131df0da5f1bcec2c9c120723d
debug: |||||| -> found link and previous; prev=08f5626a71dada9e69768d9be12d02f2ccf37abe154589a9585e90239323521a
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link 08f5626a71dada9e69768d9be12d02f2ccf37abe154589a9585e90239323521a
debug: |||||| -> found link and previous; prev=d41e8d4db43b8db146367b81193ea5ccc1e41d38a5c13f3b6239f383647dfb84
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link d41e8d4db43b8db146367b81193ea5ccc1e41d38a5c13f3b6239f383647dfb84
debug: |||||| -> found link and previous; prev=eaede50bd0bd49b36cc0112aafe9e0eec0952c5048f1da0b73cf4b0b72bd2050
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link eaede50bd0bd49b36cc0112aafe9e0eec0952c5048f1da0b73cf4b0b72bd2050
debug: |||||| -> found link and previous; prev=b4beda6d3b12db8a5b0a2ae4b956b575a6a69ec686b93a0c859f8ceeacf712f1
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link b4beda6d3b12db8a5b0a2ae4b956b575a6a69ec686b93a0c859f8ceeacf712f1
debug: |||||| -> found link and previous; prev=ef4dc0b2875b98e7793cb821e3afe1974b78a221d02b881d8fe9e7668ad83b14
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link ef4dc0b2875b98e7793cb821e3afe1974b78a221d02b881d8fe9e7668ad83b14
debug: |||||| -> found link and previous; prev=c753e919110fff226b30e9b77131b206e2b09ae92c714a00d69dd136a00c82ce
debug: |||||| 727d8ba0a75bfb7a48272fe766f64b00: Loading link c753e919110fff226b30e9b77131b206e2b09ae92c714a00d69dd136a00c82ce
debug: |||||| -> found link and previous; prev=null
debug: ------ 727d8ba0a75bfb7a48272fe766f64b00: loaded signature chain
debug: ----- loaded sig chain from local storage
debug: ---- mike: loaded user from local storage -> null / [object Object]
debug: ||| Checking session since we're loading User as self (and need secret key)
debug: ++++ session::load_and_check
debug: +++++ session::load
debug: ++++++ opening config file: /home/mike/.keybase/session.json
debug: +++++++ loading config file /home/mike/.keybase/session.json
debug: ------- loaded config file -> <redacted>
debug: ------ opened config file; found=true
debug: ----- session::load
debug: +++++ session::check
debug: ||||| calling to sesscheck
debug: ++++++ request to sesscheck (https://api.keybase.io:443/_/api/1.0/sesscheck.json) (cookie=true)
debug: |||||| Adding a custom CA for host api.keybase.io when tls=true
debug: ------ request to sesscheck -> null
debug: ----- session::check
debug: ---- session::load_and_check -> true
debug: ++++ mike: load user from server
debug: +++++ merkle find_and_verify: uid undefined, username mike
debug: ++++++ request to merkle/path (https://api.keybase.io:443/_/api/1.0/merkle/path.json?uid=&username=mike) (cookie=true)
debug: |||||| Adding a custom CA for host api.keybase.io when tls=true
debug: ------ request to merkle/path -> null
debug: ++++++ merkle get_merkle_pgp_key
debug: |||||| Call to gpg2: { args: [ '-k', '--with-fingerprint', '--with-colons' ],
debug:   quiet: true,
debug:   no_options: true }
debug: |||||| merkle key already found in keyring
debug: ------ merkle get_merkle_pgp_key
debug: ||||| Load key /2A32340CEC8C9492 from master keyring (secret=undefined)
debug: ||||| Call to gpg2: { args: 
debug:    [ '--export',
debug:      '--export-options',
debug:      'export-local-sigs',
debug:      '-a',
debug:      '2A32340CEC8C9492' ] }
debug: ++++++ lookup UID
debug: +++++++ read_uids_from_keys 03E146CDAF8136680AD566912A32340CEC8C9492
debug: ||||||| Call to gpg2: { args: 
debug:    [ '-k',
debug:      '--with-fingerprint',
debug:      '--with-colons',
debug:      '03E146CDAF8136680AD566912A32340CEC8C9492' ],
debug:   quiet: true,
debug:   no_options: true }
debug: ||||||| got: [{"username":"Keybase.io Merkle Signing","comment":"v1","email":"merkle@keybase.io"}]
debug: ------- read_uids_from_key -> null
debug:  - Map 2A32340CEC8C9492 -> [object Object] via gpg
debug: ------ looked up UID
debug: ++++++ Rollback check
debug: |||||| DB put value kv:e2:d0d0b5e3825aa9e9a8514414b1294f8f5c9a0e41b6a2b06019e30755c242899b4385be800480ab887d63679b29d4b1e8023a7c6960dc85f81405bc73538f06ad
debug: |||||| DB put lookup: lo:5:latest -> 7e2096f53fddbf834b2146d59e7b1b5fd6f03419e60c10b9f51efcf7cea46201
debug: ------ Rollback check
debug: ||||| id_version (25) and seqno (17) haven't changed.
debug: ++++++ mike: verifying signatures
debug: +++++++ mike: verifying sig
debug: ++++++++ libkeybase: replay(username: mike, uid: 727d8ba0a75bfb7a48272fe766f64b00, eldest: 0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 1: 00346d9d2ef9868f272307b32f043f04c105a87d5c726fe9e94e7a7e1da8ec920f
debug: |||||||| libkeybase: chain link parsed, type 'web_service_binding'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 2: b1d395101679c614677610a23d24ee167b172f2a575d98af3c2c4f7656eb9ec50f
debug: |||||||| libkeybase: chain link parsed, type 'web_service_binding'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 3: 5cffa7cab4d15f72a56dd905f2fac9ee9183ae49f51d8b94f8b5515c90682dfc0f
debug: |||||||| libkeybase: chain link parsed, type 'web_service_binding'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 4: ccb13d72da96211a5db627a2675ebeaea49c11ac50735eab83dc2d56bec5d5ac0f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 5: da53ffc0ba63b570cb81f9ec14386549bc020d5c7ced896709d14018df37b9870f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 6: 5271de9a422e016a2c5ca33ff5467fdf802880a66d103133cdd05656a2b16d540f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 7: d50ebc7892914ca3208a87a56b92ac9c231dba1b4784c73b8440918ee83d8b470f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 8: af99cd30278c01c293acd60fdd347771c9382c0116f92b065d7c876b0355fa3c0f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 9: 9f44ec3c3dcb5f6c5d1e4ff13c0a5de982c15812c49b4abb67575a0f8fa1a7b70f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 10: 3c69d8c3e4d3eea48ad1d7b4ecbe960222fd3a8b1e3e1cb51cb8565fb0447a780f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 11: ee0fa3d0cc111bbf5bc6a99435a5ba7f46eee14557aeaa0347ca86c372ab77f80f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 12: d6a5cf2e8751ae24f0c6a5395ef52c3699271a9f695e3fcc0bf94b932e0212f80f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 13: 3f867979b260023811bced9e9a63dd3a668d6ad3fefa71f96e027bf9d4fb94cc0f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 14: 662250e928f841340d60edd16bc5acf9a5583627889c2173410166a3f70ae30f0f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 15: 4a508bf385382e3abfa25da189b12153c537520b9c1304bb894ee3b931be50af0f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 16: 0163af0eb4c838486817090c2aa25408e9e0edf7e9f1af299352816ae4d542550f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: |||||||| libkeybase: replaying signature 17: f53301a996e3c3f547fc65ea74b15a9bdb145c1bf8d8fea136e2771a5aad032a0f
debug: |||||||| libkeybase: chain link parsed, type 'track'
debug: |||||||| libkeybase: signing key is valid (0101456e6eea2cddea257860c3180d28cb60dcee6cbca6a153ebc15ff83acef6de1d0a)
debug: -------- libkeybase: replay finished
debug: ++++++++ compressing signature chain
debug: +++++++++ RemoteProof::insert_into_table
debug: --------- RemoteProof::insert_into_table
debug: +++++++++ RemoteProof::insert_into_table
debug: --------- RemoteProof::insert_into_table
debug: +++++++++ Track::insert_into_table ccb13d72da96211a5db627a2675ebeaea49c11ac50735eab83dc2d56bec5d5ac0f
debug: --------- Track::insert_into_table ccb13d72da96211a5db627a2675ebeaea49c11ac50735eab83dc2d56bec5d5ac0f (uid=d7d925a2719a9973b6cfaf35e1463d00)
debug: +++++++++ Track::insert_into_table da53ffc0ba63b570cb81f9ec14386549bc020d5c7ced896709d14018df37b9870f
debug: --------- Track::insert_into_table da53ffc0ba63b570cb81f9ec14386549bc020d5c7ced896709d14018df37b9870f (uid=4ad82e6492fd5b17a41f34b04c9fb700)
debug: +++++++++ Track::insert_into_table 5271de9a422e016a2c5ca33ff5467fdf802880a66d103133cdd05656a2b16d540f
debug: --------- Track::insert_into_table 5271de9a422e016a2c5ca33ff5467fdf802880a66d103133cdd05656a2b16d540f (uid=22828cdf04fc90b035b1cd5644d98100)
debug: +++++++++ Track::insert_into_table d50ebc7892914ca3208a87a56b92ac9c231dba1b4784c73b8440918ee83d8b470f
debug: --------- Track::insert_into_table d50ebc7892914ca3208a87a56b92ac9c231dba1b4784c73b8440918ee83d8b470f (uid=d705e8b4ae859748f43052fd52d2e200)
debug: +++++++++ Track::insert_into_table af99cd30278c01c293acd60fdd347771c9382c0116f92b065d7c876b0355fa3c0f
debug: --------- Track::insert_into_table af99cd30278c01c293acd60fdd347771c9382c0116f92b065d7c876b0355fa3c0f (uid=3a4f1dfe2cdc1820ebb23906863fbd00)
debug: +++++++++ Track::insert_into_table 9f44ec3c3dcb5f6c5d1e4ff13c0a5de982c15812c49b4abb67575a0f8fa1a7b70f
debug: --------- Track::insert_into_table 9f44ec3c3dcb5f6c5d1e4ff13c0a5de982c15812c49b4abb67575a0f8fa1a7b70f (uid=2ff4658bbd10a517eb8be6a427afaa00)
debug: +++++++++ Track::insert_into_table 3c69d8c3e4d3eea48ad1d7b4ecbe960222fd3a8b1e3e1cb51cb8565fb0447a780f
debug: --------- Track::insert_into_table 3c69d8c3e4d3eea48ad1d7b4ecbe960222fd3a8b1e3e1cb51cb8565fb0447a780f (uid=c42336b39f84f4a75f8b1d3515730d00)
debug: +++++++++ Track::insert_into_table ee0fa3d0cc111bbf5bc6a99435a5ba7f46eee14557aeaa0347ca86c372ab77f80f
debug: --------- Track::insert_into_table ee0fa3d0cc111bbf5bc6a99435a5ba7f46eee14557aeaa0347ca86c372ab77f80f (uid=2ff4658bbd10a517eb8be6a427afaa00)
debug: +++++++++ Track::insert_into_table d6a5cf2e8751ae24f0c6a5395ef52c3699271a9f695e3fcc0bf94b932e0212f80f
debug: --------- Track::insert_into_table d6a5cf2e8751ae24f0c6a5395ef52c3699271a9f695e3fcc0bf94b932e0212f80f (uid=2ff4658bbd10a517eb8be6a427afaa00)
debug: +++++++++ Track::insert_into_table 3f867979b260023811bced9e9a63dd3a668d6ad3fefa71f96e027bf9d4fb94cc0f
debug: --------- Track::insert_into_table 3f867979b260023811bced9e9a63dd3a668d6ad3fefa71f96e027bf9d4fb94cc0f (uid=dbbe67ae4dfb3c619adbe16f433fca00)
debug: +++++++++ Track::insert_into_table 662250e928f841340d60edd16bc5acf9a5583627889c2173410166a3f70ae30f0f
debug: --------- Track::insert_into_table 662250e928f841340d60edd16bc5acf9a5583627889c2173410166a3f70ae30f0f (uid=09ee3065bc5cbcd31a5dfcbb644fa500)
debug: +++++++++ Track::insert_into_table 4a508bf385382e3abfa25da189b12153c537520b9c1304bb894ee3b931be50af0f
debug: --------- Track::insert_into_table 4a508bf385382e3abfa25da189b12153c537520b9c1304bb894ee3b931be50af0f (uid=3e9ed97cee57c918411e9fc4c6202700)
debug: +++++++++ Track::insert_into_table 0163af0eb4c838486817090c2aa25408e9e0edf7e9f1af299352816ae4d542550f
debug: --------- Track::insert_into_table 0163af0eb4c838486817090c2aa25408e9e0edf7e9f1af299352816ae4d542550f (uid=d271d50b5c2affae5782b863b2998819)
debug: +++++++++ Track::insert_into_table f53301a996e3c3f547fc65ea74b15a9bdb145c1bf8d8fea136e2771a5aad032a0f
debug: --------- Track::insert_into_table f53301a996e3c3f547fc65ea74b15a9bdb145c1bf8d8fea136e2771a5aad032a0f (uid=0be66843a892e293458b55024e326519)
debug: -------- signature chain compressed
debug: ------- mike: verified sig
debug: ------ mike: verified signatures
debug: ++++++ mike: storing signature chain
debug: ------ mike: stored signature chain
debug: ----- mike: loaded user
debug: +++++ mike: check public key
debug: ||||| Call to gpg2: { args: 
debug:    [ '-K',
debug:      '--with-colons',
debug:      'acd04a193da428903e2a2e76e56bf5ef5e57febf' ],
debug:   quiet: true }
debug: ----- mike: check_public_key: ret={"remote":false,"local":true}; err=null
debug: +++++ mike: check public key
debug: ||||| Call to gpg2: { args: 
debug:    [ '-k',
debug:      '--with-colons',
debug:      'acd04a193da428903e2a2e76e56bf5ef5e57febf' ],
debug:   quiet: true }
debug: ----- mike: check_public_key: ret={"remote":true,"local":true}; err=null
debug: Check key secret: {"remote":false,"local":true}
debug: Check key public: {"remote":true,"local":true}
debug: ---- KeyPull::load_user -> null 0
debug: --- KeyPull::run
debug: +++ Make new temporary keychain
debug: ||| mkdir_p parent /home/mike/.keybase/tmp_keyrings
debug: ||| making directory /home/mike/.keybase/tmp_keyrings/A6Go85zVFE2ODJVJn7c0
debug: --- Made new temporary keychain
debug: +++ Make/check empty pubring /home/mike/.keybase/tmp_keyrings/A6Go85zVFE2ODJVJn7c0/pubring.gpg
debug: ||| Made a new one
debug: --- Made/check empty pubring -> true
debug: || Call to gpg2: { args: 
debug:    [ '--status-fd',
debug:      '2',
debug:      '--with-colons',
debug:      '--keyid-format',
debug:      'long',
debug:      '--keyserver',
debug:      'hkp://127.0.0.1:56000/',
debug:      '--keyserver-options',
debug:      'auto-key-retrieve=1',
debug:      '--with-fingerprint',
debug:      '--keyserver-options',
debug:      'debug=1',
debug:      '--decrypt',
debug:      '--yes',
debug:      '/tmp/message' ],
debug:   stderr: 
debug:    { _v: [],
debug:      _writableState: 
debug:       { highWaterMark: 16384,
debug:         objectMode: false,
debug:         needDrain: false,
debug:         ending: false,
debug:         ended: false,
debug:         finished: false,
debug:         decodeStrings: true,
debug:         defaultEncoding: 'utf8',
debug:         length: 0,
debug:         writing: false,
debug:         sync: true,
debug:         bufferProcessing: false,
debug:         onwrite: [Function],
debug:         writecb: null,
debug:         writelen: 0,
debug:         buffer: [] },
debug:      writable: true,
debug:      domain: null,
debug:      _events: {},
debug:      _maxListeners: 10 } }
debug: || Mutate GPG args; new args: --primary-keyring /home/mike/.keybase/tmp_keyrings/A6Go85zVFE2ODJVJn7c0/pubring.gpg --status-fd 2 --with-colons --keyid-format long --keyserver hkp://127.0.0.1:56000/ --keyserver-options auto-key-retrieve=1 --with-fingerprint --keyserver-options debug=1 --decrypt --yes /tmp/message
foo
debug: gpg: keyserver option 'debug' is unknown
debug: [GNUPG:] ENC_TO 8F5A1E88E78559A3 1 0
debug: [GNUPG:] PINENTRY_LAUNCHED 1339
debug: gpg: encrypted with 4096-bit RSA key, ID 8F5A1E88E78559A3, created 2014-02-19
debug:       "keybase.io/mike <mike@keybase.io>"
debug: [GNUPG:] BEGIN_DECRYPTION
debug: [GNUPG:] DECRYPTION_INFO 2 9
debug: [GNUPG:] PLAINTEXT 62 1438364833 
debug: [GNUPG:] PLAINTEXT_LENGTH 4
debug: [GNUPG:] DECRYPTION_OKAY
debug: [GNUPG:] GOODMDC
debug: [GNUPG:] END_DECRYPTION
debug: +++ find_signature
debug: ||| No signature found; but we didn't require one
debug: --- find_signature
debug: || nuking temporary kerying: /home/mike/.keybase/tmp_keyrings/A6Go85zVFE2ODJVJn7c0
kusold commented 9 years ago

I'm still getting bit by this, but I managed to debug more successfully today.

❯ echo "foo" | keybase encrypt mike | gpg2 -d
gpg: encrypted with 4096-bit RSA key, ID E78559A3, created 2014-02-19
      "keybase.io/mike <mike@keybase.io>"
gpg: public key decryption failed: Inappropriate ioctl for device
gpg: decryption failed: No secret key

That means that gpg can't prompt me for my private key passphrase.

❯ keybase decrypt decrypt.asc

Decrypting from the file prompts me for the passphrase and decrypts successfully.

❯ echo "foo" | keybase encrypt mike | gpg2 -d
gpg: encrypted with 4096-bit RSA key, ID E78559A3, created 2014-02-19
      "keybase.io/mike <mike@keybase.io>"
foo

Since the passphrase is now stored in my gpg-agent, I can decrypt using this method now.

I'm pretty sure this is an upstream problem with gpg. Not really sure what their solution could be, other than the work around I am doing. Either way, I'm happy enough with the workaround. This can be closed if you agree with my assessment that this isn't keybase's problem.

petermaloney commented 9 years ago

I had a chat with a knowlegable guy in freenode's #gnupg channel... it seems to be complete insanity, but without all the insane details, he said that starting with gpg 2.1.0:

to get rid of the completely usless misleading "Inappropriate ioctl for device" error, you have to: export GPG_TTY=$(tty)

and for using --passphrase-fd and --passphrase-file arguments (possibly used by keybase, which by the way I don't use and never heard of before, but this is the only relevant thing I found online, so I'm leaving this here to help others), you also need to supply the --pinentry-mode loopback argument (without that it'll give you another vague error).

and for loopback to work, you need to start gpg-agent with --allow-loopback-pinentry which is not the default, and you must have gpg-agent running, which no longer is only for caching, but also this loopback thing and more.

And so all your problems are likely caused by these insane badly documented UI changes, plus no output from gpg will tell you of these solutions.

todd-a-jacobs commented 9 years ago

You might also want to make sure that you aren't using an OpenPGP card with the forcesig option enabled, or the --no-use-agent flag. This error happens in a pipeline if GPG can't use the gpg-agent for authentication, because it can't prompt for user input in a pipeline.

Manouchehri commented 8 years ago

I'm still having this issue on my system. As a temporary solution, setting gpg-agent to cache passphrases seems to work.

whitslack commented 8 years ago

I'm getting the "Inappropriate ioctl for device" message when trying to import my key from GPG.

$ keybase pgp select
▶ INFO gpg: enabled debug flags: memstat
▶ INFO gpg: random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
▶ INFO               outmix=0 getlvl1=0/0 getlvl2=0/0
▶ INFO gpg: secmem usage: 0/65536 bytes in 0 blocks
#    Algo    Key Id             Created   UserId
=    ====    ======             =======   ======
1    2048R   5B476DF21E6F3C19             Matt Whitlock <matt@whitlock.name>
Choose a key: 1
▶ INFO gpg: enabled debug flags: memstat
▶ INFO gpg: key 1E6F3C19: error receiving key from agent: Inappropriate ioctl for device - skipped
▶ INFO gpg: random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
▶ INFO gpg: WARNING: nothing exported
▶ INFO               outmix=0 getlvl1=0/0 getlvl2=0/0
▶ INFO gpg: secmem usage: 0/65536 bytes in 0 blocks
▶ ERROR ImportKey error: GPG error: exit status 2
$ keybase version
Client:  1.0.7-0
Service: 1.0.7-0
$ gpg --version
gpg (GnuPG) 2.1.10
libgcrypt 1.6.4
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

Is there any other way for me to import my GPG key into Keybase? I'd like to begin using Keybase, but I don't want a new GPG key.

whitslack commented 8 years ago

I also tried gpg --export-secret-key ${MY_KEY_ID} | keybase pgp import, but that gave me the following:

gpg: enabled debug flags: memstat
gpg: random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
              outmix=0 getlvl1=0/0 getlvl2=0/0
gpg: secmem usage: 2176/65536 bytes in 1 blocks
Please enter the passphrase to unlock the secret key for:
Device "home desktop"

Reason: sign new key: panic: inappropriate ioctl for device

goroutine 29 [running]:
github.com/keybase/client/go/vendor/github.com/keybase/gopass.getch(0x17ff800)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/gopass/nix.go:13 +0x73
github.com/keybase/client/go/vendor/github.com/keybase/gopass.getPasswd(0xc820011b00, 0x0, 0x0, 0x0, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/gopass/pass.go:22 +0x152
github.com/keybase/client/go/vendor/github.com/keybase/gopass.GetPasswd(0x0, 0x0, 0x0, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/gopass/pass.go:47 +0x39
github.com/keybase/client/go/minterm.(*MinTerm).PromptPassword(0xc82000f400, 0xc820016540, 0x67, 0x0, 0x0, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/minterm/minterm.go:76 +0x12d
github.com/keybase/client/go/client.(*Terminal).PromptPassword(0xc820200820, 0xc820016540, 0x67, 0x0, 0x0, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/client/terminal.go:51 +0x9e
github.com/keybase/client/go/client.(*Terminal).GetSecret(0xc820200820, 0xc820057b18, 0x0, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/client/terminal.go:140 +0x201
github.com/keybase/client/go/client.(*SecretEntry).Get(0xc8201fce40, 0xc8202621c0, 0x65, 0xc820201620, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/client/secret_entry.go:82 +0x2ce
github.com/keybase/client/go/client.SecretUI.getSecret(0xc820107e30, 0xc8202621c0, 0x65, 0xc820201620, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/client/ui.go:674 +0xf0
github.com/keybase/client/go/client.SecretUI.passphrasePrompt(0xc820107e30, 0xc8202621c0, 0x65, 0xc8202621c0, 0x65, 0xc820201620, 0x13, 0x17eac60, 0x0, 0x0, ...)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/client/ui.go:741 +0x2e3
github.com/keybase/client/go/client.SecretUI.GetPassphrase(0xc820107e30, 0xc820201620, 0x13, 0xc8202621c0, 0x65, 0xc820260360, 0x6, 0xc820260160, 0x6, 0x0, ...)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/client/ui.go:710 +0x136
github.com/keybase/client/go/client.(*SecretUIServer).GetPassphrase(0xc820011830, 0x7f6a7afc11a0, 0xc8201fae00, 0x0, 0xc820201620, 0x13, 0xc8202621c0, 0x65, 0xc820260360, 0x6, ...)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/client/secret.go:22 +0x9f
github.com/keybase/client/go/protocol.SecretUiProtocol.func2(0x7f6a7afc11a0, 0xc8201fae00, 0xcb9060, 0xc8202014a0, 0x0, 0x0, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/protocol/keybase_v1.go:4705 +0x14e
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*callRequest).Serve.func1(0xc820117ea0, 0x7f6a7afc0c88, 0xc8201fd350, 0x0, 0x0, 0xcb9060, 0xc8202014a0, 0x135e6b0, 0xc820201480, 0x7f6a7afc0f18, ...)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/request.go:108 +0x1ef
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*callRequest).Serve
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/request.go:115 +0x270

goroutine 1 [chan receive]:
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*dispatch).Call(0xc82010e880, 0x7f6a7afc0ed8, 0xc820010370, 0x11ef280, 0x17, 0xcfbcc0, 0xc82000f220, 0x0, 0x0, 0x7f6a7afc0e80, ...)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/dispatch.go:168 +0x47f
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*Client).Call(0xc82000f1c0, 0x7f6a7afc0ed8, 0xc820010370, 0x11ef280, 0x17, 0xcfbcc0, 0xc82000f220, 0x0, 0x0, 0x0, ...)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/client.go:35 +0x267
github.com/keybase/client/go/protocol.PGPClient.PGPImport(0x7f6a7afc0eb0, 0xc82000f1c0, 0x7f6a7afc0ed8, 0xc820010370, 0x0, 0xc820258000, 0x7b4, 0xe00, 0x0, 0x0, ...)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/protocol/keybase_v1.go:3823 +0x1b5
github.com/keybase/client/go/client.(*CmdPGPImport).Run(0xc8201147e0, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/client/cmd_pgp_import.go:83 +0x264
main.mainInner(0xc8200f8300, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/keybase/main.go:94 +0xa8f
main.main()
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/keybase/main.go:42 +0x52

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/lib/go/src/runtime/asm_amd64.s:1696 +0x1

goroutine 5 [syscall]:
os/signal.loop()
    /usr/lib/go/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
    /usr/lib/go/src/os/signal/signal_unix.go:28 +0x37

goroutine 18 [select]:
github.com/keybase/client/go/libkb.(*LoginState).requests(0xc820107140)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/libkb/login_state.go:773 +0x6ed
created by github.com/keybase/client/go/libkb.NewLoginState
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/libkb/login_state.go:107 +0x29e

goroutine 19 [chan receive]:
main.HandleSignals()
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/keybase/main.go:225 +0x14a
created by main.main
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/keybase/main.go:41 +0x44

goroutine 7 [select, locked to thread]:
runtime.gopark(0x1360848, 0xc820034f28, 0x111c7f0, 0x6, 0x42ee18, 0x2)
    /usr/lib/go/src/runtime/proc.go:185 +0x163
runtime.selectgoImpl(0xc820034f28, 0x0, 0x18)
    /usr/lib/go/src/runtime/select.go:392 +0xa64
runtime.selectgo(0xc820034f28)
    /usr/lib/go/src/runtime/select.go:212 +0x12
runtime.ensureSigM.func1()
    /usr/lib/go/src/runtime/signal1_unix.go:227 +0x353
runtime.goexit()
    /usr/lib/go/src/runtime/asm_amd64.s:1696 +0x1

goroutine 20 [select]:
github.com/keybase/client/go/vendor/stathat.com/c/ramcache.(*Ramcache).cleanup(0xc8201149c0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/stathat.com/c/ramcache/ramcache.go:164 +0x12c
created by github.com/keybase/client/go/vendor/stathat.com/c/ramcache.New
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/stathat.com/c/ramcache/ramcache.go:44 +0x15c

goroutine 21 [select]:
github.com/keybase/client/go/vendor/stathat.com/c/ramcache.(*Ramcache).cleanup(0xc820114a80)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/stathat.com/c/ramcache/ramcache.go:164 +0x12c
created by github.com/keybase/client/go/vendor/stathat.com/c/ramcache.New
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/stathat.com/c/ramcache/ramcache.go:44 +0x15c

goroutine 22 [select]:
github.com/keybase/client/go/vendor/stathat.com/c/ramcache.(*Ramcache).cleanup(0xc820114b40)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/stathat.com/c/ramcache/ramcache.go:164 +0x12c
created by github.com/keybase/client/go/vendor/stathat.com/c/ramcache.New
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/stathat.com/c/ramcache/ramcache.go:44 +0x15c

goroutine 23 [select]:
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*dispatch).callLoop(0xc82010e880)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/dispatch.go:106 +0x36a
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.newDispatch
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/dispatch.go:55 +0x2b0

goroutine 24 [select]:
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*receiveHandler).taskLoop(0xc820220000)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/receiver.go:89 +0x312
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.newReceiveHandler
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/receiver.go:82 +0x646

goroutine 25 [chan receive]:
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*framedMsgpackDecoder).Decode(0xc8202012a0, 0xccf380, 0xc820260390, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/codec.go:92 +0x92
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*packetHandler).getFrame(0xc8202012c0, 0x182, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/packetizer.go:22 +0x7f
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*packetHandler).packetizeOne(0xc8202012c0, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/packetizer.go:53 +0x2f
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*packetHandler).Packetize(0xc8202012c0, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/packetizer.go:61 +0x35
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).run(0xc82021def0, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:141 +0x104
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).RunAsync.func1(0xc82021def0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:124 +0x28
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).RunAsync
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:128 +0xe7

goroutine 26 [IO wait]:
net.runtime_pollWait(0x7f6a7afc08e0, 0x72, 0xc820010200)
    /usr/lib/go/src/runtime/netpoll.go:157 +0x60
net.(*pollDesc).Wait(0xc820117c60, 0x72, 0x0, 0x0)
    /usr/lib/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc820117c60, 0x0, 0x0)
    /usr/lib/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc820117c00, 0xc82021e000, 0x1000, 0x1000, 0x0, 0x7f6a81036050, 0xc820010200)
    /usr/lib/go/src/net/fd_unix.go:232 +0x23a
net.(*conn).Read(0xc820108100, 0xc82021e000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/lib/go/src/net/net.go:172 +0xe4
bufio.(*Reader).fill(0xc820114de0)
    /usr/lib/go/src/bufio/bufio.go:97 +0x1e9
bufio.(*Reader).ReadByte(0xc820114de0, 0xc8202014a0, 0x0, 0x0)
    /usr/lib/go/src/bufio/bufio.go:229 +0x7a
github.com/keybase/client/go/vendor/github.com/ugorji/go/codec.(*ioDecReader).readn1(0xc8201d4a20, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/ugorji/go/codec/decode.go:213 +0x3d
github.com/keybase/client/go/vendor/github.com/ugorji/go/codec.(*msgpackDecDriver).readNextBd(0xc82021b950)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/ugorji/go/codec/msgpack.go:570 +0x3a
github.com/keybase/client/go/vendor/github.com/ugorji/go/codec.(*msgpackDecDriver).TryDecodeAsNil(0xc82021b950, 0xc800000000)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/ugorji/go/codec/msgpack.go:598 +0x2f
github.com/keybase/client/go/vendor/github.com/ugorji/go/codec.(*Decoder).decode(0xc8201d49a0, 0xccf380, 0xc820260390)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/ugorji/go/codec/decode.go:1063 +0x67
github.com/keybase/client/go/vendor/github.com/ugorji/go/codec.(*Decoder).Decode(0xc8201d49a0, 0xccf380, 0xc820260390, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/ugorji/go/codec/decode.go:989 +0x74
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).readerLoop(0xc82021def0, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:168 +0x17a
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).(github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.readerLoop)-fm(0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:137 +0x2e
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.runInBg.func1(0xc8201156e0, 0xc820217ef0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/util.go:25 +0x1d
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.runInBg
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/util.go:26 +0x5d

goroutine 27 [select]:
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).writerLoop(0xc82021def0, 0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:186 +0x1fa
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*transport).(github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.writerLoop)-fm(0x0, 0x0)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/transport.go:138 +0x2e
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.runInBg.func1(0xc820115740, 0xc820217f00)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/util.go:25 +0x1d
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.runInBg
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/util.go:26 +0x5d

goroutine 8 [select]:
github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*dispatch).handleCall.func1(0xc8200a0200, 0x2, 0xc82010e880)
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/dispatch.go:138 +0x4fd
created by github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc.(*dispatch).handleCall
    /var/tmp/portage/app-crypt/keybase-1.0.7.0/work/src/github.com/keybase/client/go/vendor/github.com/keybase/go-framed-msgpack-rpc/dispatch.go:154 +0x443
whitslack commented 8 years ago

Question: Is X11 a requirement for using the Keybase CLI? I see in the debug (keybase -d) output:

12:59:53.925485 ▶ [DEBU keybase secret_entry.go:32] 0b5 + SecretEntry.Init()
12:59:53.925500 ▶ [DEBU keybase log.go:30] 0b6 | No 3Sec or PassphraseStream in UnlockNoPrompt
12:59:53.925549 ▶ [DEBU keybase secret_entry.go:46] 0b7 | Pinentry initialization failed: Can't spawn gui window, not using pinentry
12:59:53.925571 ▶ [DEBU keybase secret_entry.go:61] 0b8 - SecretEntry.Init() -> ok

Seems as though, if "Pinentry initialization failed", then SecretEntry.Init() should not return ok, but that's a separate issue.

The "Can't spawn gui window" message is coming from pinentry_nix.go:53.

The HasWindows() function (defined at pinentry_x11.go:10) requires DISPLAY to be set. But I'm running keybase outside of any X11 session, so I have no DISPLAY variable.

/usr/bin/pinentry falls back to a curses-based pinentry dialog in this scenario, but apparently the Keybase CLI is refusing to invoke pinentry at all. :(

maxtaco commented 8 years ago

For now, does it work to export into a file, and then pipe that file into import? Sorry about this bug, @oconnor663 is looking into it. And thanks for your help!

whitslack commented 8 years ago

I didn't really want to write my unencrypted private key to disk, for obvious reasons. And I wouldn't expect that to help anyway, since the problem is occurring when keybase tries to gather the passphrase for my device secret key, which is unrelated to GPG. (I can see my unencrypted GPG key on the terminal when I run gpg --export-secret-key ${MY_KEY_ID} --armor and enter my passphrase in the curses-based pinentry that appears on the terminal.)

whitslack commented 8 years ago

Never mind. It does work. I wrote my GPG secret key to a mode-0600 file in a tmpfs so it would not be written to disk anywhere, and then invoked keybase pgp import --infile /tmp/key, and that worked. I'm thinking you probably should not be trying to gather the passphrase from stdin (which is a pipe in this case) but rather from /dev/tty (which is the current session's controlling terminal).

oconnor663 commented 8 years ago

Ok, I'm able to repro the panic with the following steps:

1) gpg --export-secret-key TestKey > /tmp/testkey (the gpg version doesn't matter) 2) unset DISPLAY 3) keybase pgp import < /tmp/testkey (master repros, and so does standalone mode)

▶ WARNING Running in devel mode
Please enter the passphrase to unlock the secret key for:
Device "home computer"

Reason: sign new key: panic: inappropriate ioctl for device
...
maxtaco commented 8 years ago

Interesting, so it's not a GPG 2.1 issue. Good to know...

maxtaco commented 8 years ago

BTW, gopass does indeed reference fd=0 rather than using /dev/tty as the rest of our input methods are doing.

whitslack commented 8 years ago

Almost certainly the problem is that ioctl() is being called to disable local echo on stdin, but this ioctl only works on tty devices and fails when stdin is a file or pipe. The fix should be to read the passphrase from /dev/tty rather than from stdin when isatty(STDIN_FILENO) returns false.

oconnor663 commented 8 years ago

Yep -- I'll have a fix up shortly. Testing on Windows and BSD :)

whitslack commented 8 years ago

You might also want to test the case in which stdin is not a TTY (e.g., redirected from file or pipe) and the process has no controlling terminal. In that case, opening /dev/tty should fail, and you will be unable to gather a passphrase from the user, so you should abort.

oconnor663 commented 8 years ago

The original issue should be fixed. @whitslack can you confirm?

If in addition to unsetting DISPLAY I also run (to get rid of the controlling terminal):

setsid -w keybase --standalone pgp import < key

then the command exits with

▶ ERROR open /dev/tty: no such device or address

which seems like a reasonable thing to do :)

whitslack commented 8 years ago

I applied fab4644 and 0d691b7 atop v1.0.7-0, and now I can run keybase pgp decrypt < /tmp/msg with no DISPLAY in my environment. (The passphrase is prompted from the terminal.) Thanks for the quick work!

oconnor663 commented 8 years ago

Woo!

On Thu, Jan 7, 2016, 6:27 AM Matt Whitlock notifications@github.com wrote:

I applied fab4644 https://github.com/keybase/client/commit/fab464408f3fcde5d0718749f9e4db68ec643e02 and 0d691b7 https://github.com/keybase/client/commit/0d691b75b6246097f707d72568b71276e9d79215 atop v1.0.7-0 https://github.com/keybase/client/tree/v1.0.7-0, and now I can run keybase pgp decrypt < /tmp/msg with no DISPLAY in my environment. (The passphrase is prompted from the terminal.) Thanks for the quick work!

— Reply to this email directly or view it on GitHub https://github.com/keybase/keybase-issues/issues/1712#issuecomment-169635219 .

riquito commented 8 years ago

to get rid of the completely usless misleading "Inappropriate ioctl for device" error, you have to: export GPG_TTY=$(tty)

It works. I've got the ioctl error trying to upload my signed key via curl, without keybase. I understand that it's not a keybase client error, but others may be stumpled by this and I wanted to confirm that the suggestion works.

TransGirlCodes commented 8 years ago

I was getting the 'Inappropriate ioctl for device' error on my mac all of a sudden after a brew update. When I signed commits with git with my keybase key, which I did by adding it to gpg as per these blog posts: https://agonzalezro.github.io/signing-your-github-work-with-your-keybase-keys.html, https://www.ahmadnassri.com/blog/github-gpg-keybase-pgp/. export GPG_TTY=$(tty) makes it work again for me, although it comes up with a different box and message when it comes to entering my password :/

LLFourn commented 7 years ago

I put export GPG_TTY=$(tty) in my profile. It didn't fix the problem with emacs installed via https://emacsformacosx.com/

I simply downgraded to gpg1 via:

 brew uninstall gpg2
 brew install gpg1
 echo 'PATH="/usr/local/opt/gnupg/libexec/gpgbin:$PATH"' >> ~/.profile
trufae commented 7 years ago

Fixed with https://github.com/IJHack/qtpass/issues/156#issuecomment-224629448

intcreator commented 7 years ago

@petermaloney's answer is "you have to export GPG_TTY=$(tty)". Just to be clear, that means to enter the following line as is in your Unix shell:

export GPG_TTY=$(tty)

Then the issue should be resolved. I was confused at first so I wanted to clarify.

timxor commented 6 years ago

So I tried everything and the one command that allowed me to commit again was: git config --global gpg.program gpg2 =)

gorrog commented 6 years ago

@LLFourn's answer above solved the issue for me with emacs on mac os x, although my echo command was a little different (I just copied what brew told me to):

echo 'PATH="/usr/local/opt/gnupg@1.4/libexec/gpgbin:$PATH"' >> ~/.profile

I hope that helps someone.

LLFourn commented 6 years ago

@gorrog I recently got this working with gpg2 but I don't remember how. I'm using emacs-mac from homebrew.

jcrben commented 6 years ago

Upstream discussion: gpg-agent manual page says to always add GPG_TTY to .bashrc - sounds like upstream would like to fix the requirement to export this variable

tiziodcaio commented 2 years ago

I've got the error because I removed gtk2... Maybe this might be helpful...