Failed to move network device "wlan0" to network namespace 2153: Operation not permitted

(Chengdu Ding) #1

Excuse me, I’m trying to move wlan0 interface from host to lxc, but I always get the problem “Failed to move network device wlan0 to network namespace 2153: Operation not permitted”. I used a external wifi dongle, and my configuration of lxc likes belows. = phys = up = wlan0 = wlan0

Can someone give me some advice? Thank you.

(Stéphane Graber) #2

The wlan0 device is a child device of the physical wireless card, some drivers let you have multiple wlan devices on a single phy device but they all need to be moved as one unit between namespaces.

You may want to try setting the interface to phy0 (link and name) which may fix this. It could also depend on the wireless driver.

(Chengdu Ding) #3

@stgraber, like belows? = phys = up = phy0 = phy0

(Stéphane Graber) #4

I think so, yes

(Chengdu Ding) #5

It doesn’ work, because the phy0 doesn’t exist. When I startup the lxc, the problem is “lxc_network - network.c:instantiate_phys:347 - Failed to retrieve ifindex for phy0”.
I have used “ifconfig -a” to check the existence of phy0, but I only find the wlan0.


I encountered a similar problem while running lxc-2.1.1 and lxc-3.1.0 on Debian Stretch:

lxc-start: test: network.c: lxc_network_move_created_netdev_priv: 2438 Failed to move network device "wlan0" to network namespace 1033: Operation not permitted

I’ve tried different kernel and driver versions. Strangely this did not occure on Ubuntu 18.04 or 19.04 so I started compairing installed packages and noticed that iw was not installed in Debian Stretch.

Installing iw fixed the problem for me.