Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling Geoclue2 should enable services.avahi #329522

Open
SrTobi opened this issue Jul 23, 2024 · 6 comments
Open

Enabling Geoclue2 should enable services.avahi #329522

SrTobi opened this issue Jul 23, 2024 · 6 comments

Comments

@SrTobi
Copy link
Contributor

SrTobi commented Jul 23, 2024

Describe the bug

I noticed that redshift doesn't find the location via geoclue2 anymore. It seems that geoclue2 requires another service called avahi, which didn't run on my system.

Setting

location.provider = "geoclue2";

enables the geoclue2 service, but that one fails to provide location data. Asking for the status gives

[~]$ systemctl status geoclue

Jul 23 23:35:30 thinkjet systemd[1]: Starting Location Lookup Service...
Jul 23 23:35:30 thinkjet .geoclue-wrappe[86012]: Failed to open /etc/geoclue/conf.d/: Error opening directory “/etc/geoclue/conf.d/”: No such file or directory
Jul 23 23:35:30 thinkjet .geoclue-wrappe[86012]: Failed to connect to avahi service: Daemon not running
Jul 23 23:35:30 thinkjet systemd[1]: Started Location Lookup Service.

after manually enabling avahi via

services.avahi.enable = true;

Everything works fine...

Note: I think for many people the avahi service is automatically enabled by other settings. For example guix, gnome, and pulseaudio with hasZeroconf will enable avahi.

Expected behavior

I think when the geoclue2 service is enabled, the avahi service should be enabled too.

Notify maintainers

@davidak, @bobby285271

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.41, NixOS, 24.11 (Vicuna), 24.11pre655874.68c9ed8bbed9`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a 👍 reaction to issues you find important.

@bobby285271
Copy link
Member

Hmmm yeah I guess we should do that when services.geoclue2.enableNmea is enabled.

@stephen-huan
Copy link
Member

Since the fix is one line, I added it to #329654 although the PR is unrelated. Note that since enableNmea is enabled by default, this now pulls in avahi even though avahi isn't necessary for most of the providers (definitely not wifi and static, I haven't tested the others). I consider this minor since someone concerned with minimalism can always disable this with enableNmea = false. We don't have the granularity to know whether enableNmea was explicitly enabled anyways.

@SrTobi to be clear your provider is NMEA, correct?

@SrTobi
Copy link
Contributor Author

SrTobi commented Jul 25, 2024

Ok, please wait before merging this... today geoclue isn't working for me anymore even though the avahi service is enabled... I can therefore not be sure if my assessment above is correct... I have to investigate this further.

@stephen-huan
Copy link
Member

Some steps that may help narrow the issue:

  1. How are you testing that geoclue works? Through redshift? What does the demo-agent show, e.g. /nix/store/fbs4f1xrx0bj3mggc0rqxx7p91z16ccm-geoclue-2.7.0/libexec/geoclue-2.0/demos/where-am-i (the path to geoclue can be found with ls /nix/store | grep geoclue-2.7.0, for example).

  2. What is your intended provider? (e.g. nmea, wifi, static-source). Does it work if you set your location statically like services.geoclue2: no way to add [static-source] #311595 (comment)?

  3. What do systemctl status geoclue.service, journalctl -u geoclue.service, systemctl status --user geoclue-agent.service, journalctl --user-unit=geoclue-agent.service, systemctl status --user redshift.service, and journalctl --user-unit redshift.service show? If systemctl restart geoclue.service fixes the issue (i.e. the issue only happens at boot), the boot log journalctl -b can also be useful.

  4. Presumably redshift used to work and recently broke. Since the module hasn't been changed in months (6afb255), what caused the change? did you upgrade recently? Otherwise, if your provider is wifi, I can think of nixos/geoclue2: not working because Mozilla Location Service is retiring #321121 as a possible culprit.

@99linesofcode
Copy link

99linesofcode commented Aug 29, 2024

Please refer to #321121 for more information on why geoclue2 is currently failing. That fact that it is no longer working probably has nothing to do with the changes proposed in #329654.

@stephen-huan
Copy link
Member

The current working premise implied by #329522 (comment) is that the author of the issue is using the nmea provider, which to the best of my knowledge is the only provider which requires the avahi service. If they were using the wifi provider (the only provider affected by the Mozilla Location Service (MLS) changes), avahi isn't relevant.

The PR #329654 adds the static (and compass) source(s), allowing one to circumvent the MLS issues with manual intervention. I initially included the unrelated fix to enable avahi when nmea is enabled since it was simple, but I've since removed it due to the concerns in #329522 (comment).

Re: MLS I already mentioned this in my 4th point of #329522 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants