Error failed to bootstrap model: subprocess encountered error code 1

On a bare metal server I installed lxd. Then followed the instructions for juju:

sudo lxd init
sudo snap install juju --classic
juju bootstrap localhost

This is where I ran into trouble. The bootstrap process ended with:

ERROR Get "https://10.90.106.1:8443/1.0": Unable to connect to: 10.90.106.1:8443
ERROR failed to bootstrap model: subprocess encountered error code 1

Any tips what I can do to troubleshoot this? Below is the result of using the “–debug” flag:

Today I tried the same steps in an Ubuntu VM:

  • Install lxd
  • Install juju
  • lxd init
  • juju bootstrap localhost

No problem at all. Based on this test and the error message above, I guess that there must be some network/firewall settings on that server that are not set properly.

The https://10.90.106.1:8443/ service is supposed to be the lxd daemon listening on the lxdbr0 interface. If your metal installation was implementing a firewall, it could be blocking that. Adding a rule to allow 10.90.106.0/24 (or whatever your lxdbr0 CIDR is) to access 10.90.106.1 tcp port 8443 would possibly help. Or the lxd daemon may have frozen, and you can check the logs of that daemon, or recycle it. Note that this will restart all of your lxd containers that are running.