wifi-connect icon indicating copy to clipboard operation
wifi-connect copied to clipboard

D-Bus failure: Variant type does not match during "Error: Deleting access point connection profile failed"

Open theronic opened this issue 6 years ago • 17 comments

When I run sudo wifi-connect on a Raspberry Pi Zero, I get this error:

Error: Deleting access point connection profile failed
caused by: D-Bus failure: Variant type does not match: Variant(Iter(UInt32))

I was previously using comitup, which is a nightmare, so I ran sudo apt-get remove comitup, then installed wifi-connect. Is it because I had network-manager installed before and some services weren't configured?

theronic avatar Dec 02 '18 12:12 theronic

@theronic can you please let me know what is the version of network-manager installed (nmcli --version) and what OS is used and the version it as well? I suspect it could be incompatibility with the NetworkManager version.

You may delete manually any existing access point connection profile by running nmcli c delete NAME. You may find the connection profiles in /etc/NetworkManager/system-connections/ to check for the name. After you manually delete it, you may try running wifi-connect again.

majorz avatar Dec 03 '18 08:12 majorz

OS: Raspbian Stretch 9.4 (Lite version).

nmcli tool, version 1.6.2

Despite manually deleting any connections of type "ap", the only way I could get wifi-connect to run, was to skip delete_access_point_profiles.

I also tried to explicitly update to latest v0.5.2 of the dbus crate, but no dice.

Can you advise which version of network-manager or dbus I can downgrade to?

theronic avatar Dec 03 '18 10:12 theronic

I tried a stripped down project with dependencies network-manager = "0.11" and dbus="0.5.4", and it throws the same error when calling this:

let manager = NetworkManager::new();
let connections = manager.get_connections().unwrap();

theronic avatar Dec 03 '18 12:12 theronic

Also tried cloning latest network-manager 0.11.2 and including as path dependency - same problem.

theronic avatar Dec 03 '18 12:12 theronic

Updated network-manager running on the RPi to v1.14.4 - same error.

theronic avatar Dec 13 '18 13:12 theronic

@theronic I tried reproducing this today, but my Pi Zero device stopped working (some HW problem) and I need to order a new one. I verified everything is working well on newer Pi models with both the first released Raspbian Stretch version and the newest one. Did you tried running it on latest Raspbian as well?

majorz avatar Dec 18 '18 17:12 majorz

@majorz I get the same error on a Raspberry Pi 3B+ running Raspbian Lite, even after updating to latest distro via apt-get update && ...upgrade && ... dist-upgrade.

Are you running Raspbian Lite or Raspbian with Desktop?

When I run the install script, and try to install, this is what I see:

pi@raspberrypi:~ $ bash <(curl -L https://github.com/balena-io/wifi-connect/raw/master/scripts/raspbian-install.sh)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   157  100   157    0     0    105      0  0:00:01  0:00:01 --:--:--   105
100  4611  100  4611    0     0   1743      0  0:00:02  0:00:02 --:--:-- 12102
WiFi Connect Raspbian Installer: Retrieving latest release from https://api.github.com/repos/balena-io/wifi-connect/releases/latest...
WiFi Connect Raspbian Installer: Downloading and extracting https://github.com/balena-io/wifi-connect/releases/download/v4.2.2/wifi-connect-v4.2.2-linux-rpi.tar.gz...
WiFi Connect Raspbian Installer: Successfully installed wifi-connect 4.2.2
WiFi Connect Raspbian Installer: NetworkManager is already installed
WiFi Connect Raspbian Installer: NetworkManager is already active
WiFi Connect Raspbian Installer: Run 'wifi-connect --help' for available options
pi@raspberrypi:~ $ wifi-connect --help
wifi-connect 4.2.2
Zahari Petkov <[email protected]>
...

pi@raspberrypi:~ $ sudo wifi-connect
Error: Deleting access point connection profile failed
  caused by: D-Bus failure: Variant type does not match: Variant(Iter(UInt32))

theronic avatar Dec 19 '18 13:12 theronic

@theronic I run it now on a Raspberry Pi 1 as well (same processor as the Zero) and all is going well there as well. Run it before on both the 3B and 3B+.

Here are the exact steps I am doing:

  1. I download a Raspbian Lite Stretch image (both the oldest available and the newest)
  2. Flash an SD card with latest Etcher
  3. mount the boot partition and put an ssh empty file there
  4. Plug a WiFi dongle on the Pi 1 (or use the built in on the Pi 3)
  5. Plug an Ethernet cable
  6. Boot the device and ssh to it
  7. bash <(curl -L https://github.com/balena-io/wifi-connect/raw/master/scripts/raspbian-install.sh)
  8. Run sudo wifi-connect
  9. From a second ssh session I do: cd /etc/NetworkManager/system-connections && sudo cp WiFi\ Connect AP (this is to duplicate the access point profile and I close the new ssh session)
  10. Exit wifi-connect started in 8. with Ctrl+C
  11. Restart NetworkManager with sudo systemctl restart NetworkManager (so that it picks up the copied AP connection profile)
  12. Start wifi-connect again - the copied connection profile no longer exists and wifi-connect runs properly

I do not update the OS, I will try with updating now.

majorz avatar Dec 19 '18 13:12 majorz

I realize that I was trying with a Comitup image, which comes pre-installed with NetworkManager. Maybe this was conflicting with wifi-connect?

Trying to replicate your steps now using base Raspbian Stretch Lite.

theronic avatar Dec 20 '18 10:12 theronic

I checked now with dist-upgraded Raspbian Stretch Lite and things are working fine.

The error you receive with the D-Bus types mismatch could be possibly caused by some packaging issues indeed.

majorz avatar Dec 20 '18 10:12 majorz

When I install wifi-connect on a freshly-flashed RPi 3B (with an wpa_supplicant.conf file so I can connect to it at all over Wifi), dhcpcd is deactivated, the Pi drops off WiFi and I can't get it back on my network. It also does not broadcast any hotspot :/:

pi@raspberrypi:~ $ bash <(curl -L https://github.com/balena-io/wifi-connect/raw/master/scripts/raspbian-install.sh)
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   157  100   157    0     0     77      0  0:00:02  0:00:02 --:--:--    77
100  4611  100  4611    0     0   1318      0  0:00:03  0:00:03 --:--:--  6902
WiFi Connect Raspbian Installer: Retrieving latest release from https://api.github.com/repos/balena-io/wifi-connect/releases/latest...
WiFi Connect Raspbian Installer: Downloading and extracting https://github.com/balena-io/wifi-connect/releases/download/v4.2.2/wifi-connect-v4.2.2-linux-rpi.tar.gz...
WiFi Connect Raspbian Installer: Successfully installed wifi-connect 4.2.2
WiFi Connect Raspbian Installer: NetworkManager is not installed
WiFi Connect Raspbian Installer: Continue to install NetworkManager and disable dhcpcd? [y/N] y
WiFi Connect Raspbian Installer: Downloading NetworkManager...
Get:1 http://archive.raspberrypi.org/debian stretch InRelease [25.3 kB]
....
Fetched 5524 kB in 23s (235 kB/s)
Download complete and in download only mode
WiFi Connect Raspbian Installer: Deactivating and disabling dhcpcd...
packet_write_wait: Connection to 192.168.1.58 port 22: Broken pipe

theronic avatar Dec 20 '18 14:12 theronic

@theronic this is the expected behavior, since the install script does not transfer WiFi connection settings from dhcpcd to NetworkManager.

You may solve this by creating a new shell script like this (install-wifi-connect.sh):

#!/bin/bash

bash <(curl -L https://github.com/balena-io/wifi-connect/raw/master/scripts/raspbian-install.sh) -- -y

wifi-connect

And then execute it with: nohup ./install-wifi-connect.sh &.

The bash ... -- -y will tell the installer to not ask for confirmation. nohup is needed so that when your ssh session is disconnected the script continues to run. At the end once wifi-connect is started you may reenter your WiFi credentials.

Alternatively you may install it through Ethernet connection, which I would recommend.

majorz avatar Dec 26 '18 11:12 majorz

I am getting this same issue now. I installed wireguard for a client connection to my zerotier server and zerotier to have remote access.

I am using a Raspberry Pi 3B with Buster.

I did not check Wifi Connect after installing and configuring those other packages. I have rerun the install script and I get the same error.

Edit: I just checked an earlier image before the zerotier install and it works fine. Must be something with zerotier.

Judman avatar Oct 15 '22 23:10 Judman

Further update. When ZeroTier is connected to a network I get the D-Bus error and wifi-connect fails.

If I leave the ZeroTier network, wifi-connect functions as expected.

Judman avatar Oct 16 '22 22:10 Judman

I seem to be having the same problem as @Judman, ZeroTier is installed, and: Error: Deleting access point connection profile failed

ampledata avatar Jul 19 '23 03:07 ampledata

I can confirm that running systemctl stop zerotier-one before running wifi-connect is a work-around.

ampledata avatar Jul 19 '23 04:07 ampledata

With the help of someone who speaks Rust, I was able to drill down from wifi-connect -> balena-networkmanager -> dbus 0.5.

Balena's network-manager calls ListConnections:

https://github.com/balena-io-modules/network-manager/blob/4da2e6a57de16b6ae911f74321f929d78af8b1ba/src/dbus_nm.rs#L86

Here's what the call to ListConnections returns when a ZeroTier interface is configured. I suspect there's something in this struct that dbus 0.5 is failing to demarshal into a Rust struct:

method call time=1689797229.418906 sender=:1.117 -> destination=org.freedesktop.NetworkManager serial=2 path=/org/freedesktop/NetworkManager/Settings; interface=org.freedesktop.NetworkManager.Settings; member=ListConnections
method return time=1689797229.420383 sender=:1.21 -> destination=:1.117 serial=29104 reply_serial=2
   array [
      object path "/org/freedesktop/NetworkManager/Settings/1"
      object path "/org/freedesktop/NetworkManager/Settings/2"
      object path "/org/freedesktop/NetworkManager/Settings/6"
      object path "/org/freedesktop/NetworkManager/Settings/7"
   ]
method call time=1689797229.446097 sender=:1.117 -> destination=org.freedesktop.NetworkManager serial=6 path=/org/freedesktop/NetworkManager/Settings/7; interface=org.freedesktop.NetworkManager.Settings.Connection; member=GetSettings
method return time=1689797229.449502 sender=:1.21 -> destination=:1.117 serial=29110 reply_serial=6
   array [
      dict entry(
         string "connection"
         array [
            dict entry(
               string "autoconnect"
               variant                   boolean false
            )
            dict entry(
               string "id"
               variant                   string "ztmjfehtjp"
            )
            dict entry(
               string "interface-name"
               variant                   string "ztmjfehtjp"
            )
            dict entry(
               string "permissions"
               variant                   array [
                  ]
            )
            dict entry(
               string "timestamp"
               variant                   uint64 1689797019
            )
            dict entry(
               string "type"
               variant                   string "tun"
            )
            dict entry(
               string "uuid"
               variant                   string "77ef4f5a-e31c-42a5-92e5-559e3a5737c8"
            )
         ]
      )
      dict entry(
         string "tun"
         array [
            dict entry(
               string "mode"
               variant                   uint32 2
            )
         ]
      )
      dict entry(
         string "ipv4"
         array [
            dict entry(
               string "address-data"
               variant                   array [
                     array [
                        dict entry(
                           string "address"
                           variant                               string "192.168.191.191"
                        )
                        dict entry(
                           string "prefix"
                           variant                               uint32 24
                        )
                     ]
                  ]
            )
            dict entry(
               string "addresses"
               variant                   array [
                     array [
                        uint32 3217008832
                        uint32 24
                        uint32 0
                     ]
                  ]
            )
            dict entry(
               string "dns"
               variant                   array [
                  ]
            )
            dict entry(
               string "dns-priority"
               variant                   int32 100
            )
            dict entry(
               string "dns-search"
               variant                   array [
                  ]
            )
            dict entry(
               string "method"
               variant                   string "manual"
            )
            dict entry(
               string "route-data"
               variant                   array [
                  ]
            )
            dict entry(
               string "routes"
               variant                   array [
                  ]
            )
         ]
      )
      dict entry(
         string "ipv6"
         array [
            dict entry(
               string "address-data"
               variant                   array [
                  ]
            )
            dict entry(
               string "addresses"
               variant                   array [
                  ]
            )
            dict entry(
               string "dns"
               variant                   array [
                  ]
            )
            dict entry(
               string "dns-priority"
               variant                   int32 100
            )
            dict entry(
               string "dns-search"
               variant                   array [
                  ]
            )
            dict entry(
               string "method"
               variant                   string "link-local"
            )
            dict entry(
               string "route-data"
               variant                   array [
                  ]
            )
            dict entry(
               string "routes"
               variant                   array [
                  ]
            )
         ]
      )
      dict entry(
         string "proxy"
         array [
         ]
      )
   ]

ampledata avatar Jul 19 '23 20:07 ampledata