[Very] Wrong geolocation in Google Maps, OpenStreetMap and others using Firefox

Hello, it’s the first time I’m posting here, but this is an issue that’s driving me crazy. I’m running EndeavourOS in both my laptop and desktop, and in each one of them Firefox is giving me completely wrong results when asking for my location when visiting Google Maps, OpenStreetMap or Bing Maps. It shows my location as somewhere in Baltimore, USA, when in fact I’m located in Mexico (:confused::question:). I mean, I’m aware that IP based location is not that accurate, but this is ridiculously inaccurate. I’m not using any VPN or similar.

I’ve done a few tests with other browsers and tools and right now this is what I found:

  • Firefox (from official repos) in EndeavourOS (main OS, laptop and desktop): Wrong location. It says that I’m in the USA, but I’m in Mexico. This happens with my main profile, with a fresh profile and in incognito mode.
  • Chromium (from official repos) in EndevaourOS (laptop): Correct and accurate location.
  • Brave (flatpak) in EndeavourOS (laptop): Almost accurate location, only a few hundred meters away (compatible with IP-based location typical error margin).
  • Firefox in Fedora 37 Live USB: Correct and accurate location.
  • GeoClue2 demos, as explained in the Arch Wiki: Wrong location, the same as the first case (USA).

I’ve tried changing the geo.provider.network.url in Firefox’s about:config to use Mozilla Location Service, as mentioned in the Arch Wiki with no avail. What baffles me is that before installing EndeavourOS in my desktop I was using Linux Mint, and my location was always correct in every browser. Similarly, in my laptop I had Windows before EOS and my location was always right.

Any ideas on how can I solve this?

I have no idea, as this is one very rare scenario I’ve literally never heard of or seen. I’m just commenting so I get notified of the replies out of curiosity if anyone replies.

@cfnnm
What is the output of

cat /etc/locale.conf

Settings, Privacy & Security, Permissions, Location, Settings. You probably want to put *.google.com there. Google also has some other domains, so just one may not make it work.

Also, what is your Firefox tracking Protection set to? Standard, Strict, or Custom?

You don’t have to comment for that, you can just change the topic to “tracking” or “watching” depending on how you want to be notified.

1 Like

No kidding. I had no idea I could do that. I will utilize that more! Thanks

2 Likes

You’re just getting a free VPN service from Firefox. Privacy!

3 Likes

Firefox blocks everything! :laughing:

% cat /etc/locale.conf
LANG=es_MX.UTF-8
LC_ADDRESS=es_MX.UTF-8
LC_IDENTIFICATION=es_MX.UTF-8
LC_MEASUREMENT=es_MX.UTF-8
LC_MONETARY=es_MX.UTF-8
LC_NAME=es_MX.UTF-8
LC_NUMERIC=es_MX.UTF-8
LC_PAPER=es_MX.UTF-8
LC_TELEPHONE=es_MX.UTF-8
LC_TIME=es_MX.UTF-8

I’ve already done that, plus as mentioned above I’m having the same problem with OpenStreetMap, Bing Maps and basically every other map site. Initially I also though of my Tracking Protection settings (I have mine set to Strict), but as I said, the same happens using a fresh profile without any customization.

This is strange to me. I don’t know the reason. Are you using a vpn?

From the OP:

Sorry I missed that as i came back to this post. :wink:

Do the following commands show valid values for you?

curl https://ipinfo.io/country
curl https://ipinfo.io/timezone

Yes, they show:

% curl https://ipinfo.io/country
MX

and

% curl https://ipinfo.io/timezone
America/Mexico_City

OK, I did some other tests and I found that basically the package geoclue is the problem. In Firefox there’s this setting in about:config called geo.provider.use_geoclue. In its default state is set to true but if I set it to false Firefox is able to pinpoint my correct location without problem. Set it to true again and the issue returns.

As it seems, neither Chromium nor Brave use geoclue to get the geolocation value, because as mentioned before, both give me a correct or almost correct location without issues. Interestingly, Vivaldi cannot detect the location at all and it give me an error that says “Geolocation error: Did not provide a good position fix.”.

Now, the thing is why Firefox in the Fedora 37 Live USB did gave me a correct location value? I fired up again the Live USB and checked the geo.provider.use_geoclue setting and surely it’s present and set to true. Then I tried to check the geoclue status and surprise, it is not installed in the live environment by default (I don’t know if it’s present once you install the OS).

So it seems that geoclue is calculating wrongly my location, and if the geo.provider.use_geoclue setting is enabled Firefox will pick that wrong value. I tried to remove the geoclue package to check if the issue persisted but it says that is a dependency for xdg-desktop-portal so I decided to not continue.

My doubt now is why geoclue is giving me a wrong location value, both in my laptop and my desktop (and it seems that it is related in some way to the Wi-Fi, because if I connect using an Ethernet cable it shows me an almost accurate value), but I think that is a topic for another thread. So I’ll mark this as solved for now but I think I’m going to try to research why this happens and if it has a solution or not (and because I also use redshift and right now it’s useless if I don’t configure manually the lat/lon coordinates).

Thank you for all for your replies :smile:

Edit: Small addition: If I set geo.provider.use_geoclue to false and configure geo.provider.network.url to use the Mozilla Location Services (URL=https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%) Firefox again gives me an incorrect location. It seems that MLS is at fault, because according to the documentation at https://wiki.mozilla.org/CloudServices/Location/Software, geoclue uses it to get its geodata. Interesting :thinking: .

This is really strange for sure.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.