nikhiljha / pp-fedora-sdsetup

PinePhone Fedora Image Generation Script
GNU General Public License v3.0
105 stars 21 forks source link

policykit issue for Geoclue and ModemManager #118

Open Baggypants opened 2 years ago

Baggypants commented 2 years ago

Looking at the output of journalctl -flu geoclue restarting geoclue and then starting Gnome Maps shows this

Oct 25 15:47:51 fedora geoclue[27831]: Failed to set GPS refresh rate: GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Unauthorized: PolicyKit authorization failed: not authorized for 'org.freedesktop.ModemManager1.Device.Control'
Oct 25 15:47:51 fedora geoclue[27831]: Failed to enable GPS: GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Unauthorized: PolicyKit authorization failed: not authorized for 'org.freedesktop.ModemManager1.Device.Control'
Oct 25 15:47:51 fedora geoclue[27831]: Failed to enable 3GPP: GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Unauthorized: PolicyKit authorization failed: not authorized for 'org.freedesktop.ModemManager1.Device.Control'

Looks like geoclue can't access the modem location stuff because of a policykit issue.

Baggypants commented 2 years ago

The rule in here seemed to fix it

https://githubmemory.com/repo/dreemurrs-embedded/Pine64-Arch/issues/212

polkit.addRule(function(action, subject) {
  if(action.id.startsWith("org.freedesktop.ModemManager1") && subject.user == "geoclue") {
    polkit.log(action.id);
    return polkit.Result.YES;
  }
});

There seemed a concern about it being a good rule though.

Torbuntu commented 2 years ago

Is that not something that gets resolved after this: https://gitlab.freedesktop.org/geoclue/geoclue/-/commit/a9aea6a4948e2ff9ec5ff066cf20dac069c0d3a0 ?

Baggypants commented 2 years ago

No, that's to do with phosh acting as an agent for applications wanting to access geoclue. Not geoclue accessing location sources, such as the EG25.

Baggypants commented 2 years ago

Marius found a better rule

https://www.apt-browse.org/browse/ubuntu/xenial/universe/amd64/geoclue-2.0/2.4.1-1/file/usr/share/polkit-1/rules.d/geoclue-2.0.rules

polkit.addRule(function(action, subject) {
    if ((action.id == "org.freedesktop.ModemManager1.Device.Control" ||
         action.id == "org.freedesktop.ModemManager1.Location") &&
        subject.user == "geoclue") {
        return polkit.Result.YES;
    }
});
Cyborgscode commented 2 years ago

geoclue maintainer has been contacted to add it to geoclue2 package.

alvaropg commented 2 years ago

Contributed to that part: https://gitlab.freedesktop.org/geoclue/geoclue/-/merge_requests/102

So it's going to be included in next geoclue2 release.