Container Config, Can i create conditional hardware passing?

madsci1016

New Member
Mar 26, 2024
1
0
1
I have a slim PC setup with half a dozen VMs. One is a CT of OpenWRT, that handles all the routing on the VM's LAN and the wifi card on the physical slim PC, which connects to the venue's wifi as a client and acts as an AP for some smart devices.

Sometimes the internal wifi is enough, sometimes i want to connect a better USB wifi adapter (this case a A8000) for more speed. All of that works, except for the "switching" between the two configurations.

Ideally i want to plug and play, and reboot. Have the plug in wifi card show up in the CT automatically or not. But as of right now, when the card is removed and prox rebooted, the CT will fail to start since it stops at the line in the config that passes the (now absent) wifi card.

Is there a way to setup the CT config to "skip" passing the hardware that is now absent? Or some way to make it continue to boot the CT even with that error?

My config:

Code:
arch: amd64
hostname: OpenWRT
memory: 512
net0: name=eth0,bridge=vmbr0,hwaddr=xxxxxx,ip=dhcp,type=veth
net1: name=eth1,bridge=vmbr1,hwaddr=xxxxxx,type=veth
onboot: 0
ostype: unmanaged
rootfs: local-lvm:vm-105-disk-0,size=4G
swap: 512
unprivileged: 1
lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net dev/net none bind,create=dir
lxc.net.2.type: phys
lxc.net.2.link: wlo1
lxc.net.2.flags: up
lxc.net.2.name: wlan0
#lxc.net.3.type: phys
#lxc.net.3.link: wlx941865555397
#lxc.net.3.flags: up
#lxc.net.3.name: wlan1

Notice the USB wifi currently commented out. Thats what i want to be added back to the config automatically when the USB wifi device is present at boot.

The error i get when the config isn't commented out but the wifi card removed:

Code:
netdev_configure_server_phys: 1176 No such device - Failed to retrieve ifindex for "wlx941865555397"
lxc_create_network_priv: 3427 No such device - Failed to create network device
lxc_spawn: 1840 Failed to create the network
__lxc_start: 2107 Failed to spawn container "105"
TASK ERROR: startup for container '105' failed
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!