Better document how to listen on the network

Bug #1862602 reported by Kalle Tuulos
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gpsd (Ubuntu)
Triaged
Wishlist
Unassigned

Bug Description

GPSD does not listen to other addresses, i.e. it does not serve clients on network, even though -G is defined in /etc/default/gpsd.

Netstat output is as follows:

user@mydevice:~ $ netstat -l | grep gps
tcp 0 0 localhost:gpsd 0.0.0.0:* LISTEN
tcp6 0 0 localhost:gpsd [::]:* LISTEN
unix 2 [ ACC ] STREAM LISTENING 21487 /var/run/gpsd.sock

And ps -ax shows as follows:

3890 ? S<s 0:00 /usr/sbin/gpsd -G /dev/ttyUSB0

If GPSD is started from command line, then it serves network clients fine. Here is an example:

user@mydevice:~$ sudo -u gpsd /usr/sbin/gpsd -G /dev/ttyUSB0
user@mydevice:~$ netstat -l | grep gps
tcp 0 0 0.0.0.0:gpsd 0.0.0.0:* LISTEN
tcp6 0 0 [::]:gpsd [::]:* LISTEN

My assumption, that this is due to systemd overriding the -G option, as following is defined in /lib/systemd/system/gpsd.socket:

[Socket]
ListenStream=/var/run/gpsd.sock
ListenStream=[::1]:2947
ListenStream=127.0.0.1:2947

1) The release of Ubuntu you are using, via 'lsb_release -rd' or System -> About Ubuntu
Ubuntu 18.04.4 LTS

2) The version of the package you are using, via 'apt-cache policy pkgname' or by checking in Software Center
gpsd:
  Installed: 3.17-5
  Candidate: 3.17-5
  Version table:
 *** 3.17-5 500
        500 http://fi.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        100 /var/lib/dpkg/status

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: gpsd 3.17-5
ProcVersionSignature: Ubuntu 4.15.0-76.86-generic 4.15.18
Uname: Linux 4.15.0-76-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.9
Architecture: amd64
Date: Mon Feb 10 09:18:29 2020
InstallationDate: Installed on 2018-11-12 (454 days ago)
InstallationMedia: Lubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
SourcePackage: gpsd
UpgradeStatus: No upgrade log present (probably fresh install)
mtime.conffile..etc.default.gpsd: 2020-02-10T09:15:45.902653

Revision history for this message
Kalle Tuulos (kalle-tuulos) wrote :
Revision history for this message
Kalle Tuulos (kalle-tuulos) wrote :

The solution is to modify file /lib/systemd&/system/gpsd.socket as follows:

...
#ListenStream=127.0.0.1:2947 <--- comment out this line
ListenStream=0.0.0.0:2947 <--- add this line
...

This works for IPv4, but for IPv6, I did not get it working. Anyway, I have disabled IPv6 from my "production" devices, so this does not matter.

Revision history for this message
Paride Legovini (paride) wrote :

Hello Kalle,

Thanks for filing this bug report. The version of gpsd shipped with Focal has an informative comment in /lib/systemd/system/gpsd.socket:

[Socket]
ListenStream=/var/run/gpsd.sock
ListenStream=[::1]:2947
ListenStream=127.0.0.1:2947
# To allow gpsd remote access, start gpsd with the -G option and
# uncomment the next two lines:
# ListenStream=[::1]:2947
# ListenStream=0.0.0.0:2947
SocketMode=0600

That's basically what you did, but now you also have the recipe for IPv6. As this bug report is actually about configuration/documentation issue and not an actual bug in gpsd, I'm going to set its status to Invalid. Should you not agree with this conclusion feel free to comment back end set the status back to New, and we'll look at it again.

Changed in gpsd (Ubuntu):
status: New → Invalid
Revision history for this message
Kalle Tuulos (kalle-tuulos) wrote :

Before marking this as "invalid", please express this in /etc/default/gpsd - otherwise user's don't understand, that the -G requires also change into /lib/systemd/system/gpsd.socket file.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

That's a good suggestion, I'll reopen this bug with a severity of wishlist. Thanks!

Changed in gpsd (Ubuntu):
status: Invalid → Triaged
importance: Undecided → Wishlist
summary: - GPSD does not serve network clients even -G is used
+ Better document how to listen on the network
Revision history for this message
Paul Boven (p-boven) wrote :

Ideally, the gpsd.socket unit would parse the defaults file and enable this transparently.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.