I've been looking into this bug, here's the full environment as passed to lxc-ls:
SUDO_GID=200512
MAIL=/var/mail/root
USER=root
LANGUAGE=en_CA:en
HOME=/root
SUDO_UID=201105
LOGNAME=root
USERNAME=root
TERM=unknown
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
JUJU_HOME=/tmp/juju/stgraber-sample
LANG=en_CA.UTF-8
JUJU_ORIGIN=distro
SUDO_COMMAND=/usr/bin/python -m juju.agents.machine --logfile /tmp/juju/stgraber-sample/machine-agent.log --zookeeper-servers 10.0.3.1:40010 --juju-directory /tmp/juju/stgraber-sample --machine-id 0 --session-file /var/run/juju/stgraber-sample-machine-agent.zksession --pidfile /tmp/juju/stgraber-sample/machine-agent.pid
SHELL=/bin/bash
JUJU_ZOOKEEPER=10.0.3.1:40010
JUJU_UNIT_NS=stgraber-sample
JUJU_SERIES=precise
SUDO_USER=stgraber
JUJU_PUBLIC_KEY=ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6yjMe+wWsH9xgor39al4p+W22D7Io8+n0ZahNEWyTG0rLZDYMQryrXUDYJRvAbiCVfTB4e7waLTDoaK5sSqoa0GoexYCIgFduOBHZfjWHu9HcpIeoq5Bc+XmOYQaoFjL4YEc2GAP//8CEmGLCqC/+rO36YbBPjd0176pAJQ7R2Bym+4k2/VvA4Plw439IdElGMgK2ge+5xc0qq7iph+ITCriR1eYCorA6T2j97ufddvQO/fmOh9+HoQ4Y+i6mKSPNyO9m87+KImwF1XX/ocQRBO9eYkqWM992ZqXG4H62r+NoRNwW4R9c5nF6rUc8x1StTpp3L0A0ybIYjRuV3m+J stgraber@lantea
JUJU_MACHINE_ID=0
PWD=/home/stgraber
PYTHONPATH=/usr/bin:/usr/lib/python2.7:/usr/lib/python2.7/plat-i386-linux-gnu:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages/PILcompat:/usr/lib/python2.7/dist-packages/gst-0.10:/usr/lib/python2.7/dist-packages/gtk-2.0:/usr/lib/pymodules/python2.7:/usr/lib/python2.7/dist-packages/ubuntu-sso-client:/usr/lib/python2.7/dist-packages/ubuntuone-client:/usr/lib/python2.7/dist-packages/ubuntuone-control-panel:/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol
You'll notice that JuJu overrides PYTHONPATH with 2.7 paths when lxc-ls is a python3 script.
This in turn causes the python interpreter to fail as can be seen below:
stgraber@lantea:~$ export PYTHONPATH=/usr/bin:/usr/lib/python2.7:/usr/lib/python2.7/plat-i386-linux-gnu:/usr/lib/python2.7/lib-tk:/usr/lib/python2.7/lib-old:/usr/lib/python2.7/lib-dynload:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages/PILcompat:/usr/lib/python2.7/dist-packages/gst-0.10:/usr/lib/python2.7/dist-packages/gtk-2.0:/usr/lib/pymodules/python2.7:/usr/lib/python2.7/dist-packages/ubuntu-sso-client:/usr/lib/python2.7/dist-packages/ubuntuone-client:/usr/lib/python2.7/dist-packages/ubuntuone-control-panel:/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol
stgraber@lantea:~$ python3
Fatal Python error: Py_Initialize: Unable to get the locale encoding
File "/usr/lib/python2.7/encodings/__init__.py", line 123
raise CodecRegistryError,\ ^
SyntaxError: invalid syntax
Aborted (core dumped)
stgraber@lantea:~$
So the bug is actually in juju which doesn't pass a clean environment to the scripts it's calling and triggers this bug.
I've been looking into this bug, here's the full environment as passed to lxc-ls: local/sbin: /usr/local/ bin:/usr/ sbin:/usr/ bin:/sbin: /bin:/usr/ games:/ usr/local/ games /tmp/juju/ stgraber- sample /usr/bin/ python -m juju.agents.machine --logfile /tmp/juju/ stgraber- sample/ machine- agent.log --zookeeper-servers 10.0.3.1:40010 --juju-directory /tmp/juju/ stgraber- sample --machine-id 0 --session-file /var/run/ juju/stgraber- sample- machine- agent.zksession --pidfile /tmp/juju/ stgraber- sample/ machine- agent.pid 10.0.3. 1:40010 NS=stgraber- sample KEY=ssh- rsa AAAAB3NzaC1yc2E AAAADAQABAAABAQ C6yjMe+ wWsH9xgor39al4p +W22D7Io8+ n0ZahNEWyTG0rLZ DYMQryrXUDYJRvA biCVfTB4e7waLTD oaK5sSqoa0GoexY CIgFduOBHZfjWHu 9HcpIeoq5Bc+ XmOYQaoFjL4YEc2 GAP//8CEmGLCqC/ +rO36YbBPjd0176 pAJQ7R2Bym+ 4k2/VvA4Plw439I dElGMgK2ge+ 5xc0qq7iph+ ITCriR1eYCorA6T 2j97ufddvQO/ fmOh9+HoQ4Y+ i6mKSPNyO9m87+ KImwF1XX/ ocQRBO9eYkqWM99 2ZqXG4H62r+ NoRNwW4R9c5nF6r Uc8x1StTpp3L0A0 ybIYjRuV3m+ J stgraber@lantea /usr/bin: /usr/lib/ python2. 7:/usr/ lib/python2. 7/plat- i386-linux- gnu:/usr/ lib/python2. 7/lib-tk: /usr/lib/ python2. 7/lib-old: /usr/lib/ python2. 7/lib-dynload: /usr/local/ lib/python2. 7/dist- packages: /usr/lib/ python2. 7/dist- packages: /usr/lib/ python2. 7/dist- packages/ PILcompat: /usr/lib/ python2. 7/dist- packages/ gst-0.10: /usr/lib/ python2. 7/dist- packages/ gtk-2.0: /usr/lib/ pymodules/ python2. 7:/usr/ lib/python2. 7/dist- packages/ ubuntu- sso-client: /usr/lib/ python2. 7/dist- packages/ ubuntuone- client: /usr/lib/ python2. 7/dist- packages/ ubuntuone- control- panel:/ usr/lib/ python2. 7/dist- packages/ ubuntuone- storage- protocol
SUDO_GID=200512
MAIL=/var/mail/root
USER=root
LANGUAGE=en_CA:en
HOME=/root
SUDO_UID=201105
LOGNAME=root
USERNAME=root
TERM=unknown
PATH=/usr/
JUJU_HOME=
LANG=en_CA.UTF-8
JUJU_ORIGIN=distro
SUDO_COMMAND=
SHELL=/bin/bash
JUJU_ZOOKEEPER=
JUJU_UNIT_
JUJU_SERIES=precise
SUDO_USER=stgraber
JUJU_PUBLIC_
JUJU_MACHINE_ID=0
PWD=/home/stgraber
PYTHONPATH=
You'll notice that JuJu overrides PYTHONPATH with 2.7 paths when lxc-ls is a python3 script. /usr/bin: /usr/lib/ python2. 7:/usr/ lib/python2. 7/plat- i386-linux- gnu:/usr/ lib/python2. 7/lib-tk: /usr/lib/ python2. 7/lib-old: /usr/lib/ python2. 7/lib-dynload: /usr/local/ lib/python2. 7/dist- packages: /usr/lib/ python2. 7/dist- packages: /usr/lib/ python2. 7/dist- packages/ PILcompat: /usr/lib/ python2. 7/dist- packages/ gst-0.10: /usr/lib/ python2. 7/dist- packages/ gtk-2.0: /usr/lib/ pymodules/ python2. 7:/usr/ lib/python2. 7/dist- packages/ ubuntu- sso-client: /usr/lib/ python2. 7/dist- packages/ ubuntuone- client: /usr/lib/ python2. 7/dist- packages/ ubuntuone- control- panel:/ usr/lib/ python2. 7/dist- packages/ ubuntuone- storage- protocol python2. 7/encodings/ __init_ _.py", line 123 ror,\
^
This in turn causes the python interpreter to fail as can be seen below:
stgraber@lantea:~$ export PYTHONPATH=
stgraber@lantea:~$ python3
Fatal Python error: Py_Initialize: Unable to get the locale encoding
File "/usr/lib/
raise CodecRegistryEr
SyntaxError: invalid syntax
Aborted (core dumped)
stgraber@lantea:~$
So the bug is actually in juju which doesn't pass a clean environment to the scripts it's calling and triggers this bug.