meteor-up icon indicating copy to clipboard operation
meteor-up copied to clipboard

Mup Setup and Deploy fail - All configured authentication methods failed

Open TechStacker opened this issue 6 years ago • 18 comments

Hey, I've spent hours trying to deploy my app to my DigitalOcean Droplet. I keep getting this error:

Started TaskList: Setup Docker
[138.197.207.118] - Setup Docker
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: All configured authentication methods failed
    at tryNextAuth (/usr/local/lib/node_modules/mup/node_modules/nodemiral/node_modules/ssh2/lib/client.js:290:17)
    at SSH2Stream.onUSERAUTH_FAILURE (/usr/local/lib/node_modules/mup/node_modules/nodemiral/node_modules/ssh2/lib/client.js:469:5)
    at emitTwo (events.js:126:13)
    at SSH2Stream.emit (events.js:214:7)
    at parsePacket (/usr/local/lib/node_modules/mup/node_modules/ssh2-streams/lib/ssh.js:3647:10)
    at SSH2Stream._transform (/usr/local/lib/node_modules/mup/node_modules/ssh2-streams/lib/ssh.js:551:13)
    at SSH2Stream.Transform._read (_stream_transform.js:186:10)
    at SSH2Stream._read (/usr/local/lib/node_modules/mup/node_modules/ssh2-streams/lib/ssh.js:212:15)
    at SSH2Stream.Transform._write (_stream_transform.js:174:12)
    at doWrite (_stream_writable.js:387:12)
    at writeOrBuffer (_stream_writable.js:373:5)
    at SSH2Stream.Writable.write (_stream_writable.js:290:11)
    at Socket.ondata (_stream_readable.js:639:20)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
\W$ 

I've tried using pem + password in my mup file, and without, same error.

My setup is Mac Sierra (latest) Latest Mup version Latest Meteor (1.7)

Here’s my mup file (edited out sensitive info):

module.exports = {
    servers: {
        one: {
            host: 'my-ip',
            username: 'david-admin',
            opts: {
                port: 2222,
            },
        },
    },

    app: {
        // TODO: change app name and path
        name: 'techstacker',
        path: '../',

        servers: {
            one: {},
        },

        buildOptions: {
            serverOnly: true,

            executable: 'meteor',
        },

        env: {
            // TODO: Change to your app's url
            // If you are using ssl, it needs to start with https://
            ROOT_URL: 'https://mywebsite.com',
            MONGO_URL: 'my-external-mongodb',
        },

        docker: {
            // change to 'abernix/meteord:base' if your app is using Meteor 1.4 - 1.5
            image: 'zodern/meteor:root',
        },

        // Show progress bar while uploading bundle to server
        // You might need to disable it on CI servers
        enableUploadProgressBar: true,
    },




    proxy: {
        // comma-separated list of domains your website
        // will be accessed at.
        // You will need to configure your DNS for each one.
        domains: 'mydomain.com',
        ssl: {
            // TODO: disable if not using SSL
            forceSSL: true,
            // Enable let's encrypt to create free certificates
            letsEncryptEmail: '[email protected]',
        },
    },
};

I have no clue where to go from here, any suggestions? :-)

TechStacker avatar Jul 03 '18 18:07 TechStacker

Did you forget to add your key to

servers: {
        one: {
            host: 'my-ip',
            username: 'david-admin',
            pem:'/<path_to_ssh>/.ssh/david-admin_key',
            opts: {
                port: 2222,
            },
        },
    },

or did you commit out this part ?

guillim avatar Jul 04 '18 07:07 guillim

@guillim yeah, I tried with pem and without, it gives me the same error :(

TechStacker avatar Jul 04 '18 07:07 TechStacker

I'm on the sidelines. We've also tried adding the password the key in the file. Same error again.

It seems like the ssh-agent does not like something. The error messages really aren't that helpful when it comes to SSH.

The problem started happening after an OS update.

This exact app has gotten deployed before and the problem didn't exist a few weeks ago.

I use the exact same MUP setup and I can deploy without problems. The only difference is that I'm on Ubuntu 18.04

MathiasKandelborg avatar Jul 04 '18 07:07 MathiasKandelborg

Well ...can you at least ssh your webserver through your terminal directly ? @TechStacker @MathiasKandelborg

guillim avatar Jul 05 '18 07:07 guillim

That was also my first thought. Thinking that it could have been a problem regarding the ssh-agent itself. But no, the ability to connect to the server with the ssh-agent was a-ok! So...

It took several hours of non-stop trying different things. Finally concluding that some permissions weren't correct regarding the node installation.

The reason this went sour was a wrong configuration on the computer, I'm not sure how to handle that. Perhaps some documentation should be written, which I'd also gladly do.

On a side note: The error handling around SSH'ing is of course extremely hard to get right. If you got a suggestion on a PR I could make - I'd happily try my best.

MathiasKandelborg avatar Jul 05 '18 19:07 MathiasKandelborg

@TechStacker Also, make sure you don't have password on your ssh key. It will ease the debugging process (Later, you can use a password with the ssh key but it is another step forward, let's try easy first)

guillim avatar Jul 06 '18 08:07 guillim

@guillim Dude, we fixed it.

MathiasKandelborg avatar Jul 06 '18 08:07 MathiasKandelborg

At this point I can deploy without problems if I do the following before mup setup and mup deploy:

ssh-add -K /Users/davidt/.ssh/my-app_id

If I don't do the above, I get this on mup setup:

Started TaskList: Setup Docker
[138.197.207.118] - Setup Docker
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: All configured authentication methods failed
    at tryNextAuth (/Users/davidt/.nvm/versions/node/v8.11.3/lib/node_modules/mup/node_modules/nodemiral/node_modules/ssh2/lib/client.js:290:17)
    at SSH2Stream.onUSERAUTH_FAILURE (/Users/davidt/.nvm/versions/node/v8.11.3/lib/node_modules/mup/node_modules/nodemiral/node_modules/ssh2/lib/client.js:469:5)
    at emitTwo (events.js:126:13)
    at SSH2Stream.emit (events.js:214:7)
    at parsePacket (/Users/davidt/.nvm/versions/node/v8.11.3/lib/node_modules/mup/node_modules/ssh2-streams/lib/ssh.js:3647:10)
    at SSH2Stream._transform (/Users/davidt/.nvm/versions/node/v8.11.3/lib/node_modules/mup/node_modules/ssh2-streams/lib/ssh.js:551:13)
    at SSH2Stream.Transform._read (_stream_transform.js:186:10)
    at SSH2Stream._read (/Users/davidt/.nvm/versions/node/v8.11.3/lib/node_modules/mup/node_modules/ssh2-streams/lib/ssh.js:212:15)
    at SSH2Stream.Transform._write (_stream_transform.js:174:12)
    at doWrite (_stream_writable.js:397:12)
    at writeOrBuffer (_stream_writable.js:383:5)
    at SSH2Stream.Writable.write (_stream_writable.js:290:11)
    at Socket.ondata (_stream_readable.js:639:20)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)

I have no clue why I have to do this, but if anyone has some advice, I'd appreciate it! :)

TechStacker avatar Jul 11 '18 17:07 TechStacker

@guillim Dude,我們修好了。

hello MathiasKandelborg I have the samm problem , can you teach me how ti handle it

jasonkiller200 avatar May 30 '19 08:05 jasonkiller200

For anyone coming to this later, I just had the same problem. (As suggested by @guillim, testing by ssh'ing directly to the server was helpful to figure out what was going wrong.) After doing the following, I was finally able to run mup setup:

  1. Start ssh-agent using $(eval ssh-agent -s) (and I assume I will have to start this again when I inevitably restart and/or make sure ssh-agent starts at login)
  2. As suggested by @TechStacker, do ssh-add ~/.ssh/id_ecdsa
  3. On my server (the same machine in my case), add the contents of the public key id_ecdsa.pub to the ~/.ssh/authorized_keys file.
  4. I also apt installed docker.io at some point during the process, but I don't know if that was necessary or not.

All perhaps a bit obvious in retrospect, but these things are never clear in the moment. :)

sarahscheffler avatar Mar 09 '21 02:03 sarahscheffler

I struggled for many hours to resolve the mup ssh connection issues to a new AWS EC2 Ubuntu 22 server (within a new VPC). I was able to ssh from the commandline, but mup ssh kept failing with "All configured authentication methods failed".

I found the answer here which is to allow ssh-rsa key types for openssh on the new server.

  • Open file /etc/ssh/sshd_config
  • Add the line PubkeyAcceptedKeyTypes=+ssh-rsa to the end
  • Restart the service sshd with sudo systemctl restart sshd.service

I also struggled a little with setting up the VPC for internet access, and the linked article was very helpful to troubleshoot.

Hope it helps someone.

productiveme avatar May 12 '22 03:05 productiveme

@productiveme thanks! Btw for anybody else who made the same mistake as me make sure to do that fix on the new server and not on your local machine.

SachaG avatar Aug 01 '22 13:08 SachaG

*If you have the flexibility to change OS of your server **and if you're unable to make persistent manual changes to the target server

For us an alternative solution was to just downgrade our instance to Ubuntu 20 since it seems the issue is rooted in the compatibility between Mup and Ubuntu 22.

wallind avatar Feb 16 '23 19:02 wallind

I struggled for many hours to resolve the mup ssh connection issues to a new AWS EC2 Ubuntu 22 server (within a new VPC). I was able to ssh from the commandline, but mup ssh kept failing with "All configured authentication methods failed".

I found the answer here which is to allow ssh-rsa key types for openssh on the new server.

  • Open file /etc/ssh/sshd_config
  • Add the line PubkeyAcceptedKeyTypes=+ssh-rsa to the end
  • Restart the service sshd with sudo systemctl restart sshd.service

I also struggled a little with setting up the VPC for internet access, and the linked article was very helpful to troubleshoot.

Hope it helps someone.

Thanks a lot digitalocean -> sudo systemctl restart ssh.service

dotKa avatar Mar 06 '23 08:03 dotKa

I struggled for many hours to resolve the mup ssh connection issues to a new AWS EC2 Ubuntu 22 server (within a new VPC). I was able to ssh from the commandline, but mup ssh kept failing with "All configured authentication methods failed".

I found the answer here which is to allow ssh-rsa key types for openssh on the new server.

  • Open file /etc/ssh/sshd_config
  • Add the line PubkeyAcceptedKeyTypes=+ssh-rsa to the end
  • Restart the service sshd with sudo systemctl restart sshd.service

I also struggled a little with setting up the VPC for internet access, and the linked article was very helpful to troubleshoot.

Hope it helps someone.

Cool. Many thanks. It work

Nguyenkhanh98 avatar Aug 17 '23 10:08 Nguyenkhanh98

I struggled for many hours to resolve the mup ssh connection issues to a new AWS EC2 Ubuntu 22 server (within a new VPC). I was able to ssh from the commandline, but mup ssh kept failing with "All configured authentication methods failed".

I found the answer here which is to allow ssh-rsa key types for openssh on the new server.

  • Open file /etc/ssh/sshd_config
  • Add the line PubkeyAcceptedKeyTypes=+ssh-rsa to the end
  • Restart the service sshd with sudo systemctl restart sshd.service

I also struggled a little with setting up the VPC for internet access, and the linked article was very helpful to troubleshoot.

Hope it helps someone.

This worked for me! Thank you!

amrit19 avatar Nov 11 '23 00:11 amrit19

I had the same problem after upgrading to Ubuntu 22.04: Error: All configured authentication methods failed.

Instead of adding PubkeyAcceptedKeyTypes=+ssh-rsa to /etc/ssh/sshd_config, I added an ED25519 key to ~/.ssh/authorized_keys (on the server).

According to the Gitlab documentation: "Available documentation suggests ED25519 is more secure than RSA."

  1. If you don't have an ED25519 key, you can create one following the instructions here
  2. Then, log into the server and add the content of id_ed25519.pub to the end of the file ~/.ssh/authorized_keys
  3. And restart the ssh service: sudo service ssh restart

racosa avatar Mar 19 '24 20:03 racosa

Hope it helps someone.

Awesome. It worked!

derwaldgeist avatar Apr 09 '24 13:04 derwaldgeist