Can't bootstrap controller for localhost

Hello. I have a problem bootstrapping a controller:

$ juju bootstrap localhost MyLocalController --debug
18:06:53 INFO  juju.cmd supercommand.go:56 running juju [2.9.12 0 86d7f5193303a307171fba4cea7745b326023282 gc go1.14.15]
18:06:53 DEBUG juju.cmd supercommand.go:57   args: []string{"/snap/juju/17062/bin/juju", "bootstrap", "localhost", "MyLocalController", "--debug"}
18:06:53 DEBUG juju.container.lxd connection.go:167 using LXD snap socket: "/var/snap/lxd/common/lxd"
18:06:53 INFO  cmd provider.go:349 Resolved LXD host address on bridge lxcbr0: https://10.0.3.1:8443
18:06:53 INFO  cmd cloudcredential.go:47 updating credential store
18:06:53 DEBUG juju.cmd.juju.commands bootstrap.go:1305 authenticating with region "" and credential "localhost" ()
18:06:53 DEBUG juju.cmd.juju.commands bootstrap.go:1453 provider attrs: map[project:default]
<skipped ssh keys>
 automatically-retry-hooks:true backup-dir: charmhub-url:https://api.charmhub.io cloudinit-userdata: container-image-metadata-url: container-image-stream:released container-inherit-properties: container-networking-method: default-series:focal default-space: development:false disable-network-management:false egress-subnets: enable-os-refresh-update:true enable-os-upgrade:true fan-config: firewall-mode:instance ftp-proxy: http-proxy: https-proxy: ignore-machine-addresses:false image-metadata-url: image-stream:released juju-ftp-proxy: juju-http-proxy: juju-https-proxy: juju-no-proxy:127.0.0.1,localhost,::1 logforward-enabled:false logging-config: lxd-snap-channel:latest/stable max-action-results-age:336h max-action-results-size:5G max-status-history-age:336h max-status-history-size:5G name:controller net-bond-reconfigure-delay:17 no-proxy:127.0.0.1,localhost,::1 project:default provisioner-harvest-mode:destroyed proxy-ssh:false resource-tags: snap-http-proxy: snap-https-proxy: snap-store-assertions: snap-store-proxy: snap-store-proxy-url: ssl-hostname-verification:true test-mode:false transmit-vendor-metrics:true type:lxd update-status-hook-interval:5m uuid:5cde2030-5ae5-45fe-827c-a26727f1b77c]
18:06:54 INFO  cmd bootstrap.go:854 Creating Juju controller "mylocalcontroller" on localhost/localhost
18:06:54 INFO  juju.cmd.juju.commands bootstrap.go:920 combined bootstrap constraints: 
18:06:54 DEBUG juju.environs.bootstrap bootstrap.go:321 model "controller" supports application/machine networks: true
18:06:54 DEBUG juju.environs.bootstrap bootstrap.go:323 network management by juju enabled: true
18:06:54 INFO  cmd bootstrap.go:398 Loading image metadata
18:06:54 INFO  cmd bootstrap.go:471 Looking for packaged Juju agent version 2.9.12 for amd64
18:06:54 INFO  juju.environs.bootstrap tools.go:82 looking for bootstrap agent binaries: version=2.9.12
18:06:54 DEBUG juju.environs.tools tools.go:87 finding agent binaries in stream: "released"
18:06:54 DEBUG juju.environs.tools tools.go:89 reading agent binaries with major.minor version 2.9
18:06:54 DEBUG juju.environs.tools tools.go:98 filtering agent binaries by version: 2.9.12
18:06:54 DEBUG juju.environs.tools tools.go:101 filtering agent binaries by os type: ubuntu
18:06:54 DEBUG juju.environs.tools tools.go:104 filtering agent binaries by architecture: amd64
18:06:54 DEBUG juju.environs.tools urls.go:138 trying datasource "keystone catalog"
18:06:55 DEBUG juju.environs.simplestreams simplestreams.go:754 using default candidate for content id "com.ubuntu.juju:released:agents" are {20210329 mirrors:1.0 content-download streams/v1/cpc-mirrors-agents.sjson []}
18:06:55 INFO  juju.environs.bootstrap tools.go:84 found 1 packaged agent binaries
18:06:55 INFO  cmd bootstrap.go:484 Located Juju agent version 2.9.12-ubuntu-amd64 at https://streams.canonical.com/juju/tools/agent/2.9.12/juju-2.9.12-ubuntu-amd64.tgz
18:06:55 INFO  cmd bootstrap.go:567 Starting new instance for initial controller
18:06:55 INFO  cmd environ.go:200 To configure your system to better support LXD containers, please see: https://github.com/lxc/lxd/blob/master/doc/production-setup.md
18:06:55 INFO  cmd bootstrap.go:181 Launching controller instance(s) on localhost/localhost...
18:06:55 DEBUG juju.provider.lxd environ_broker.go:33 StartInstance: "0", focal
18:06:55 DEBUG juju.cloudconfig.instancecfg instancecfg.go:914 Setting numa ctl preference to false
18:06:55 DEBUG juju.environs imagemetadata.go:124 obtained image datasource "default ubuntu cloud images"
18:06:55 DEBUG juju.container.lxd connection.go:184 LXD requires https://, using: https://cloud-images.ubuntu.com/releases/
18:06:55 ERROR juju.cmd.juju.commands bootstrap.go:883 failed to bootstrap model: cannot start bootstrap instance in availability zone "sunsetshimmer": Not Found
18:06:55 DEBUG juju.cmd.juju.commands bootstrap.go:884 (error details: [{/build/snapcraft-juju-35d6cf/parts/juju/src/cmd/juju/commands/bootstrap.go:983: failed to bootstrap model} {/build/snapcraft-juju-35d6cf/parts/juju/src/environs/bootstrap/bootstrap.go:667: } {/build/snapcraft-juju-35d6cf/parts/juju/src/environs/bootstrap/bootstrap.go:571: } {/build/snapcraft-juju-35d6cf/parts/juju/src/provider/common/provider.go:25: } {/build/snapcraft-juju-35d6cf/parts/juju/src/provider/common/bootstrap.go:61: } {/build/snapcraft-juju-35d6cf/parts/juju/src/provider/common/bootstrap.go:292: cannot start bootstrap instance in availability zone "sunsetshimmer"} {/build/snapcraft-juju-35d6cf/parts/juju/src/provider/lxd/environ_broker.go:46: } {/build/snapcraft-juju-35d6cf/parts/juju/src/provider/lxd/environ_broker.go:121: } {/build/snapcraft-juju-35d6cf/parts/juju/src/container/lxd/image.go:53: } {Not Found}])
18:06:55 DEBUG juju.cmd.juju.commands bootstrap.go:1634 cleaning up after failed bootstrap
18:06:55 INFO  juju.provider.common destroy.go:21 destroying model "controller"
18:06:55 INFO  juju.provider.common destroy.go:32 destroying instances
18:06:55 INFO  juju.provider.common destroy.go:56 destroying storage
18:06:55 DEBUG juju.provider.lxd environ.go:257 removing instances: []
18:06:56 INFO  cmd supercommand.go:544 command finished

I don’t see any problem with hostname:

$ hostname
sunsetshimmer
$ head -1 /etc/hosts
127.0.0.1 localhost sunsetshimmer.hnetwork sunsetshimmer

I can launch containers with lxd. Currently I have no idea where to look.

FWIW, I created a Focal cloud instance (daily image) and then:

sudo snap install juju --classic
juju bootstrap localhost MyLocalController --debug

It worked.

Maybe compare my output to yours (sorry for the login). You have some suspicious lines in the beginning (lxcbr0 bridge, and <skipped ssh keys>).

Thank you. I removed lxc and reinstalled lxd and juju. Now I get this error:

ERROR Get "https://10.111.55.1:8443/1.0": x509: certificate is valid for 127.0.0.1, ::1, not 10.111.55.1
00:13:00 DEBUG cmd supercommand.go:537 error stack: 
Get "https://10.111.55.1:8443/1.0": x509: certificate is valid for 127.0.0.1, ::1, not 10.111.55.1
/build/snapcraft-juju-35d6cf/parts/juju/src/container/lxd/server.go:98: 
/build/snapcraft-juju-35d6cf/parts/juju/src/provider/lxd/server.go:216: 
/build/snapcraft-juju-35d6cf/parts/juju/src/provider/lxd/environ.go:161: 
/build/snapcraft-juju-35d6cf/parts/juju/src/provider/lxd/environ.go:84: 
/build/snapcraft-juju-35d6cf/parts/juju/src/provider/lxd/provider.go:149: 
/build/snapcraft-juju-35d6cf/parts/juju/src/environs/bootstrap/prepare.go:131: 
/build/snapcraft-juju-35d6cf/parts/juju/src/cmd/juju/commands/bootstrap.go:789:

Well. I typed juju bootstrap without parameters and it worked!
My controller is up and running.