gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Opening port for remote access to gpsd


From: Gary E. Miller
Subject: Re: Opening port for remote access to gpsd
Date: Thu, 23 Jul 2020 17:34:03 -0700

Yo S. Joshua!

On Thu, 23 Jul 2020 20:39:58 +0000
"Stein, S. Joshua" <josh@anl.gov> wrote:

> Hello Gary,
> 
> With help from some others, I have found the solution. I will add the
> details you asked for below just to wrap this up.
> 
> TL;DR: Modify the gpsd.socket (for me, located at
> /lib/systemd/system/gpsd.socket) file as follows: Change line: 
> ListenStream=127.0.0.1:2947
> To
> ListenStream=0.0.0.0:2947

Which was in the link I had sent you:

https://gpsd.io/troubleshooting.html#systemdtroubleshooting

Do you not care about IPv6?

> And make sure the '-G' option is specified in gpsd default file (for
> me, located at /etc/default/gpsd): # Other options you want to pass
> to gpsd GPSD_OPTIONS="-G"

And "-n"!

> Making those two changes brought me to the solution of being able to
> attach to the daemon from a remote machine.

But startup will be slow without the -n.  Timekepping will also
be problematic.

> >A common configuration.  But what distro?  distro version? gpsd
> >version?  
> 
> cat /etc/os-release
> PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
> NAME="Raspbian GNU/Linux"
> VERSION_ID="10"
> 
> gpsd -V
> gpsd: 3.17 (revision 3.17)

Oh my.  3.17 is years old.  3.20 is current.  3.21 soon.

> >If you call using gpsd under systemd(umb) "proper".  I do not.  
> 
> Understood. My organization uses systemd, so my hands are tied in
> this regard.

I'm not recommending against systemd(umbest).  I'm recommending not
running gpsd under it.

> >Did you use "-n"?  Do you know gpsd is really running?  Run these
> >two, as root, and report back:
> >
> >   # pstree -paul | fgrep gpsd
> >   # netstat -apn | fgrep 2947  
> 
> I do not use -n as it did not come that way in my disto (via the
> default).

Neither did -G or ListenStream.

>Note that this came to me via "pip install gps"

Uh, the "gps" in pip is not gpsd.  I believe it is 3.19 compatable, not
3.17.  "gps" is for when you do not have gpsd installed locally.

> pi@raspberrypi:/lib/systemd/system $ pstree -paul | fgrep gpsd
>   |-gpsd,344,gpsd -G /dev/ttyUSB0
>   |               |-grep,633 -F --color=auto gpsd

So that would be after you ran a client, not before.

> pi@raspberrypi:/lib/systemd/system $ netstat -apn | fgrep 2947
> (Not all processes could be identified, non-owned process info
>  will not be shown, you would have to be root to see it all.)

Which is why I said to run as root.  So miussing the data I need.

> >Before connecting from client, you need to know the daemon is
> >running "properly" on the host.  
> 
> Which it was except for the "blocked" socket for remote connections

It was not "blocked", it was "never started".  Big difference when you
are troubleshooting.

> >You forgot -n  
> 
> As I stated above, the disto I received via pip install did not
> specify the '-n' option.

And as I stated above, gpsd is not in pip!  And it will cause problems
for startup and timekeeping.

> I did not think it necessary, so did not
> add. I'm still not sure why I want the daemon to continually poll the
> GPS or why that would make a difference to my specific issue.

1) startup speed.
2) timekeeping.

In some corner cases it can take 13 minutes to start without -n.

> >Yup.  And the systemd files you are using are NOT part of gpsd, so
> >we have no idea what your unnamed distro did wrong.  
> 
> So apparently what it did wrong was to specify a gpsd.socket
> "ListenStream" parameter to localhost only.

Not you, that is the Raspbian (not pip) default.

> >Nor would I expect it to.  You are tying to use TCP to connect
> >remotely, not a socket.  Sockets are local only.  
> 
> I'm not sure what you mean by "sockets are local only". The socket in
> this case (for TCP connections) is an endpoint for the connection
> defined by the ip address and the port. 

When gpsd says "sockets" it refers to socket files, not to network
protocols.  That kind of socket" is often confused with out way of
handling networks using "socket" system calls which are something else.

> >Thinking of this as a socket problem is one of your mistakes.  
> 
> I disagree, but that is likely just a matter of semantics. The term
> socket and port get mangled depending on the transport layer being
> utilized.

Just "semantics".  Only needed for human communication.

> >I don't use sysytemd(unmber) with gpsd and recommend against it.  It
> >causes much grief, as a search of the list archives will show you.  
> 
> As stated above, I am bound by our admin practices to adopt the
> systemctl (systemd) architecture.

And, as stated above, that is something unrelated to my recommendation.

> For clarity, here are my systemd config files:

Did you create them cold?  Or modify from some other source?

> pi@raspberrypi:/lib/systemd/system $ cat gpsdctl@.service
> [Unit]
> Description=Manage %I for GPS daemon
> Requires=gpsd.socket
> BindsTo=dev-%i.device
> After=dev-%i.device
> 
> [Service]
> Type=oneshot
> Environment="GPSD_SOCKET=/var/run/gpsd.sock"
> EnvironmentFile=-/etc/default/gpsd
> EnvironmentFile=-/etc/sysconfig/gpsd
> RemainAfterExit=yes
> ExecStart=/bin/sh -c "[ \"$USBAUTO\" = true ] && /usr/sbin/gpsdctl
> add /dev/%I || :" ExecStop=/bin/sh -c "[ \"$USBAUTO\" = true ] &&
> /usr/sbin/gpsdctl remove /dev/%I || :"

Uh, oh.  That is a mashup of incompatible ways to run gpsd.  I'll let
the systemd(reck) users tell you the problem.  Have you checked your
logs?

> ListenStream=[::1]:2947

You do not want IPv6?


> >Before you send that, have you read the doc on this?  
> 
> >https://gpsd.io/troubleshooting.html#systemdtroubleshooting  
> 
> Yes, I had read that.

Care to share why you did not follow its guidance?

Any suggestions for improvements?

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        gem@rellim.com  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Attachment: pgprMbEnBPkx3.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]