juju ssh exits with sub command returncode

Bug #1246938 reported by Marco Ceppi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
juju-core
Fix Released
High
Abel Deuring

Bug Description

Deploy a unit, juju ssh into that unit. Press Ctrl+C, then disconnect either via exit or Ctrl+D.

ubuntu@juju-ubuntu-discourse-alpha-machine-0:~$ ^C
ubuntu@juju-ubuntu-discourse-alpha-machine-0:~$ logout
Connection to 15.185.108.183 closed.
ERROR exit status 130
marco@home:~$ echo $?
1

Juju ssh always exist with the return code of the last sub command executed. This behaviour is only expected when commands are passed to ssh.h

Related branches

Marco Ceppi (marcoceppi)
tags: added: cts-cloud-review
Revision history for this message
Dave Cheney (dave-cheney) wrote : Re: [Bug 1246938] Re: juju ssh exits with code 130

130 is SIGINT, from the internal ^C

On Fri, Nov 1, 2013 at 12:12 PM, Marco Ceppi <email address hidden> wrote:
> ** Tags added: cts-cloud-review
>
> --
> You received this bug notification because you are subscribed to juju-
> core.
> Matching subscriptions: MOAR JUJU SPAM!
> https://bugs.launchpad.net/bugs/1246938
>
> Title:
> juju ssh exits with code 130
>
> Status in juju-core:
> New
>
> Bug description:
> Deploy a unit, juju ssh into that unit. Press Ctrl+C, then disconnect
> either via exit or Ctrl+D.
>
> ubuntu@juju-ubuntu-discourse-alpha-machine-0:~$ ^C
> ubuntu@juju-ubuntu-discourse-alpha-machine-0:~$ logout
> Connection to 15.185.108.183 closed.
> ERROR exit status 130
> marco@home:~$ echo $?
> 1
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/juju-core/+bug/1246938/+subscriptions

Curtis Hovey (sinzui)
summary: - juju ssh exits with code 130
+ juju ssh exits with sub command returncode
Changed in juju-core:
status: New → Triaged
importance: Undecided → High
tags: added: ui
description: updated
tags: added: ssh
Revision history for this message
Curtis Hovey (sinzui) wrote :

Looks like juju ssh thinks it is running a remote command, it always exits with the last returncode executed in the remote shell. This is very unexpectd.

THIS IS EXPECTED
$ juju ssh mongodb/0 'ls /bugus'
ls: cannot access /bugus: No such file or directory
Connection to 10.55.32.3 closed.
ERROR exit status 2

THIS IS UNEXPECTED
$ juju ssh mongodb/0
ubuntu@juju-staging-machine-1:~$ ls /bogus
ls: cannot access /bogus: No such file or directory
ubuntu@juju-staging-machine-1:~$ logout
Connection to 10.55.32.3 closed.
ERROR exit status 2

Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 1246938] Re: juju ssh exits with sub command returncode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2013-11-12 20:39, Curtis Hovey wrote:
> Looks like juju ssh thinks it is running a remote command, it
> always exits with the last returncode executed in the remote shell.
> This is very unexpectd.
>
> THIS IS EXPECTED $ juju ssh mongodb/0 'ls /bugus' ls: cannot
> access /bugus: No such file or directory Connection to 10.55.32.3
> closed. ERROR exit status 2
>
> THIS IS UNEXPECTED $ juju ssh mongodb/0
> ubuntu@juju-staging-machine-1:~$ ls /bogus ls: cannot access
> /bogus: No such file or directory ubuntu@juju-staging-machine-1:~$
> logout Connection to 10.55.32.3 closed. ERROR exit status 2

I'm pretty sure "juju ssh" is just triggering "ssh" under the covers.
So I think it is based on whatever your own "ssh" is doing.

Looking at the code, it just invokes:

ssh -l ubuntu -t -o "StrictHostKeyChecking no -o
"PasswordAuthentication no" $HOST

So *if* you're getting a return code from SSH I would look into your
ssh config/process/etc.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlKEbBoACgkQJdeBCYSNAAPKwQCggbEOURPFU2ofc0tPElqd/qCg
YfgAoIhLepF5MYIBa1qdtZ+4PfjxlzRz
=83TD
-----END PGP SIGNATURE-----

Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you for looking into this John.

Replaying the bad command with the raw command does not reproduce the error. ssh just works for me, juju does not. I imagine juju and ssh just works for you. I issued these commands in the same terminal in quick succession and only juju reports a problem.

$ ssh -l ubuntu -t -o "StrictHostKeyChecking no" -o "PasswordAuthentication no" 10.55.32.60
ubuntu@juju-staging-machine-3:~$ ls /bogus
ls: cannot access /bogus: No such file or directory
ubuntu@juju-staging-machine-3:~$ logout
Connection to 10.55.32.60 closed.

ubuntu@juju-staging-machine-3:~$ ls /bogus
ls: cannot access /bogus: No such file or directory
ubuntu@juju-staging-machine-3:~$ logout
Connection to 10.55.32.60 closed.
ERROR exit status 2

Abel Deuring (adeuring)
Changed in juju-core:
assignee: nobody → Abel Deuring (adeuring)
Curtis Hovey (sinzui)
Changed in juju-core:
status: Triaged → Fix Committed
milestone: none → 1.17.3
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.