Better document how to listen on the network
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/
[Socket]
ListenStream=
ListenStream=
ListenStream=
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://
100 /var/lib/
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: gpsd 3.17-5
ProcVersionSign
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.
The solution is to modify file /lib/systemd& /system/ gpsd.socket as follows:
... 127.0.0. 1:2947 <--- comment out this line 0.0.0.0: 2947 <--- add this line
#ListenStream=
ListenStream=
...
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.