Setting up wifi on raspberry pi network-manager.nmcli critical error

Hi
I’m trying to setup wifi on ubuntu core 18.04 on raspberry pi following the instructions in the github gist at : [https://gist.github.com/cyan198/6ecdb86267498a51587b4337e47e10f6](http://Connect to WiFi on Ubuntu Core using Snap)

Installed network-manager ok, but running
network-maanager.nmcli r wifi on
fails (using sudo or not) with
(process:1901): nmcli-CRITICAL **: Error: Could not create NMClient object: Could not connect: Permission denied.

Has anyone a suggestion on what I might try to move forward please?

Thanks

what is the particular reason you are using network-manager at all on core ? while great for mobile networks, there is not really a need to use it for wlan unless you need a dbus interface to control network config for some reason …

using a plain netplan yaml to connnect to a WPA2 network is really easy and does not require an additional constantly running service (network-manager) just to get a wlan up, edit the UbuntuCore default config file like below:

$ sudo cat /etc/netplan/00-snapd-config.yaml 
# This is the network config written by 'console_conf'
network:
  version: 2
  wifis:
    wlan0:
      access-points:
        MYESSID: {password: MYPASSWD}
      addresses: []
      dhcp4: true

just edit the netplan config like above, replace MYESSID/MYPASSWD with your data, reboot and you should be good.

if you want to manage that file from a configuration snap you get access to the file via the network-setup-control interface, just dont forget to reboot (using the shutdown interface from your config snap) after changing it.

@ogra thanks for your response.

As I said on IRC in the #snappy channel I did configure /etc/netplan/50-cloud-init.yaml manually and the wifi interface is up and running fine as you say.

The reason I was trying to use network-manager was pure ignorance and the fact that the first google hit for:

"ubuntu core" "raspberry pi" setup wifi

was a gist

Would there have been a better place to have looked?