I am encountering an issue attaching a usb wireless nic to a lxd container.
I’m tired of it, Who can help me! Thanks!
My laptop:
ManjaroLinux 19.0.2
LXD 4.0 installed via snap
User account yuanfh in sudo and lxd group
$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 04ca:0061 Lite-On Technology Corp. USB Optical Mouse
Bus 001 Device 003: ID 8087:0a2a Intel Corp.
Bus 001 Device 002: ID 5986:069e Acer, Inc HD Webcam
Bus 001 Device 005: ID 0bda:8812 Realtek Semiconductor Corp. RTL8812AU 802.11a/b/g/n/ac 2T2R DB WLAN Adapter
Error: Failed to run: /snap/lxd/current/bin/lxd forkstart k1 /var/snap/lxd/common/lxd/containers /var/snap/lxd/common/lxd/logs/k1/lxc.conf:
Try lxc info --show-log k1 for more info
I think the bit that is missing, is to get the device not to be used by the host.
Give it a try according to the guide and please report back (even if it works out of the box).
I was following your document, but I don’t know why it failed. I had the same error on the ubuntu 20.04 host.
Is there something wrong with my wireless card? or driver?But I can use it in both the host and the virtualbox VMs.
$ cat /etc/NetworkManager/NetworkManager.conf
# Configuration file for NetworkManager.
# See “man 5 NetworkManager.conf” for details.
[keyfile]
unmanaged-devices=mac:00:13:ef:f1:04:05;interface-name:wlp0s20f0u2
$ rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
2: phy1: Wireless LAN
Soft blocked: no
Hard blocked: no
But type is still not unmanaged !!
$ iw dev
phy#1
Interface wlp0s20f0u2
ifindex 11
wdev 0x100000001
addr 00:13:ef:f1:04:05 type managed
txpower 12.00 dBm
But I still failed. I think this problem may have something to do with NIC and drivers. Are there any important steps missing from your documentation? I have been operating according to your document in many different environments and the result is the same error report!
My next job must realize this function, can you help me solve this problem? Or do I need to provide more configuration and log information?
You get a better error message when you stop the container, add the nic (it gets added successfully since there is no check), and when you start the container you get:
lxc mykali 20200410173713.876 ERROR network - network.c:lxc_network_move_created_netdev_priv:3126 - Operation not permitted - Failed to move network device "wlx0xxxxxxxxxx" with ifindex 12 to network namespace 104055
There’s a bug report for this, apparently it has been a regression that was supposed to be fixed.
Here is the fix, support for nl80211 adapters,
This post says that they got a workaround to specify the physical interface (in that case, phy2) simply by installing the iw utility. They use Debian, most likely not the snap.
@yuanfh, are you able to test with LXD 3.0? The bug report at https://github.com/lxc/lxc/issues/3105 mentions that this has been working on LXD prior to version 3.15. The last available version to get now, is LXD 3.0.x, either as a DEB package from Ubuntu 18.04, or a snap package from the channel 3.0/stable (see snap info lxd)… Unfortunately, I cannot downgrade LXD to test.