canonical / lxd

Powerful system container and virtual machine manager
https://canonical.com/lxd
GNU Affero General Public License v3.0
4.28k stars 916 forks source link

lxd init produces config which fails validation #13468

Open mmokrejs opened 2 months ago

mmokrejs commented 2 months ago

Required information

Issue description

# /usr/sbin/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]: no
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]: no
Would you like to configure LXD to use an existing bridge or host interface? (yes/no) [default=no]: yes
Name of the existing bridge or host interface: lxdbr0
Would you like the LXD server to be available over the network? (yes/no) [default=no]: yes
Address to bind LXD to (not including port) [default=all]: 
Port to bind LXD to [default=8443]: 
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]: yes
config:
  core.https_address: '[::]:8443'
networks: []
storage_pools: []
storage_volumes: []
profiles:
- config: {}
  description: ""
  devices:
    eth0:
      name: eth0
      nictype: bridged
      parent: lxdbr0
      type: nic
  name: default
projects: []
cluster: null

Error: Failed to update profile "default": Device validation failed for "eth0": Cannot use "nictype" property in conjunction with "network" property
#
  1. The message is confusing.
  2. I assumed the configfile will include my existing storage pools and volumes.
# ifconfig  |  grep UP,BROADCAST,RUNNING,MULTICAST
enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
lxdbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
veth99be41cf: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
vethbe338fac: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
vethc000f9ef: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
vethce33f53e: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
#

I think iproute or systemd or network-manager renamed eth0 to enp4s0. Is that the source of the problem?

https://discuss.linuxcontainers.org/t/replacing-network-bridge/16344

MggMuggins commented 2 months ago

To make sure we're on the same page, are you configuring a freshly installed lxd or reconfiguring an existing one? If you already have an existing config, could you provide the config of the existing default profile (lxc profile show default)? Also, are you able to provide the network config as shown by ip addr?

Thanks!

tomponline commented 1 month ago

Yeah this is a bug as lxd init shouldnt be using nictype to reference a managed network and should instead by using network.