cli icon indicating copy to clipboard operation
cli copied to clipboard

heroku run bash fails on ubuntu 22.04

Open gataky opened this issue 2 years ago • 7 comments

This project is for the Heroku CLI only and issues are reviewed as we are able. If you need more immediate assistence or help with anything not specific to the CLI itself, please use https://help.heroku.com.

Do you want to request a feature or report a bug?

If bug, first try running heroku update and setting DEBUG=* to see extra debug information.

This is a bug report

What is the current behavior?

If the current behavior is a bug, please provide the steps to reproduce.

Trying to get a shell into a shield dyno. Here are the steps I'm taking.

  1. ssh-add
  2. ssh-add -l
  3. heroku keys:add
  4. heroku run bash --app=<app-name>

I've tried updating the heroku cli but it appears to be the latest release

$ sudo apt upgrade heroku 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
heroku is already the newest version (7.60.2-1).
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Running with DEBUG=* produces a massive amount of out put but I do not see any errors in the output other than the error without this flag. I also removed some information that I thought could be sensitive. Sorry if I removed too much but here's the tail of the output.

  http → GET https://api.heroku.com/apps/<app-name>/dynos/run.7171
  http   accept: 'application/vnd.heroku+json; version=3'
  http   authorization: '[REDACTED]'
  http   request-id: 'd1b74f7b-bd49-4ded-b6ca-ed0450c84b87,2d71d040-9e1c-4ffd-b52b-5075e42b385a,d2ba9abf-60e8-4fc4-9bc5-d874f22dcbc9,e938003d-2ee8-4e97-9e26-86271e4a937c,a15f9cc6-6dbf-4a29-bb1e-b3885259697f,ceb94355-e5cb-4b39-9290-40fc3a489963,21839df1-bde7-4757-8994-066fb87d8ac7,6dcd0861-1706-4ec5-95fe-bf03738f0ae8,0f0a4976-9ce6-4bac-8895-e4251e533bea,6a8091fa-2f48-403f-b70e-7152b09905a2,40d4e0fb-5d63-418d-a667-023dba2d101b,54efae90-bd69-4670-a9dd-133eb7f05bea,5e8a0ae6-00f1-420a-8ca6-70f211f8d3d2,e6186681-4107-4f6d-a7ad-0673fbb7e2ed,4832a407-ec18-4614-8373-249ad60c86e1,6722f5f1-80fd-4d1e-b828-9c000a5b2f37,c24552f4-5894-440c-9f56-bb15a7e20aa3,df2ce09e-b4e5-472b-a762-84312d427679,7279bf28-ebb9-4a28-b1c4-3e3b33e823f5,a8979d62-d327-49b3-b70d-59ed74cebc40,0b90b3da-c1f7-491b-b973-75cf933bdbb4,9a4e445d-d228-423e-908c-dd32f7c34324,e7b8cc57-ae77-4915-bcd9-705717c57fbe,49bd1da9-2b2f-42cd-b8df-b2629e111dd8,b2dbe7f1-094f-49c6-abd9-ca1c227d1d41,dbd1e27c-c106-451a-ad91-fefaca4ddf65,dd42f16b-b22a-4988-b639-cb717228e020,7eedde54-d371-45bc-a489-e2a8ca187e46,867fe366-1890-4fa3-9c46-66dcf746c1af,52b7dac9-0281-42a7-87e3-7ba0bb6ece63,f74e523e-37a9-4aac-9c68-3bf526d6ecbb,90993e74-f28d-497e-9726-feac19045a9c,e7a88f94-1bb0-4f96-aab7-374a140ac024,ac473da7-7003-41b1-9bfc-e715a99701bf,8aeb7e84-e1f3-4694-8751-6dcae6c4ba5e,e545d617-0ab7-44ab-a53a-c1a079a74c49,f1207bc2-c050-45f5-a6b9-2c8b3131168d,43e91e46-043f-487b-97e8-fe1a7a465ddc,907ae344-8f95-47d0-9377-1f8f880e019b,1de1229d-429f-40d8-90a2-d65619fad59a,17204180-256f-4b2e-946f-6e146ac840da,04053a02-8ba1-4fbe-8cd0-4e3e3c987df7,a5810950-a680-4ef9-b892-033f350c341f,a083642a-9b35-48db-b91b-592a43bc667d,1de6bc2f-fbce-40b4-a805-1502c09e62b0'
  http   user-agent: 'heroku-cli/7.60.2 linux' +1s
  http ← GET https://api.heroku.com/apps/<app-name>/dynos/run.7171 200
  http   cache-control: 'private, no-cache'
  http   connection: 'close'
  http   content-length: '372'
  http   content-type: 'application/json'
  http   date: 'Fri, 03 Jun 2022 18:26:24 GMT'
  http   etag: '"72e74dd38a9ec72c4a35d7aef6f54e5f"'
  http   last-modified: 'Fri, 03 Jun 2022 18:26:24 GMT'
  http   oauth-scope: 'global'
  http   oauth-scope-accepted: 'global read read-protected write write-protected'
  http   ratelimit-multiplier: '1'
  http   ratelimit-remaining: '4499'
  http   request-id: '41348b61-aff8-494b-852a-493a2e546e9b,d1b74f7b-bd49-4ded-b6ca-ed0450c84b87,2d71d040-9e1c-4ffd-b52b-5075e42b385a,d2ba9abf-60e8-4fc4-9bc5-d874f22dcbc9,e938003d-2ee8-4e97-9e26-86271e4a937c,a15f9cc6-6dbf-4a29-bb1e-b3885259697f,ceb94355-e5cb-4b39-9290-40fc3a489963,21839df1-bde7-4757-8994-066fb87d8ac7,6dcd0861-1706-4ec5-95fe-bf03738f0ae8,0f0a4976-9ce6-4bac-8895-e4251e533bea,6a8091fa-2f48-403f-b70e-7152b09905a2,40d4e0fb-5d63-418d-a667-023dba2d101b,54efae90-bd69-4670-a9dd-133eb7f05bea,5e8a0ae6-00f1-420a-8ca6-70f211f8d3d2,e6186681-4107-4f6d-a7ad-0673fbb7e2ed,4832a407-ec18-4614-8373-249ad60c86e1,6722f5f1-80fd-4d1e-b828-9c000a5b2f37,c24552f4-5894-440c-9f56-bb15a7e20aa3,df2ce09e-b4e5-472b-a762-84312d427679,7279bf28-ebb9-4a28-b1c4-3e3b33e823f5,a8979d62-d327-49b3-b70d-59ed74cebc40,0b90b3da-c1f7-491b-b973-75cf933bdbb4,9a4e445d-d228-423e-908c-dd32f7c34324,e7b8cc57-ae77-4915-bcd9-705717c57fbe,49bd1da9-2b2f-42cd-b8df-b2629e111dd8,b2dbe7f1-094f-49c6-abd9-ca1c227d1d41,dbd1e27c-c106-451a-ad91-fefaca4ddf65,dd42f16b-b22a-4988-b639-cb717228e020,7eedde54-d371-45bc-a489-e2a8ca187e46,867fe366-1890-4fa3-9c46-66dcf746c1af,52b7dac9-0281-42a7-87e3-7ba0bb6ece63,f74e523e-37a9-4aac-9c68-3bf526d6ecbb,90993e74-f28d-497e-9726-feac19045a9c,e7a88f94-1bb0-4f96-aab7-374a140ac024,ac473da7-7003-41b1-9bfc-e715a99701bf,8aeb7e84-e1f3-4694-8751-6dcae6c4ba5e,e545d617-0ab7-44ab-a53a-c1a079a74c49,f1207bc2-c050-45f5-a6b9-2c8b3131168d,43e91e46-043f-487b-97e8-fe1a7a465ddc,907ae344-8f95-47d0-9377-1f8f880e019b,1de1229d-429f-40d8-90a2-d65619fad59a,17204180-256f-4b2e-946f-6e146ac840da,04053a02-8ba1-4fbe-8cd0-4e3e3c987df7,a5810950-a680-4ef9-b892-033f350c341f,a083642a-9b35-48db-b91b-592a43bc667d,1de6bc2f-fbce-40b4-a805-1502c09e62b0,d2dfb451-4f60-4806-1b41-55fa765dbf2c,bb1cf05b-30ed-d670-ce8c-9b0f7cbfd00f'
  http   traceparent: '00-98513d40e70771ead9a55bb2db47649f-8591595c4f1034d9-01'
  http   vary: 'Authorization,Accept-Encoding'
  http   via: '1.1 spaces-router (664a92218d61), 1.1 spaces-router (664a92218d61)'
  http   x-content-type-options: 'nosniff'
  http   x-runtime: '0.139663575'
  http {
  http   attach_url: '',
  http   command: 'bash',
  http   created_at: '2022-06-03T18:25:22Z',
  http   id: 'd47beb9d-ff81-4612-8210-7b4677125bea',
  http   name: 'run.7171',
  http   app: {
  http     id: '...',
  http     name: '...'
  http   },
  http   release: { id: '...', version: 3435 },
  http   size: 'Shield-M',
  http   state: 'starting',
  http   type: 'run',
  http   updated_at: '2022-06-03T18:26:24Z'
  http } +460ms
  heroku:run done running +0ms
/usr/lib/heroku/node_modules/@oclif/errors/lib/index.js:29
        throw err;
        ^

CLIError: There was a problem connecting to the dyno.
Confirm that your ssh key is added to your agent by running `ssh-add`.
Check that your ssh key has been uploaded to heroku with `heroku keys:add`.
See https://devcenter.heroku.com/articles/one-off-dynos#shield-private-spaces
    at Object.error (/usr/lib/heroku/node_modules/@oclif/errors/lib/index.js:22:17)
    at ChildProcess.<anonymous> (/usr/lib/heroku/node_modules/@heroku-cli/plugin-run/lib/lib/dyno.js:242:38)
    at ChildProcess.emit (events.js:400:28)
    at maybeClose (internal/child_process.js:1058:16)
    at Socket.<anonymous> (internal/child_process.js:443:11)
    at Socket.emit (events.js:400:28)
    at Pipe.<anonymous> (net.js:686:12) {
  oclif: { exit: 2 },
  code: undefined
}

What is the expected behavior?

Please mention your heroku and OS version. Please state if you are behind an HTTP proxy or company firewall as well.

I would expect to get a shell into a shield dyno for the app.

$ heroku --version
heroku/7.60.2 linux-x64 node-v14.19.0

$ uname -a
Linux pepper 5.15.0-33-generic #34-Ubuntu SMP Wed May 18 13:34:26 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04 LTS
Release:        22.04
Codename:       jammy

No proxy No firewall

gataky avatar Jun 03 '22 18:06 gataky

I'm seeing a virtually identical problem today after upgrading to macOS 13 (Ventura). Weirdly, one-off dynos work absolutely fine on either the Common Runtime or normal Private Spaces, but not on Shield Private Spaces.

CLIError: There was a problem connecting to the dyno.
Confirm that your ssh key is added to your agent by running `ssh-add`.
Check that your ssh key has been uploaded to heroku with `heroku keys:add`.
See https://devcenter.heroku.com/articles/one-off-dynos#shield-private-spaces
    at Object.error (/opt/homebrew/Cellar/heroku/7.59.2/lib/client/7.65.0/node_modules/@oclif/errors/lib/index.js:22:17)
    at ChildProcess.<anonymous> (/opt/homebrew/Cellar/heroku/7.59.2/lib/client/7.65.0/node_modules/@heroku-cli/plugin-run/lib/lib/dyno.js:242:38)
    at ChildProcess.emit (events.js:400:28)
    at maybeClose (internal/child_process.js:1058:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5) {
  oclif: { exit: 2 },
  code: undefined
}

Heroku version: heroku/7.65.0 darwin-x64 node-v14.19.0 OS version: macOS 13.0 (22A380) No proxy or firewall

rofreg avatar Oct 25 '22 15:10 rofreg

Another Shield user on Ventura:

Running rails console on ⬢ myappname-api-production... provisioning, run.7472 (Shield-M)
/opt/homebrew/Cellar/heroku/7.47.12/lib/client/7.65.0/node_modules/@oclif/errors/lib/index.js:29
        throw err;
        ^

CLIError: There was a problem connecting to the dyno.
Confirm that your ssh key is added to your agent by running `ssh-add`.
Check that your ssh key has been uploaded to heroku with `heroku keys:add`.
See https://devcenter.heroku.com/articles/one-off-dynos#shield-private-spaces
    at Object.error (/opt/homebrew/Cellar/heroku/7.47.12/lib/client/7.65.0/node_modules/@oclif/errors/lib/index.js:22:17)
    at ChildProcess.<anonymous> (/opt/homebrew/Cellar/heroku/7.47.12/lib/client/7.65.0/node_modules/@heroku-cli/plugin-run/lib/lib/dyno.js:242:38)
    at ChildProcess.emit (events.js:400:28)
    at maybeClose (internal/child_process.js:1058:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5) {
  oclif: { exit: 2 },
  code: undefined
}

On my laptop that was just updated to Ventura:

  • Connecting to a shield dyno fails with the above error
  • Connecting to a non-shield 1-off dyno works as expected

On my Monterey laptop

  • I can create and connect to a shield dyno as expected

jeffperrin avatar Oct 25 '22 16:10 jeffperrin

Running DEBUG=* HEROKU_DEBUG=1 heroku run bash gave some additional useful information. It looks like my existing ssh-rsa key was being rejected:

debug1: send_pubkey_test: no mutual signature algorithm

Generating a new ssh-ed25519 key resolved the problem for me.

rofreg avatar Oct 25 '22 19:10 rofreg

This looks to be an SSH issue with Ventura. Generating a new key as above looks to be the right move.

saracope avatar Oct 25 '22 20:10 saracope

After creating a ssh-key, I was able to solve the issue running heroku keys:add and selecting the desire key from the list.

maurogamboa avatar Oct 28 '22 17:10 maurogamboa

I was able to connect to Heroku after generating a new key ssh-ed25519. Thank you @rofreg

himanshud9 avatar Nov 17 '22 14:11 himanshud9

Generating a new key with ssh-ed25519 worked for me. Thanks, @rofreg To generate a new key with ssh-ed25519, use the command ssh-keygen -t ed25519. It will create a new key pair d_ed25519 and id_ed25519_pub. You need these keys to ssh and also Heroku.

pdulimitta avatar May 30 '23 17:05 pdulimitta