You are not logged in.

#1 2018-05-10 19:09:42

kuzulis
Member
Registered: 2018-05-10
Posts: 12

Geolocation geoclue service always is dead

Hi all.

I need to use the geoclue2 to detect my geolocation,
I have installed the geoclue2 package:

[denis@kuzulis ~]$ pacman -Ss geoclue2
extra/geoclue2 2.4.7-1 [установлен]
    Modular geoinformation service built on the D-Bus messaging system

and all its dependencies:

libsoup  json-glib  libmm-glib  avahi

but nothing does not work, because the geoclue service is always dead:

[denis@kuzulis ~]$ sudo systemctl status geoclue.service
● geoclue.service - Location Lookup Service
   Loaded: loaded (/usr/lib/systemd/system/geoclue.service; static; vendor preset: disabled)
   Active: inactive (dead)

At trying to startup this service manually, it stops after some time:

[denis@kuzulis ~]$ sudo systemctl status geoclue.service
● geoclue.service - Location Lookup Service
   Loaded: loaded (/usr/lib/systemd/system/geoclue.service; static; vendor preset: disabled)
   Active: active (running) since Thu 2018-05-10 21:49:29 MSK; 2s ago
Main PID: 1288 (geoclue)
    Tasks: 4 (limit: 4915)
   Memory: 3.3M
   CGroup: /system.slice/geoclue.service
           └─1288 /usr/lib/geoclue2/geoclue -t 5

And it is died again:

[denis@kuzulis ~]$ sudo systemctl status geoclue.service
● geoclue.service - Location Lookup Service
   Loaded: loaded (/usr/lib/systemd/system/geoclue.service; static; vendor preset: disabled)
   Active: inactive (dead)

Also the geoclue does not work on Fedora 27.

Question: What to do to fix this? The arch wiki does not contains any information how to configure the geoclue service.

PS: On Ubuntu it does work. Oops, sorry, it works with old geoclue 0.12.x.

Last edited by kuzulis (2018-05-11 06:00:27)

Offline

#2 2018-05-10 19:29:18

kuzulis
Member
Registered: 2018-05-10
Posts: 12

Re: Geolocation geoclue service always is dead

UPD: Later, after quering of a service status I see fllowing:

[denis@kuzulis ~]$ sudo systemctl status geoclue.service
● geoclue.service - Location Lookup Service
   Loaded: loaded (/usr/lib/systemd/system/geoclue.service; static; vendor preset: disabled)
   Active: inactive (dead)

мая 10 21:49:29 kuzulis systemd[1]: Starting Location Lookup Service...
мая 10 21:49:29 kuzulis systemd[1]: Started Location Lookup Service.
мая 10 22:14:45 kuzulis systemd[1]: Starting Location Lookup Service...
мая 10 22:14:45 kuzulis systemd[1]: Started Location Lookup Service.
мая 10 22:14:46 kuzulis geoclue[1613]: Failed to query location: Peer failed to perform TLS handshake
мая 10 22:16:12 kuzulis systemd[1]: Starting Location Lookup Service...
мая 10 22:16:12 kuzulis systemd[1]: Started Location Lookup Service.
мая 10 22:16:14 kuzulis geoclue[1636]: Failed to query location: Peer failed to perform TLS handshake

Last edited by kuzulis (2018-05-10 19:29:38)

Offline

#3 2018-05-10 20:18:35

seth
Member
Registered: 2012-09-03
Posts: 49,986

Re: Geolocation geoclue service always is dead

but nothing does not work

So all is good :-P

How exactly do you try to query the location?
Configuration is done in /etc/geoclue/geoclue.conf, you will in doubt have to allow access to the desired client.

The service auto-terminates after 5 seconds, so that seems intended.

Online

#4 2018-05-11 05:59:29

kuzulis
Member
Registered: 2018-05-10
Posts: 12

Re: Geolocation geoclue service always is dead

How exactly do you try to query the location?

I'm try do it programmatically, with Qt: At first, I try to create a "org.freedesktop.GeoClue2.Manager"
object, but it creates as invalid (most likelly due to the service is down):

    ...
    ...
    const char GEOCLUE2_SERVICE_NAME[] = "org.freedesktop.GeoClue2";
    ...
    ...
    OrgFreedesktopGeoClue2ManagerInterface manager(
                QLatin1String(GEOCLUE2_SERVICE_NAME),
                QStringLiteral("/org/freedesktop/GeoClue2"),
                QDBusConnection::systemBus());

    if (!manager.isValid()) {
        qCCritical(lcPositioningGeoclue2) << "Unable to create the manager object:";
        return;
    }
    ...
    ...

Configuration is done in /etc/geoclue/geoclue.conf, you will in doubt have to allow access to the desired client.

Yes, I already have added there an entry for my application (it calls just 'my'):

# Configuration file for Geoclue

# Agent configuration options
[agent]

# Whitelist of desktop IDs (without .desktop part) of all agents we recognise,
# separated by a ';'.
whitelist=gnome-shell

# Network NMEA source configuration options
[network-nmea]

# Fetch location from NMEA sources on local network?
enable=true

# WiFi source configuration options
[wifi]

# URL to the wifi geolocation service. The key can currenty be anything, just
# needs to be present but that is likely going to change in future.
url=https://location.services.mozilla.com/v1/geolocate?key=16674381-f021-49de-8622-3021c5942aff

# To use the Google geolocation service instead of mozilla's, simply uncomment
# this url while changing API_KEY to your Google API key and comment out or
# remove the url above.
#
#url=https://www.googleapis.com/geolocation/v1/geolocate?key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM

# Submit data to Mozilla Location Service
# If set to true, geoclue will automatically submit network data to Mozilla
# each time it gets a GPS lock.
#
submit-data=false

# URL to submission API of Mozilla Location Service
submission-url=https://location.services.mozilla.com/v1/submit?key=16674381-f021-49de-8622-3021c5942aff

# A nickname to submit network data with. This is currently used for leaderboard:
# https://location.services.mozilla.com/leaders
# A nickname must be 2-32 characters long.
submission-nick=geoclue

# 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 system components and applications with built-in
#       authorization mechanism (e.g web browsers) do not have to be bound to
#       agents.
#
# 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=

[epiphany]
allowed=true
system=false
users=

[firefox]
allowed=true
system=false
users=

### HERE IS MY APPLICATION ADDED ###
[my]
allowed=true
system=false
users=

The service auto-terminates after 5 seconds, so that seems intended.

Who should then run this service?

PS: There are any test examle application to check the geoclue2?
Because, as I know, the previous geoclue can be tested with 'geoclue-test-gui' application, but geoclue2 has nothing (I did not find any).

Last edited by kuzulis (2018-05-11 06:02:25)

Offline

#5 2018-05-11 08:11:32

seth
Member
Registered: 2012-09-03
Posts: 49,986

Re: Geolocation geoclue service always is dead

It's dbus activated, you can try eg. "redshift -l geoclue2".
https://github.com/jonls/redshift/blob/ … geoclue2.c

It's important to understand that this is an async query, you ask for the location and wait until the service name appears on the bus.
libgeoclue2 might abstract that for you.

Online

#6 2018-05-12 14:40:37

kuzulis
Member
Registered: 2018-05-10
Posts: 12

Re: Geolocation geoclue service always is dead

Ahh.. many thanks for your help. The redshift sources it is a good start point. smile

Offline

Board footer

Powered by FluxBB