Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Unsupported DeviceType #4

Closed
ash-vd opened this issue Jan 17, 2023 · 8 comments · Fixed by #5
Closed

Unsupported DeviceType #4

ash-vd opened this issue Jan 17, 2023 · 8 comments · Fixed by #5

Comments

@ash-vd
Copy link

ash-vd commented Jan 17, 2023

This looks like a neat solution, but unfortunately I'm not able to start the container. When I try to do so I get the following message:

Traceback (most recent call last):
  File "run.py", line 30, in <module>
    device = get_device()
  File "/app/common/wifi.py", line 248, in get_device
    [(x.DeviceType, x) for x in Pnm.NetworkManager.GetDevices()]
  File "<string>", line 8, in GetDevices
  File "/root/.local/lib/python3.8/site-packages/NetworkManager.py", line 550, in to_python
    val = fixups.base_to_python(val)
  File "/root/.local/lib/python3.8/site-packages/NetworkManager.py", line 607, in base_to_python
    return [fixups.base_to_python(x) for x in val]
  File "/root/.local/lib/python3.8/site-packages/NetworkManager.py", line 607, in <listcomp>
    return [fixups.base_to_python(x) for x in val]
  File "/root/.local/lib/python3.8/site-packages/NetworkManager.py", line 620, in base_to_python
    return globals()[classname](val)
  File "/root/.local/lib/python3.8/site-packages/NetworkManager.py", line 348, in __new__
    klass = device_class(obj.Get('org.freedesktop.NetworkManager.Device', 'DeviceType', dbus_interface='org.freedesktop.DBus.Properties'))
  File "/root/.local/lib/python3.8/site-packages/NetworkManager.py", line 368, in device_class
    return {
KeyError: dbus.UInt32(30, variant_level=1)

I'm not very familiar with both NetworkManager and Python. Is this something that needs to be fixed in python-networkmanager? I've experienced a similar issue with wifi-connect for which I did find this issue. I've scanned my network using the nmcli on the host, and there are no WPA3 networks in the list.

Thanks for your effort and please let me know if there is anything I can check or try!

@maggie44
Copy link
Contributor

maggie44 commented Jan 18, 2023

What is your setup? Are you using balenaOS? Which device type?

Can you also run nmcli device and send the output?

@ash-vd
Copy link
Author

ash-vd commented Jan 18, 2023

Yes, using Balena. I've tried with both 2.106.2 and 2.108.18+rev2 on a Raspberry Pi 4.

Here is the output of nmcli device with just an ethernet connection.

DEVICE           TYPE      STATE                   CONNECTION
eth0             ethernet  connected               Wired connection 1
supervisor0      bridge    connected (externally)  supervisor0
wlan0            wifi      disconnected            --
p2p-dev-wlan0    wifi-p2p  disconnected            --
balena0          bridge    unmanaged               --
br-1e80d1716af5  bridge    unmanaged               --
br-9c6e4fe0fd8b  bridge    unmanaged               --
resin-dns        bridge    unmanaged               --
veth2fe6a60      ethernet  unmanaged               --
veth5e5ec4c      ethernet  unmanaged               --
veth72dcb9c      ethernet  unmanaged               --
vetha72df49      ethernet  unmanaged               --
lo               loopback  unmanaged               --
resin-vpn        tun       unmanaged               --

My guess is that is has something to do with the wifi-p2p device. As can be seen here, this is the device that has id 30.

@maggie44
Copy link
Contributor

maggie44 commented Jan 18, 2023

Yep, looks like you are running in to this: seveas/python-networkmanager#68

You could bump Python network manager to 2.2, but then will run in to this issue: #1

Your best bet may be to try this fork: seveas/python-networkmanager#85

If you wanted to create a fork of it, would be happy to move this app over to it.

@maggie44
Copy link
Contributor

Is there also something specific about your setup that makes this interface appear? I am trying to understand how likely it is for someone to encounter this.

@ash-vd
Copy link
Author

ash-vd commented Jan 18, 2023

If I update to 2.2 I indeed get that issue, I'll try that fork later. There isn't much special about the setup, it's a regular Raspberry Pi 4. But as that's a popular board a lot of other users would probably also have this issue.

For me it would also be fine to somehow disable this WiFi-P2P device, but I haven't found a quick way to do so with Balena (without access to the sd-card). Changing the wpa_supplicant.conf isn't possible as this is a read-only filesystem. Making the device unmanaged didn't solve the issue.

@maggie44
Copy link
Contributor

There isn't much special about the setup

Perhaps there has been some kernel update, or network manager update.

You could try installing the forked version directly from GitHub by amending the requirements.txt: https://stackoverflow.com/a/47719177/16019434

To test, you could try pointing it at this guys fork: https://github.com/AndersBlomdell/python-networkmanager

@ash-vd
Copy link
Author

ash-vd commented Jan 18, 2023

This fork gave me this:

  File "/root/.local/lib/python3.8/site-packages/NetworkManager.py", line 620, in to_python
    val['ipv4']['dns'] = [fixups.addr_to_python(addr,socket.AF_INET) for addr in val['ipv4']['dns']]
KeyError: 'dns'

I've quickly forked the repo from AndersBlomdell and applied this fix. When I install the fork given your instructions (thanks!) everything works!

@maggie44
Copy link
Contributor

Nice investigation. Thanks for the fix. I am going to leave this issue open and apply it to the main repo too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants