How to enable or manage location services?

I have issues with some websites (mainly work and bankin) that ask for my location but I can’t get them to work or open because of that.

I know Ubuntu and other distros have this setting under Security, but I’ve searched, asked on reddit, and read arch documentation to no avail.

Is there a way to enable this, or is it something one has to ask to include in a future release?

Hello and welcome,

This really may depend on a number of things.

For a system-level location you might be looking for geoclue.

( Or alternatively geoclue_fake-git which would fulfill the same package requirements but allow you to manually set any location. )

As for browsers .. they may have their own settings or logic. What browser specifically?

Hi!

Thanks for your reply
I tried both Firefox and Chromium.

I have installed geoclue and checked the conf file to see if there was something set to false, but everything seems to be right.

What other course of action should I follow?

I looked for geoclue status, this is what happens

systemctl status geoclue.service
○ geoclue.service - Location Lookup Service
Loaded: loaded (/usr/lib/systemd/system/geoclue.service; static)
Active: inactive (dead)

I also forgot to ask .. what is the DE?

I’m sorry, what do you mean with DE?

Desktop Environment like KDE Plasme, GNOME, etc.

Thanks, HaRo.

I’m running Plasma.

OK.

So in firefox do you have geo.enabled (in about:config) set to true?

Also maybe we wonder about which firefox and/or related packages;

pacman -Qs firefox

Normally this already works well enough by just using the IP of your connection.

But if we need geoclue then we can also check on thats conf;

cat /etc/geoclue/geoclue.conf

geo.enabled is set to true.

Result for pacman -Qs firefox is this

**local/firefox 143.0.3-1** 
    Fast, Private & Safe Web Browser 
**local/ttf-fira-sans 1:4.301-2** 
    Mozilla's sans-serif typeface designed for Firefox OS 
**local/zen-browser-bin 1.16.2b-1** 
    Performance oriented Firefox-based web browser

I did change the method to reallyfreegeoip, and added an extra url, but it is commented:
Here it is the entirety of the file:

# Configuration file for Geoclue

# 

# NOTE: All configurations settings below are mandatory and the defaults are

# what you see before you edit them. If you want to keep the default

# values around, copy and comment out the appropriate line(s) before

# changing them.

# Agent configuration options

\[agent\]

# Whitelist of desktop IDs (without .desktop part) of all agents we recognise,

# separated by a ‘;’.

whitelist=geoclue-demo-agent;gnome-shell;io.elementary.desktop.agent-geoclue2;sm.puri.Phosh;lipstick

# IP source configuration options

\[ip\]

# Enable the GeoIP source

enable=true

# Method (backend) to use for IP location. Currently implemented are:

# ‘ichnaea’: Use the Ichnaea (MLS) API with the URL from the wifi source.

# ‘gmaps’: Use the location determined by Google Maps.

# ‘reallyfreegeoip’: reallyfreegeoip.org. Fixed accuracy, see accuracy option below.

method=reallyfreegeoip

# Optional overrides to method defaults:

# 

# Alternative server URL

#url=https://example.com/v1/geolocate
#url=https://beacondb.net/

# 

# Override the accuracy value from method

#accuracy=30000.0

# Network NMEA source configuration options

\[network-nmea\]

# Fetch location from NMEA sources on local network?

enable=true

# Use an NMEA unix socket as the data source

# nmea-socket=/var/run/gps-share.sock

# 3G source configuration options

\[3g\]

# Enable 3G source

enable=true

# CDMA source configuration options

\[cdma\]

# Enable CDMA source

enable=true

# Modem GPS source configuration options

\[modem-gps\]

# Enable Modem GPS source

enable=true

# WiFi source configuration options

\[wifi\]

# Enable WiFi source

enable=true

# URL to a WiFi geolocation service compatible with the Ichnaea API

# ( https://ichnaea.readthedocs.io/en/latest/api/geolocate.html ).

# An API key can be set by using the ‘key’ URL parameter.

# If unset, defaults to an URL defined at build-time,

# this URL is ‘https://www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM’’

#url=https://example.com/v1/geolocate?key=YOUR_KEY

# To use the BeaconDB geolocation service, uncomment this URL.

#url=https://api.beacondb.net/v1/geolocate

# To use the Positon geolocation service, uncomment this URL.

# 

# NOTE: Distributors of geoclue may only uncomment this URL if the

# service is used in a non-commercial manner, to quote Positon:

# 

# We generally consider a service or software commercial, when it is only

# intended to be available (beyond free trials or other restrictions) via

# a one-time payment, subscription, account registration or similar.

# Funding the development through donations or optional support contracts

# does not make the software itself commercial.

# 

# Fedora Linux, CentOS Stream, Rocky Linux or AlmaLinux all would not be

# considered commercial by us, neither would e.g. Debian, Ubuntu or

# elementary OS. However, RedHat Enterprise Linux and various SUSE Linux

# Enterprise versions would be considered commercial.

# 

# For more information, contact Positon or consult their website:

# 

https://positon.xyz/docs/

# 

#url=https://api.positon.xyz/v1/geolocate?key=56aba903-ae67-4f26-919b-15288b44bda9

# To use the Google geolocation service, uncomment this URL

# while changing YOUR_KEY to your Google API key.

# 

# WARNING: Please make sure that you are complying with the Google’s ToS and

# policies if you uncomment this:

# 

# 

https://developers.google.com/maps/documentation/geolocation/policies

# 

#url=https://www.googleapis.com/geolocation/v1/geolocate?key=YOUR_KEY

# Submit data to WiFi geolocation service

# If set to true, geoclue will automatically submit network data

# each time it gets a GPS lock.

# 

# Currently, only Modem GPS or Network NMEA sources are supported as providers

# of a location to submit (one at a time).

# If Modem GPS source is enabled above it will be the exclusive provider

# (regardless whether the system is actually equipped with such modem),

# otherwise Network NMEA source will be considered.

submit-data=false

# URL to submit data to a WiFi geolocation service with an Ichnaea compatible API

# ( https://ichnaea.readthedocs.io/en/latest/api/geosubmit2.html ).

# If unset, defaults to an URL defined at build-time,

# this URL is ‘https://api.beacondb.net/v2/geosubmit’.

#submission-url=https://example.com/v2/geosubmit?key=YOUR_KEY

# A nickname to submit network data with. If empty, omitted from the submission.

# Otherwise, must be 2 to 32 characters long. Defaults to “geoclue”.

submission-nick=geoclue

# Compass configuration options

\[compass\]

# Enable Compass

enable=true

# Static source configuration options

# 

# This source reads location from “geolocation” file in /etc - please

# consult geoclue(5) man page for the format description of this file.

\[static-source\]

# Enable the static source

# If you make use of this source, you probably should disable other location

# sources in this file so they won’t override the configured static location.

enable=true

# Application configuration options

# 

# NOTE: Having an entry here for an application with allowed=true means that

# geoclue will not ask agent to authorize the application. This is to

# ensure that applications with built-in authorization mechanism (e.g web

# browsers) do not have to be bound to agents.

# 

# If your application is denied access to location information and your

# operating system doesn’t provide any mechanism to change that, it is

# likely a bug in your operation system (or geoclue). The solution is to

# report the issue with all details, rather than adding your application

# to this list.

# 

# Format:

# 

# # Desktop ID of application without .desktop part

# \[random-app\]

# 

# # Allowed access to location information?

# allowed=true|false

# 

# # Is application a system component?

# system=true|false

# 

# # List of UIDs of all users for which this application is allowed location

# # info access, separate by ‘;’. Keep it empty for allowing it for all users.

# users=

\[gnome-datetime-panel\]
allowed=true
system=true
users=

\[gnome-color-panel\]
allowed=true
system=true
users=

\[org.gnome.Shell\]
allowed=true
system=true
users=

\[io.elementary.desktop.agent-geoclue2\]
allowed=true
system=true
users=

\[sm.puri.Phosh\]
allowed=true
system=true
users=

\[epiphany\]
allowed=true
system=false
users=

\[firefox\]
allowed=true
system=true
users=

\[lipstick\]
allowed=true
system=true
users=

I’m having the exact same problem. I’ve done the same steps, & still no resolution on this end either.

I’m also having this problem as well.

I’ve tried geoclue_fake-git and while it responds on dbus but fails to return a location even when I’ve set the lat/long in /etc/geoclue_fake.toml - I haven’t been able to get my browser to respond to requests.

Geoclue with the pantheon-geoclue2-agent doesn’t seem to respond using browsers either. I’ve turned on location in firefox without luck.

I had this problem on Windows as well with Firefox. Zen Browser definitely. I think I might have had to use Edge or Chrome to get location reporting to work.

My current work around for this by editing the advanced config of Firefox:
about:config

and manually setting the location response.
The browser apps still throw errors but they accept the location.

changing the value of preference key:
geo.provider.network.url

from

https://www.googleapis.com/geolocation/v1/geolocate?key=%GOOGLE_LOCATION_SERVICE_API_KEY%

to

data:application/json,{“location”: {“lat”: 11.1234, “lng”: -11.1234}, “accuracy”: 100}

Where the lat and lng values are whatever location you want to appear to be at.

It’s not a fix for the issue, but it temporarily resolves the inability to access websites that require a location check.

I can’t get any apps that query location to get it (Weather, Maps, Firefox). When I issue systemctl status geoclue.service, it gives me the result:

Failed to query location: Query location SOUP error: Unknown error

My DE is Gnome 49.4

do you need the actual current location like you would get from a GPS device or do you just need to give them a location so the services and apps work?

I was never able to get the system service (the real or the fake location providing services) to work. The only way I was able to get Firefox to work to provide a location to websites or apps running in firefox was by manually setting the location value in the Firefox config itself (see my post above). There seems to be some disconnect between the browser and the system-service , if the system service works at all.

Yes, I just want the laptop to get its current location from WiFi so it can display local weather and when I load Google Maps on the browser, to retrieve nearby restaurants, services, etc. I just returned from a trip with my laptop running CachyOS (with Gnome 49) and it doesn’t do any of that. What’s the point of working from a laptop with this OS and it doesn’t get basic location info?

I found an issue ticket at Arch Linux Git from two years ago proposing replacing geoclue’s default Mozilla Location Service (MLS) to Google geolocation. It seems to have a commit, but it’s not clear whether it was implemented. Two years on, and several versions of geoclue from the one discussed there, and it still seems to be trying to use MLS. It’s frustrating.

Proposal to move to Google geolocation services by default due to MLS’s imminent shutdown in less than 1 month

2.7.1-3: Use Google by default

I suppose we could just build a version of geoclue that has the patch and put it in paru or whatever the outside package service is called on CachyOS

But is that really the issue?

It should already be using google;

And we entirely bypass that above by using geoclue_fake and setting a manual location and it still does not work.

For those running regular geoclue then can we see the output from;

/usr/lib/geoclue-2.0/demos/where-am-i

Though you may need to start the agent first;

/usr/lib/geoclue-2.0/demos/agent &

Maybe a silly question but just to be double-triple sure .. is the service started or enabled?

systemctl status geoclue
systemctl start geoclue
systemctl enable geoclue

PS.

While we were here I noticed something I had not before.
And that is geoclue-tz which is in the AUR.
Might be a nice alternative.

PPS. Also found this.

Who would want a computing device that leaks location data without permission?

Have you verified this? It could also be google blocking unauthorized useof their service.

Set up one of the location providers here:

Hey, sorry for my tone. I was a bit frustrated when I was traveling and I didn’t have enough time to troubleshoot. Also, this thread exists, so there are people besides me who would like this to work.

Since my last post I’ve been home and had more time to look at this more carefully and realized that this geoclue build is using Google, but there’s still something off.