Bootstrap fails with "credentials not found" for "local" cloud

Bug #1813650 reported by Mario Splivalo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Medium
Simon Richardson
2.5
Fix Released
Medium
Simon Richardson
2.6
Fix Committed
Medium
Simon Richardson

Bug Description

Since upgrading to juju 2.5 I can no longer bootstrap against local provider.

This is my clouds.yaml file that I have since juju 2.1:

ubuntu@z-rotomvm05:~$ cat .local/share/juju/clouds.yaml
clouds:
  local:
    type: lxd
    config:
      apt-http-proxy: http://10.230.56.3:3142
      automatically-retry-hooks: false
      image-stream: daily

On juju 2.3.7 (one which comes with vanilla xenial install, but latest 2.4 also works fine), the bootstrap of 'local' cloud works fine: https://paste.ubuntu.com/p/cngKz5yR4g/

However, after upgrading to juju2.5, I can no longer bootstrap that cloud:

ubuntu@z-rotomvm05:~$ juju bootstrap local --show-log --debug
19:29:57 INFO juju.cmd supercommand.go:57 running juju [2.5.0 gc go1.10.4]
19:29:57 DEBUG juju.cmd supercommand.go:58 args: []string{"juju", "bootstrap", "local", "--show-log", "--debug"}
19:29:57 INFO cmd cloudcredential.go:83 no credentials found, checking environment
ERROR credentials for cloud "local" not found
19:29:57 DEBUG cmd supercommand.go:496 error stack:
/build/juju-core-QgKzh_/juju-core-2.5.0/obj-x86_64-linux-gnu/src/github.com/juju/juju/cmd/modelcmd/credentials.go:181: credentials for cloud "local" not found
/build/juju-core-QgKzh_/juju-core-2.5.0/obj-x86_64-linux-gnu/src/github.com/juju/juju/cmd/juju/common/cloudcredential.go:89:
/build/juju-core-QgKzh_/juju-core-2.5.0/obj-x86_64-linux-gnu/src/github.com/juju/juju/cmd/juju/commands/bootstrap.go:902:
/build/juju-core-QgKzh_/juju-core-2.5.0/obj-x86_64-linux-gnu/src/github.com/juju/juju/cmd/juju/commands/bootstrap.go:425:
ubuntu@z-rotomvm05:~$

I tried changing the cloud name from 'local' to 'lxd' - this time boostrap starts, container is created, but is destroyed at the end: https://paste.ubuntu.com/p/mMZ3BQRrQH/

Changing the cloud name to something else (tried 'mariotest') yelds the same error message:

19:46:09 INFO cmd cloudcredential.go:83 no credentials found, checking environment
ERROR credentials for cloud "mariotest" not found

Tags: bootstrap lxd
Revision history for this message
Mario Splivalo (mariosplivalo) wrote :

When I change the cloud name to 'localhost' I can actually change the configuration via the yaml file, and everything works as expected:

ubuntu@z-rotomvm05:~$ cat .local/share/juju/clouds.yaml
clouds:
  localhost:
    type: lxd
    config:
      apt-http-proxy: http://10.230.56.3:3142
      automatically-retry-hooks: false
      image-stream: daily

ubuntu@z-rotomvm05:~$ juju show-cloud localhost
defined: local
type: lxd
description: LXD Container Hypervisor
config:
  apt-http-proxy: http://10.230.56.3:3142
  automatically-retry-hooks: false
  image-stream: daily
ubuntu@z-rotomvm05:~$ juju model-config | grep -E 'apt-http-proxy|retry'
apt-http-proxy controller http://10.230.56.3:3142
automatically-retry-hooks controller false
ubuntu@z-rotomvm05:~$

So, it seems that the only way to use local lxd is to have cloud named 'localhost'. One can then deploy as much controllers as needed against that cloud.

The only issue I see here is that one can't have different localhost configurations under separate names (for instance, local-one cloud with one set of proxies, local-two cloud with another set of proxies - this was possible prior 2.5.0).

This should be better explained in the documentation.
Or, maybe, juju should assume that for lxd type of cloud if no credentials are supplied/configured, it is a local lxd that it should connect to?

Tim Penhey (thumper)
tags: added: bootstrap lxd
Changed in juju:
status: New → Triaged
importance: Undecided → Medium
milestone: none → 2.5.2
Changed in juju:
milestone: 2.5.2 → 2.5.3
Changed in juju:
milestone: 2.5.3 → 2.5.4
Changed in juju:
milestone: 2.5.4 → 2.5.5
Changed in juju:
milestone: 2.5.6 → 2.5.8
Changed in juju:
milestone: 2.5.8 → 2.5.9
Revision history for this message
Mario Splivalo (mariosplivalo) wrote :

This is still problem in juju 2.6 too, except that on 2.6 changing the cloud name to 'localhost' doesn't work either:

mario@BUNTOR ~> juju show-cloud localhost
defined: local
type: lxd
description: LXD Container Hypervisor
config:
  apt-http-proxy: http://192.168.10.2:3142
  automatically-retry-hooks: false
  image-stream: daily

mario@BUNTOR ~> juju bootstrap localhost local-test1 --debug
13:44:36 INFO juju.cmd supercommand.go:57 running juju [2.6.5 gc go1.10.4]
13:44:36 DEBUG juju.cmd supercommand.go:58 args: []string{"juju", "bootstrap", "localhost", "local-test1", "--debug"}
13:44:36 DEBUG juju.container.lxd connection.go:173 LXD snap socket not found, falling back to debian socket: "/var/lib/lxd"
ERROR no addresses match
13:44:36 DEBUG cmd supercommand.go:496 error stack:
no addresses match
/build/juju-core-Lhoi1j/juju-core-2.6.5/obj-x86_64-linux-gnu/src/github.com/juju/juju/provider/lxd/server.go:258:
/build/juju-core-Lhoi1j/juju-core-2.6.5/obj-x86_64-linux-gnu/src/github.com/juju/juju/provider/lxd/server.go:167:
/build/juju-core-Lhoi1j/juju-core-2.6.5/obj-x86_64-linux-gnu/src/github.com/juju/juju/provider/lxd/provider.go:351:
/build/juju-core-Lhoi1j/juju-core-2.6.5/obj-x86_64-linux-gnu/src/github.com/juju/juju/provider/lxd/provider.go:319:
/build/juju-core-Lhoi1j/juju-core-2.6.5/obj-x86_64-linux-gnu/src/github.com/juju/juju/provider/lxd/provider.go:330:
/build/juju-core-Lhoi1j/juju-core-2.6.5/obj-x86_64-linux-gnu/src/github.com/juju/juju/cmd/juju/commands/bootstrap.go:905:
/build/juju-core-Lhoi1j/juju-core-2.6.5/obj-x86_64-linux-gnu/src/github.com/juju/juju/cmd/juju/commands/bootstrap.go:507:
1 mario@BUNTOR ~>

If I change the cloud name from localhost to something else, I get the error as in original bug report:

mario@BUNTOR ~> juju show-cloud mylocal
defined: local
type: lxd
description: LXD Container Hypervisor
config:
  apt-http-proxy: http://192.168.10.2:3142
  automatically-retry-hooks: false
  image-stream: daily
mario@BUNTOR ~> juju bootstrap mylocal local-test1 --debug
13:45:36 INFO juju.cmd supercommand.go:57 running juju [2.6.5 gc go1.10.4]
13:45:36 DEBUG juju.cmd supercommand.go:58 args: []string{"juju", "bootstrap", "mylocal", "local-test1", "--debug"}
13:45:36 INFO cmd cloudcredential.go:91 no credentials found, checking environment
13:45:36 DEBUG juju.container.lxd connection.go:173 LXD snap socket not found, falling back to debian socket: "/var/lib/lxd"
13:45:36 ERROR juju.provider.lxd credentials.go:158 unable to detect local LXC credentials: failed to connect to local LXD: no addresses match
ERROR credentials for cloud "mylocal" not found
See `juju add-credential mylocal --help` for instructions
13:45:36 DEBUG cmd supercommand.go:496 error stack:
/build/juju-core-Lhoi1j/juju-core-2.6.5/obj-x86_64-linux-gnu/src/github.com/juju/juju/cmd/juju/commands/bootstrap.go:544: credentials for cloud "mylocal" not found
See `juju add-credential mylocal --help` for instructions
/build/juju-core-Lhoi1j/juju-core-2.6.5/obj-x86_64-linux-gnu/src/github.com/juju/juju/cmd/juju/commands/bootstrap.go:550:
1 mario@BUNTOR ~>

Revision history for this message
Anastasia (anastasia-macmood) wrote :
Changed in juju:
status: Triaged → In Progress
assignee: nobody → Simon Richardson (simonrichardson)
milestone: 2.5.9 → 2.7-beta1
status: In Progress → Fix Committed
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.

Other bug subscribers

Remote bug watches

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