Conversation from Gitter (just a copy/paste/trim)
Alasdair Davies @Al2kA_twitter 09:47
Hi everyone. Has anyone managed to use NetworkManager on a Pi Zero W to bring up an access point? I have ethernet via USB as the primary connection and think I should be able to work in the container to start it using a Python script, but do I still need to set the config file on the SD card? - https://github.com/NetworkManager/NetworkManager/blob/master/examples/python/dbus/wifi-hotspot.py
Joseph Roberts @josephroberts 09:56
@Al2kA_twitter Raspberry-Pi Wifi Access-point
Alasdair Davies @Al2kA_twitter 09:57
@josephroberts Thanks so much. Will give that a try now.
Joseph Roberts @josephroberts 10:03
we also have a rust module if you would prefer that over python https://github.com/resin-io-modules/network_manager
Jon Nettleton @linux4kix 10:04
or via the commandline. https://gist.github.com/narate/d3f001c97e1c981a59f94cd76f041140
Joseph Roberts @josephroberts 10:07
@linux4kix that will work from the host but not from the user container
the only way to interact with network manager from the user container is via DBUS
Jon Nettleton @linux4kix 10:08
why not? as long as you export the system dbus socket
Joseph Roberts @josephroberts 10:09
can you provide a working example? This would be awesome if it does work
I think I tried before and struggled to get get nmcli in the container without network manager also being installed
and weird stuff happened when I had network manager in both the host and user container
Alasdair Davies @Al2kA_twitter 10:10
@josephroberts it certainly would. Happy to reproduce here to confirm
Joseph Roberts @josephroberts 10:10
Jon Nettleton @linux4kix 10:12
I am not in front of a resinos machine right now. Is /var/run/dbus being mapped into the container by default?
ah there it is.
export that and nmcli should work for you
Joseph Roberts @josephroberts 10:14
How would you install nmcli without also installing network manager?
Jon Nettleton @linux4kix 10:21
so I would do the same thing for nmcli and any other libraries needed
Joseph Roberts @josephroberts 10:21
build from source you mean?
Jon Nettleton @linux4kix 10:22
basically install networkmanager from alpine linux, and then move the binaries and libraries over to be packaged.
you could build from source, but I think that would be excess work.
the other option is just add the hotspot networkmanager config but don’t have it autostart. Then use dbus to bring the connection up and down.
Joseph Roberts @josephroberts 10:26
yeah its a nice idea, will add it to my list of potential hack Friday projects. cheers
Frans van Hoogstraten @FransvanHoogstraten 11:16
@linux4kix Thanks for the info, will immediately give it a test!
Jon Nettleton @linux4kix 11:29
great. let me know if you run into any snags
Alasdair Davies @Al2kA_twitter 11:36
@FransvanHoogstraten would love to know how you get on. In the meantime I am seeing how I get on with the DBUS API way.
Alasdair Davies @Al2kA_twitter 14:58
@linux4kix @josephroberts what’s you thought on this? (exporing DBUS_SYSTEM) https://github.com/resin-io-playground/access-point-example/blob/master/start.sh
Jon Nettleton @linux4kix 15:01
@Al2kA_twitter thanks for the link but that script looks extremely hackish, and you can have wireless enabled but not in AP mode, so will only work in very specific circumstances.
Joseph Roberts @josephroberts 15:01
@Al2kA_twitter that was how I did it before I realised Network Manager supports AP mode
really not recommended anymore
Alasdair Davies @Al2kA_twitter 15:22
@linux4kix @josephroberts thanks both
Alasdair Davies @Al2kA_twitter 17:42
@josephroberts could you take a quick glance at my setup? I’ve added the local config to the SD, pip installed python-networkmanager and am using the example activate_connection in NetworkManager but no luck. Anything I’ve missed? -https://github.com/arribada/access-point-dev
Joseph Roberts @josephroberts 18:01
@Al2kA_twitter do you get any output from the activate_connection script? where do you put the config file on the SD?
I would advice getting a dev image as then you can ssh into the host and use nmcli to debug
for example; nmcli c should show the resin-hotspot connection, nmcli d should show the interfaces and their names
then you can use nmcli c up id resin-hotspot to start the hotspot - if that works then your config is fine and the issue is somewhere else
if it doesn’t work you know where to concentrate your debugging
Alasdair Davies @Al2kA_twitter 18:05
@josephroberts will do. I get wlan1: ERROR while getting interface flags: No such device if I run ifconfig wlan1 up/down and the output from the activate_connection running python ./activate_connection.py resin-hotspot is KeyError: ‘resin-hotspot’
Joseph Roberts @josephroberts 18:06
that error tells me two things. first, your interface is not called wlan1
Joseph Roberts @josephroberts 18:07
secondly, the config file you have created has an error - thats where the keyerror thing comes from
Alasdair Davies @Al2kA_twitter 18:07
OK, will double check and more to a forum post