Hi, I have a snap that connect to network-manager slot to create a Hotspot connection. When I try to edit this connection:ssid and password, It fails in Ubuntu Core but works on Ubuntu Server. I have connected all the necessary plugs, but I am not able to figure out why it doesnt work on UCore.
I create the connection similar to shown here: https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python/dbus/wifi-hotspot.py
I edit the connection:
def edit_wifi(self,ssid:str,psk:str,mode:str) -> bool:
"""
Edit either ap information
Parameters:
ssid (str): Name of wireless network
psk (str): Password of wireless network
mode(str): ap or hotspot
Returns:
bool: True if modification was possible
"""
proxy = self.bus.get_object(
"org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManager/Settings")
settings = dbus.Interface(proxy, "org.freedesktop.NetworkManager.Settings")
c_path = settings.GetConnectionByUuid(self.ap_uuid)
c_proxy = self.bus.get_object("org.freedesktop.NetworkManager", c_path)
c_obj = dbus.Interface(c_proxy, "org.freedesktop.NetworkManager.Settings.Connection")
c_settings = c_obj.GetSettings()
c_settings["802-11-wireless"]["ssid"] = dbus.ByteArray(ssid.encode("utf-8"))
c_settings["802-11-wireless-security"]["psk"] = psk
c_obj.Update(c_settings)
return True
The erorr I get is :
org.freedesktop.NetworkManager.Settings.InvalidConnection: failed to update connection: keyfile writer produces an invalid connection: cannot access file: No such file or directory
The snappy-debug error is:
kernel.printk_ratelimit = 0 = Seccomp = Time: Feb 02 09:06:33 Log: auid=1000 uid=1000 gid=1000 ses=3 pid=3931 comm=“nmcli” exe=“/snap/network-manager/679/usr/bin/nmcli” sig=0 arch=c00000b7 274(sched_setattr) compat=0 ip=0xffffb7b71ad4 code=0x50000 Syscall: sched_setattr Suggestion:
- add ‘process-control’ to ‘plugs’
= AppArmor = Time: Feb 02 09:06:39 Log: apparmor=“DENIED” operation=“open” profile=“snap.pytest-snap.edit-con” name=“/home/ttank/” pid=3984 comm=“python3” requested_mask=“r” denied_mask=“r” fsuid=0 ouid=1000 File: /home/ttank/ (read) Suggestions:
- adjust program to read necessary files from $SNAP, $SNAP_DATA, $SNAP_COMMON, $SNAP_USER_DATA or $SNAP_USER_COMMON
- add ‘home’ to ‘plugs’
= AppArmor = Time: Feb 02 09:06:39 Log: apparmor=“DENIED” operation=“ptrace” profile=“snap.network-manager.networkmanager” pid=2128 comm=“NetworkManager” requested_mask=“read” denied_mask=“read” peer=“snap.pytest-snap.edit-con” Ptrace: peer=snap.pytest-snap.edit-con (read) Suggestions:
- add ‘system-observe’ to ‘plugs’
- do nothing if program otherwise works properly
I have been stuck with this issue for a week now, any help would be helpful, Thanks