为什么网络管理器将设备状态更改为不可用?

为什么网络管理器将设备状态更改为不可用?

使用安装了 NetworkManager 和 NetworkManager-nmcli 的 Yocto 发行版,我无法让我的 wifi wlan0 设备保持不可用状态。我收到的错误消息是:

device (wlan0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')

我的问题是我如何知道哪个程序正在管理设备?我卸载并删除了所有可以创建网络设备的 sysvinit 脚本,但仍然存在相同的问题。

我将范围缩小到这样一个事实:当 NetworkManager 启动时,它会创建 wlan0 设备,然后将其切换为不可用,如上所述。

这是我的 /etc/network/interfaces

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# The loopback interface
auto lo
iface lo inet loopback

这是我的 /etc/NetworkManager/NetworkManager.conf

[main]
plugins=keyfile,ifupdown
rc-manager=symlink
dns=dnsmasq

[ifupdown]
managed=true

/usr/lib/NetworkManager/conf.d/10-globally-management-devices.conf

[keyfile]
unmanaged-devices=*,except:type:wifi

从我(可能很差)的理解来看,所有这些看起来都很好。我不明白为什么 wlan0 仍然处于“不可用”状态?

任何帮助将不胜感激!谢谢

编辑 根据@thaller的建议,我启用了跟踪级别日志

Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6226] platform-linux: do-change-link[3]: success changing link: success
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6227] platform: (wlan0) link: setting hardware address to 02:42:58:70:A1:F9
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6231] platform-linux: do-request-link: 3
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6231] platform-linux: event-notification: RTM_NEWLINK, flags 0, seq 0: 3: wlan0 <DOWN;broadcast,multicast> mtu 1500 arp 1 wifi? not-init addrgenmode none addr 02:42:58:70:A1:F9 brd FF:FF:FF:FF:
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6232] platform: (wlan0) signal: link changed: 3: wlan0 <DOWN;broadcast,multicast> mtu 1500 arp 1 wifi? init addrgenmode none addr 02:42:58:70:A1:F9 brd FF:FF:FF:FF:FF:FF driver rtl8821au rx:78,
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6233] platform-linux: event-notification: RTM_NEWLINK, flags 0, seq 19: 3: wlan0 <DOWN;broadcast,multicast> mtu 1500 arp 1 wifi? not-init addrgenmode none addr 02:42:58:70:A1:F9 brd FF:FF:FF:FF
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6234] platform-linux: do-change-link[3]: success changing link: success
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6234] device[8ad453a3b5b754fb] (wlan0): hw-addr: hardware address now 02:42:58:70:A1:F9
Mar 10 13:12:33 nclab-kol-2021 daemon.info NetworkManager[1195]: <info>  [1646917953.6240] device (wlan0): set-hw-addr: set MAC address to 02:42:58:70:A1:F9 (scanning)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6242] device[8ad453a3b5b754fb] (wlan0): bringing up device 3
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6242] platform: (wlan0) link: setting up
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6243] platform-linux: link: change 3: flags: set 0x1/0x1 ([up] / [up])
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6244] platform-linux: do-request-link: 3
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6245] platform-linux: event-notification: RTM_NEWLINK, flags 0, seq 0: 3: wlan0 <UP,LOWER_UP;broadcast,multicast,up,lowerup> mtu 1500 arp 1 wifi? not-init addrgenmode none addr 02:42:58:70:A1:F
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6245] platform: (wlan0) signal: link changed: 3: wlan0 <UP,LOWER_UP;broadcast,multicast,up,lowerup> mtu 1500 arp 1 wifi? init addrgenmode none addr 02:42:58:70:A1:F9 brd FF:FF:FF:FF:FF:FF drive
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6247] platform-linux: event-notification: RTM_NEWLINK, flags 0, seq 21: 3: wlan0 <UP,LOWER_UP;broadcast,multicast,up,lowerup> mtu 1500 arp 1 wifi? not-init addrgenmode none addr 02:42:58:70:A1:
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6247] platform-linux: do-change-link[3]: success changing link: success
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6248] device[8ad453a3b5b754fb] (wlan0): ip4-config: update (commit=1, new-config=(nil))
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6248] device[8ad453a3b5b754fb] (wlan0): ip4-config: clear IP Config instance (/org/freedesktop/NetworkManager/IP4Config/1)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6253] dns-mgr: (device_ip_config_changed): queueing DNS updates (1)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6255] dns-mgr: (device_ip_config_changed): DNS configuration did not change
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6255] dns-mgr: (device_ip_config_changed): no DNS changes to commit (0)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6256] dbus-object[db112265116d3c2f]: unexport: "/org/freedesktop/NetworkManager/IP4Config/1"
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6258] device[8ad453a3b5b754fb] (wlan0): ip6-config: update (commit=1, new-config=(nil))
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6259] device[8ad453a3b5b754fb] (wlan0): ip6-config: clear IP Config instance (/org/freedesktop/NetworkManager/IP6Config/1)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6263] dns-mgr: (device_ip_config_changed): queueing DNS updates (1)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6265] dns-mgr: (device_ip_config_changed): DNS configuration did not change
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6265] dns-mgr: (device_ip_config_changed): no DNS changes to commit (0)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6266] dbus-object[5827083ac52f43c8]: unexport: "/org/freedesktop/NetworkManager/IP6Config/1"
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6285] supplicant: (wlan0): creating new supplicant interface
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6289] device[8ad453a3b5b754fb] (wlan0): add_pending_action (2): 'waiting-for-supplicant'
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6290] device[8ad453a3b5b754fb] (wlan0): device not yet available for transition to DISCONNECTED
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6313] device[8ad453a3b5b754fb] (wlan0): connectivity state changed from UNKNOWN to NONE
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6316] manager: connectivity checking indicates NONE
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6323] dispatcher: (2) dispatching action 'connectivity-change'
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6327] device[8ad453a3b5b754fb] (wlan0): connectivity state changed from UNKNOWN to NONE
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6335] device[8ad453a3b5b754fb] (wlan0): remove_pending_action (1): 'in-state-change'
Mar 10 13:12:33 nclab-kol-2021 daemon.info nm-dispatcher: req:2 'connectivity-change': new request (0 scripts)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug nm-dispatcher: req:2 'connectivity-change': environment: CONNECTIVITY_STATE=NONE
Mar 10 13:12:33 nclab-kol-2021 daemon.debug nm-dispatcher: req:2 'connectivity-change': environment: NM_DISPATCHER_ACTION=connectivity-change
Mar 10 13:12:33 nclab-kol-2021 daemon.info nm-dispatcher: req:2 'connectivity-change': completed: no scripts
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6347] create NMVpnManager singleton (6588803e3521b96d)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6347] manager: creating virtual devices...
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6348] setting up local loopback
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6349] platform: (lo) link: setting up
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6349] platform-linux: link: change 1: flags: set 0x1/0x1 ([up] / [up])
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6350] platform-linux: do-request-link: 1
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6352] platform-linux: event-notification: RTM_NEWLINK, flags 0, seq 23: 1: lo <UP,LOWER_UP;loopback,up,running,lowerup> mtu 65536 arp 772 loopback? not-init addrgenmode eui64 addr 00:00:00:00:0
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6353] ethtool[1]: ETHTOOL_GDRVINFO, lo: failed: Operation not supported
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6354] platform-linux: do-change-link[1]: success changing link: success
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6366] firewall: D-Bus name for firewalld has no owner (firewall stopped)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6370] dns-sd-resolved[93c36e7af7f93bfa]: D-Bus name for systemd-resolved has no owner
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6384] dispatcher: (1) succeeded but no scripts invoked
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6390] dispatcher: (2) succeeded but no scripts invoked
Mar 10 13:12:33 nclab-kol-2021 daemon.info NetworkManager[1195]: <info>  [1646917953.6397] ovsdb: Could not connect: No such file or directory
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6398] ovsdb: disconnecting from ovsdb, retry 0
Mar 10 13:12:33 nclab-kol-2021 daemon.info NetworkManager[1195]: <info>  [1646917953.6399] supplicant: wpa_supplicant stopped
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6402] device[53bb033d9641aa44] (lo): ip4-config: update (commit=0, new-config=0xaaaaf2bb8130)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6402] dbus-object[e01a38d512fcba77]: export: "/org/freedesktop/NetworkManager/IP4Config/2"
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6408] device[53bb033d9641aa44] (lo): ip4-config: set IP Config instance (/org/freedesktop/NetworkManager/IP4Config/2)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6418] dns-mgr: (device_ip_config_changed): queueing DNS updates (1)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6420] dns-mgr: (device_ip_config_changed): DNS configuration did not change
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6420] dns-mgr: (device_ip_config_changed): no DNS changes to commit (0)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6422] platform-linux: sysctl: reading '/proc/sys/net/ipv6/conf/lo/disable_ipv6': '0'
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6423] device[53bb033d9641aa44] (lo): ip6-config: update (commit=0, new-config=0xaaaaf2b9f370)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6424] dbus-object[d1948f7b92c13977]: export: "/org/freedesktop/NetworkManager/IP6Config/2"
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6429] device[53bb033d9641aa44] (lo): ip6-config: set IP Config instance (/org/freedesktop/NetworkManager/IP6Config/2)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6434] dns-mgr: (device_ip_config_changed): queueing DNS updates (1)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6436] dns-mgr: (device_ip_config_changed): DNS configuration did not change
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6436] dns-mgr: (device_ip_config_changed): no DNS changes to commit (0)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6437] device[c503cba53b9e71c5] (sit0): ip4-config: update (commit=0, new-config=0xaaaaf2bb84c0)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6438] dbus-object[db112265116d3c2f]: export: "/org/freedesktop/NetworkManager/IP4Config/3"
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6443] device[c503cba53b9e71c5] (sit0): ip4-config: set IP Config instance (/org/freedesktop/NetworkManager/IP4Config/3)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6448] dns-mgr: (device_ip_config_changed): queueing DNS updates (1)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6450] dns-mgr: (device_ip_config_changed): DNS configuration did not change
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6450] dns-mgr: (device_ip_config_changed): no DNS changes to commit (0)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6452] platform-linux: sysctl: reading '/proc/sys/net/ipv6/conf/sit0/disable_ipv6': '0'
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6453] device[c503cba53b9e71c5] (sit0): ip6-config: update (commit=0, new-config=0xaaaaf2b9f7b0)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6453] dbus-object[2c07d4e5110af889]: export: "/org/freedesktop/NetworkManager/IP6Config/3"
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6457] device[c503cba53b9e71c5] (sit0): ip6-config: set IP Config instance (/org/freedesktop/NetworkManager/IP6Config/3)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6463] dns-mgr: (device_ip_config_changed): queueing DNS updates (1)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6464] dns-mgr: (device_ip_config_changed): DNS configuration did not change
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6465] dns-mgr: (device_ip_config_changed): no DNS changes to commit (0)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6466] device[c1055a26277ac48d] (usb0): ip4-config: update (commit=0, new-config=0xaaaaf2bb85f0)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6467] dbus-object[9d6eaa32c97d075e]: export: "/org/freedesktop/NetworkManager/IP4Config/4"
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6472] device[c1055a26277ac48d] (usb0): ip4-config: set IP Config instance (/org/freedesktop/NetworkManager/IP4Config/4)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6483] dns-mgr: (device_ip_config_changed): queueing DNS updates (1)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6485] dns-mgr: (device_ip_config_changed): DNS configuration did not change
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6485] dns-mgr: (device_ip_config_changed): no DNS changes to commit (0)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6487] platform-linux: sysctl: reading '/proc/sys/net/ipv6/conf/usb0/disable_ipv6': '0'
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6488] device[c1055a26277ac48d] (usb0): ip6-config: update (commit=0, new-config=0xaaaaf2b9fae0)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <trace> [1646917953.6489] dbus-object[f2d73358dc9003e5]: export: "/org/freedesktop/NetworkManager/IP6Config/4"
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6495] device[c1055a26277ac48d] (usb0): ip6-config: set IP Config instance (/org/freedesktop/NetworkManager/IP6Config/4)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6501] dns-mgr: (device_ip_config_changed): queueing DNS updates (1)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6502] dns-mgr: (device_ip_config_changed): DNS configuration did not change
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6503] dns-mgr: (device_ip_config_changed): no DNS changes to commit (0)
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6506] manager: (lo): assume: don't assume because not managed
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6507] manager: (sit0): assume: don't assume because not managed
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6507] manager: (usb0): assume: don't assume because not managed
Mar 10 13:12:33 nclab-kol-2021 daemon.debug NetworkManager[1195]: <debug> [1646917953.6508] manager: startup complete is waiting for device 'wlan0' (waiting-for-supplicant)

我不知道该怎么办。看来网络管理员正在创建设备而不是......

答案1

很可能是因为 wpa_supplicant 有问题。

要调试 NetworkManager 中的问题,请检查日志。收集level=TRACE日志几乎总是一个好主意。读https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/contrib/fedora/rpm/NetworkManager.conf#L27有关日志记录的提示。

相关内容