RPi 3 access point (hostapd) disconnects after a few minutes

I have an external wifi antenna that broadcasts an AP.

I was using ResinOS 2.0 and my Pi was connected to the internet via Ethernet. In order to get the external antenna to broadcast, I had to disable NetworkManager as it was interfering (thanks Resin team for helping figure that one out). This worked well because the Pi was still online through Ethernet.

Requirements changed and now I the Pi must connect through wifi. I updated to ResinOS 2.3.0. My Pi was connecting to wifi and broadcasting an AP fine, but after a few minutes all clients get disconnected and I’m not able to reconnect to the network.

If I disable NetworkManager, then the wifi connection won’t work, so I’m stuck for ideas here.

Any help would be greatly appreciated, thanks :slight_smile:

I guess the question really is, can I connect to wifi from my container with NetworkManager disabled?

Hi @prash,

This was a thinker, but I believe I’ve got a solution here. Can you try setting the wifi interface acting as an AP as unmanaged in NetworkManager?

I’ve written a little python script that will set wlan1 as unmanaged which you can try:

import dbus


UNMANAGED_DEVICE = 'wlan1'  # update this variable to dictate the device we're un-managing
bus = dbus.SystemBus()

nm_proxy = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager')
nm = dbus.Interface(nm_proxy, dbus_interface='org.freedesktop.NetworkManager')

for device_obj_path in nm.GetDevices():
    device_proxy = bus.get_object('org.freedesktop.NetworkManager', device_obj_path)
    device = dbus.Interface(device_proxy, dbus_interface='org.freedesktop.DBus.Properties')
    if device.Get('org.freedesktop.NetworkManager.Device', 'Interface') == UNMANAGED_DEVICE:
        device.Set('org.freedesktop.NetworkManager.Device', 'Managed', False)

You should be able to run this inside your app container (after export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket).

1 Like

Mr Boyce! It’s been 10 mins and so far so good, all clients still connected. I will keep this going and test over the next couple of days

Thank you very much, your time is much appreciated :slight_smile:

Fantastic news! Not a problem, glad I could help.