juju ssh & exec: `-e: command not found`

Bug #1994911 reported by Jordan Barrett
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Colin Misare

Bug Description

When you create a new LXD machine and ssh into it / exec on it, we get some strange extra output:

$ juju ssh 0
...
-e: command not found

$ juju exec --machine 0 -- echo foo
foo
/etc/profile.d/juju-proxy.sh: line 1: -e: command not found

This is on:
- Juju 2.9.37-ubuntu-amd64-1650771
- LXD 5.7-749a602
- Ubuntu 20.04.5 LTS

Possibly a regression from https://github.com/juju/juju/pull/14827

Revision history for this message
Jordan Barrett (barrettj12) wrote :

Can confirm it's a regression from https://github.com/juju/juju/pull/14827 (commit SHA 139f196). While that patch seems to have fixed ssh output for the controller machine, it also has broken it for non-controller machines.

Revision history for this message
Jordan Barrett (barrettj12) wrote :

Here's comparing the output for two versions of 2.9, each one setup with an LXD controller and one machine in the default model.

Juju 2.9.37-1650771 (which includes commit 139f196):

--------------------------------------------------------------------------
$ juju ssh -m controller 0
[correct output]
--------------------------------------------------------------------------
$ juju ssh -m controller 0 'cat /etc/profile.d/juju-proxy.sh'

# Added by juju
[ -f "/etc/juju-proxy.conf" ] && . "/etc/juju-proxy.conf"

Connection to 10.120.49.209 closed.
--------------------------------------------------------------------------
$ juju exec -m controller --machine 0 -- echo foo
foo

--------------------------------------------------------------------------
$ juju ssh -m default 0
...
-e: command not found
--------------------------------------------------------------------------
$ juju ssh -m default 0 'cat /etc/profile.d/juju-proxy.sh'
-e
# Added by juju
[ -f "/etc/juju-proxy.conf" ] && . "/etc/juju-proxy.conf"

Connection to 10.120.49.65 closed.
--------------------------------------------------------------------------
$ juju exec -m default --machine 0 -- echo foo
foo
/etc/profile.d/juju-proxy.sh: line 1: -e: command not found

--------------------------------------------------------------------------

Juju 2.9.37-1650771 with 139f196 reverted:

--------------------------------------------------------------------------
$ juju ssh -m controller 0
...
n#: command not found
--------------------------------------------------------------------------
$ juju ssh -m controller 0 'cat /etc/profile.d/juju-proxy.sh'
\n# Added by juju\n[ -f "/etc/juju-proxy.conf" ] && . "/etc/juju-proxy.conf"\n
Connection to 10.120.49.48 closed.
--------------------------------------------------------------------------
$ juju exec -m controller --machine 0 -- echo foo
foo
/etc/profile.d/juju-proxy.sh: line 1: n#: command not found

--------------------------------------------------------------------------
$ juju ssh -m default 0
[correct output]
--------------------------------------------------------------------------
$ juju ssh -m default 0 'cat /etc/profile.d/juju-proxy.sh'

# Added by juju
[ -f "/etc/juju-proxy.conf" ] && . "/etc/juju-proxy.conf"

Connection to 10.120.49.134 closed.
--------------------------------------------------------------------------
$ juju exec -m default --machine 0 -- echo foo
foo

--------------------------------------------------------------------------

So it appears that 139f196 fixed the output for the controller machine, while simultaneously breaking output for non-controller machines. I'm not sure why there should be any difference between them.

Changed in juju:
importance: Undecided → Low
status: New → Triaged
milestone: none → 2.9.37
Ian Booth (wallyworld)
Changed in juju:
importance: Low → High
Ian Booth (wallyworld)
Changed in juju:
status: Triaged → Fix Committed
assignee: nobody → Colin Misare (cmisare)
Revision history for this message
Jordan Barrett (barrettj12) wrote (last edit ):
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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