Random GNSS enquiry

As MLS is retired, I configured beaconDB. If this is also (nearly) a no go, what options do I have in Munich, Germany?

1 Like

When it comes to online services, I’m not aware of any, aside of Google and some commercial providers.

I’d go with OLS.

1 Like

How do I configure OLS in geoclue? I googled a bit w/o any luck.

1 Like

It was linked here above: tpikonen/ols: Offline Location Service - Codeberg.org

1 Like

Yesterday I’ve got once a result from the geoclue service:

purism@pureos:~/guru$ ./geo.py
51.06797 13.781686

The above values are “lightyears” away from my place. Correct would be something like

48.xxxxxxxx 11.xxxxxxxx
1 Like

Btw: man kann diese Python scripts nicht mit Ctrl-C abbrechen, wieso?

1 Like

It is because the Python interpreter raising the KeyboardInterrupt exception is not handled by the running script, so use Ctrl + Break instead.

1 Like

Thanks.

Only for the record: Ctrl-Break seems to be on Linux Ctrl-\ which on my MacBook (I’m ssh’ed into the L5) is a bit complicated to key-in, but one can also use Ctrl-4 for this. Both generate SIGQUIT which kills the Python proc.

1 Like

I will give this a try. Setting up the requirements, one pkg is missing:

cat requirements.txt
aiohttp
fastcluster
fastjsonschema
mercantile
numpy
scipy

this is for Byzantium (L5):

sudo apt install python3-aiohttp
sudo apt install python3-fastcluster
sudo apt install python3-fastjsonschema    NO FOUND
sudo apt install python3-fastcluster
sudo apt install python3-mercantile
sudo apt install python3-numpy

How to get the missing piece?

Update:

I installed pip and with this the missing pieces:

sudo apt install python3-pip

pip install fastjsonschema
pip install tomli

When I now run (as the README.md indicates) it is missing a config file:

python3 -m ols -d debug -C ols.toml
Could not load config: [Errno 2] No such file or directory: 'ols.toml'

find . -name ols.toml
(nothing)

Update 2:

mkdir ~/.local/share/ols
python3 -m ols -d debug -C ols/data/ols-example-conf.toml
wiglenetdb DEBUG: Database version: 1
wiglenetdb DEBUG: Database version: 1
server INFO: Using 'clustering' locator
localdb DEBUG: Database file: /home/purism/.local/share/ols/localdb.db
localdb DEBUG: Database version: 1
server INFO: Will update local database '/home/purism/.local/share/ols/localdb.db'
server INFO: Starting service...

======== Running on http://127.0.0.1:8088 ========
(Press CTRL+C to quit)

Update 3:

I added the following lines to the geoclue conf file:

diff /etc/geoclue/geoclue.con*
49,54d48
< # added July 2024 by guru@unixarea.de
< # see also: https://forums.puri.sm/t/random-gnss-enquiry/24041/50
< #
< url=http://localhost:8088/v1/geolocate
< submit-data=true
< submission-url=http://localhost:8088/v2/geosubmit

I’m still not very sure about the config of OLS, I’m using the example file from ols/data/ols-example-conf.toml. @dos could please comment on thiis or share your version. Thanks.

The OLS project mentions a tool /usr/libexec/geoclue-2.0/demos/where-am-i to get the current location, which does not exist on the L5’s Byzantium.

1 Like

I’ve got the first log lines of the OLS service:

purism@pureos:~$ cat err
server INFO: Got locate request with 1 cellTowers
web_protocol ERROR: Error handling request
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/lib/python3/dist-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/home/purism/guru/ols/ols/server.py", line 82, in locate_handler
    async with asyncio.timeout(20):
AttributeError: module 'asyncio' has no attribute 'timeout'

I’ve filed an issue as: #6 - web_protocol ERROR: Error handling request - tpikonen/ols - Codeberg.org

The outcome is: the project needs python 3.11 while we have only 3.9.2 :frowning:

1 Like

beaconDB has now been fixed to provide fallback from MLS data with the queries produced by Geoclue, so it should work now for basic location based on active cellular tower.

3 Likes

My actual geoclue.conf is:

...
[wifi]
enable=true
url=https://beacondb.net/v1/geolocate
submit-data=false
submission-nick=geoclue

but I still get a lot of errors in syslog like:

Jul 21 13:10:05 pureos geoclue[8391]: Failed to open /etc/geoclue/conf.d/: Error opening directory “/etc/geoclue/conf.d/”: No such file or directory
Jul 21 13:10:12 pureos geoclue[8391]: Failed to query location: Query location SOUP error: Not Found
Jul 21 13:10:27 pureos geoclue[8391]: Failed to query location: Query location SOUP error: Not Found
Jul 21 13:10:57 pureos geoclue[8391]: Failed to query location: Query location SOUP error: Not Found
Jul 21 13:11:12 pureos geoclue[8391]: Failed to query location: Query location SOUP error: Not Found
...

The first error line comes on any startup of the geoclue service, is mislaeding and wrong. This dir is not necessary if you don’t want to overwrite values in /etc/geoclue/geoclue.conf. On our L5 apamor does not even allows to create it or have files there.

Is there any way to log what geoclue is requesting and not getting from beaconDB? Where are the actual sources of it to have a look into how logging is done and could be enhanced?

I cloned the sources with

git clone https://gitlab.freedesktop.org/geoclue/geoclue

The C-sources use a lot of time the function g_debug() to log any kind of events or problems, among them the above error:

$ grep 'Failed to query location' *.c
gclue-web-source.c:                        g_warning ("Failed to query location: %s",
gclue-web-source.c:                        g_debug ("Failed to query location: %s",

I did not found how to enable the other messages, perhaps some env var as G_DEBUG must be set, but I don’t have any clue to which value(s).

The other day in the tread about OLS I missed the tool /usr/libexec/geoclue-2.0/demos/where-am-i One must install the pkg:

sudo apt install geoclue-2-demo

$ /usr/libexec/geoclue-2.0/demos/where-am-i
Client object: /org/freedesktop/GeoClue2/Client/1

New location:
Latitude:    48.057970°
Longitude:   11.640618°
Accuracy:    211.000000 meters
Description: 3GPP
Timestamp:   Mon 22 Jul 2024 10:59:12 AM CEST (1721638752 seconds since the Epoch)

I found out how to enable all messages. I modified the service file with one additional line:

# head /lib/systemd/system/geoclue.service
[Unit]
Description=Location Lookup Service

[Service]
Type=dbus
BusName=org.freedesktop.GeoClue2
User=geoclue
Environment="GSETTINGS_BACKEND=memory"
Environment="G_MESSAGES_DEBUG=all"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ExecStart=/usr/libexec/geoclue
1 Like

This is normal and expected. beaconDB doesn’t implement a GeoIP-based fallback, so whenever it does not recognize the cells/networks or if Geoclue doesn’t pass any of those, you’ll get this error in logs.

1 Like