I’m trying to run juju bootstrap inside LXD and this happens:
$ juju bootstrap localhost controller
Resolved LXD host address on bridge lxdbr0: https://10.73.222.1:8443
updating credential store
Adding contents of "/home/ubuntu/.local/share/juju/ssh/juju_id_rsa.pub" to authorized-keys
Creating Juju controller "controller" on localhost/localhost
Loading image metadata
Looking for packaged Juju agent version 2.7.3 for amd64
Starting new instance for initial controller
To configure your system to better support LXD containers, please see: https://github.com/lxc/lxd/blob/master/doc/production-setup.md
Launching controller instance(s) on localhost/localhost...
- juju-1596bf-0 (arch=amd64)
Installing Juju agent on bootstrap instance
Fetching Juju GUI 2.15.0
Waiting for address
Attempting to connect to 10.73.222.120:22
ERROR failed to bootstrap model: waited for 20m0s without being able to connect: /var/lib/juju/nonce.txt does not exist
$ cat deploy.log
20:48:11 ERROR juju.cmd.juju.commands bootstrap.go:778 failed to bootstrap model: waited for 20m0s without being able to connect: /var/lib/juju/nonce.txt does not exist
I thought that was a network issue but I ran it again and during the execution, I ssh into the instance and created an empty file called /var/lib/juju/nonce.txt. The error changed to:
13:03:07 DEBUG juju.provider.common bootstrap.go:591 connection attempt for 10.73.222.22 failed: /var/lib/juju/nonce.txt contents do not match machine nonce
Then, I added “user-admin:bootstrap” to the file and the execution continued a little more and hanged again:
13:10:47 INFO cmd bootstrap.go:360 Connected to 10.73.222.22
13:10:47 INFO juju.cloudconfig userdatacfg_unix.go:565 Fetching agent: curl -sSfw 'agent binaries from %{url_effective} downloaded: HTTP %{http_code}; time %{time_total}s; size %{size_download} bytes; speed %{speed_download} bytes/s ' --retry 10 -o $bin/tools.tar.gz <[https://streams.canonical.com/juju/tools/agent/2.7.3/juju-2.7.3-ubuntu-amd64.tgz]>
13:10:47 INFO cmd bootstrap.go:430 Running machine configuration script...
What I’m doing wrong? I’m using juju snap version 2.7.3.
Are you using a custom image for ‘ubuntu’ ? Offhand this looks like it isn’t properly running cloud-init. The other thing to look at is to start with a juju bootstrap and then from inside the container it started, look at /var/log/cloud-init-output.log. Usually that contains some hint as to why the instance is failing to initialize. Sometimes it can’t get to the Ubuntu Archive to install necessary packages, or sometimes the internal networking isn’t correct (no route to the outside world).