I cannot init LXD for VisionFive (I got error)

Hello,
I got error when trying to init LXD for VisionFive with Official Ubuntu 22.04.1 LTS (RISC-V preinstalled images from canonical)

It was working when using Ubuntu 22.04 LTS community image built by Jershell

LXD version is 5.4 and kernel is 5.17.0-1006-starfive

ubuntu@ubuntu:~$ sudo lxd init
Would you like to use LXD clustering? (yes/no) [default=no]: 
Do you want to configure a new storage pool? (yes/no) [default=yes]: 
Name of the new storage pool [default=default]: 
Name of the storage backend to use (dir, lvm, ceph, btrfs) [default=btrfs]: 
Create a new BTRFS pool? (yes/no) [default=yes]: 
Would you like to use an existing empty block device (e.g. a disk or partition)? (yes/no) [default=no]: 
Size in GB of the new loop device (1GB minimum) [default=11GB]: 45
Would you like to connect to a MAAS server? (yes/no) [default=no]: 
Would you like to create a new local network bridge? (yes/no) [default=yes]: 
What should the new bridge be called? [default=lxdbr0]: 
What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
Would you like the LXD server to be available over the network? (yes/no) [default=no]: 
Would you like stale cached images to be updated automatically? (yes/no) [default=yes]: 
Would you like a YAML "lxd init" preseed to be printed? (yes/no) [default=no]: 
Error: Failed to create local member network "lxdbr0" in project "default": Failed generating auto config

I’ve modified the error to include more info:

Please can you show ip a and ip r on the server?

$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 6c:cf:39:00:01:9b brd ff:ff:ff:ff:ff:ff
    inet 192.168.88.4/24 metric 100 brd 192.168.88.255 scope global dynamic eth0
       valid_lft 497sec preferred_lft 497sec
    inet6 fe80::6ecf:39ff:fe00:19b/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state DORMANT group default qlen 1000
    link/ether 70:4a:0e:95:b2:96 brd ff:ff:ff:ff:ff:ff
5: r48: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1280 qdisc noqueue state UNKNOWN group default qlen 1000
    link/none 
    inet6 2a06:a003:e034::2/48 scope global 
       valid_lft forever preferred_lft forever
$ ip r
default via 192.168.88.1 dev eth0 proto dhcp src 192.168.88.4 metric 100 
192.168.88.0/24 dev eth0 proto kernel scope link src 192.168.88.4 metric 100 
192.168.88.1 dev eth0 proto dhcp scope link src 192.168.88.4 metric 100

@tomp LXD was working fine in same board and Ubuntu 22.04.1 (by Jershell) but when I moved to official Ubuntu I notice that LXD cannot create networks

Can you try specifying either a manual IP subnet or “none” to the answers to these:

What IPv4 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 
What IPv6 address should be used? (CIDR subnet notation, “auto” or “none”) [default=auto]: 

This will confirm that its just a problem with populateAutoConfig https://github.com/lxc/lxd/blob/master/lxd/network/driver_bridge.go#L146-L185

When I use none for IPv6 everything work fine!
but I want IPv6 :frowning:

Can you show ip -6 r please

I fixed the issue using:

lxc network set lxdbr0 ipv6.address=2a06:a003:e034:37ad::1/64 ipv6.nat=false ipv6.dhcp.stateful=true
$ ip -6 r
::1 dev lo proto kernel metric 256 pref medium
2a06:a003:e034:37ad::/64 dev lxdbr0 proto kernel metric 256 pref medium
2a06:a003:e034::/48 dev r48 proto kernel metric 256 pref medium
::/1 dev r48 metric 1024 pref medium
fe80::/64 dev eth0 proto kernel metric 256 pref medium
fe80::/64 dev lxdbr0 proto kernel metric 256 pref medium
8000::/1 dev r48 metric 1024 pref medium
1 Like

I think this route might be the issue, because every random private subnet LXD generates in the fd42: prefix it tests to see if its already included in the host’s routing table. This very large route means that every /64 subnet it generates will be detected as in use and after a few goes LXD will give up and give you the error you see.