Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GPSD not starting automatically

1,345 views
Skip to first unread message

David Taylor

unread,
Mar 2, 2016, 6:17:37 AM3/2/16
to
Yes, you already think you know the answer looking at the topic title,
but perhaps it's not the obvious one!

Raspbian Jessie, with current updates.
gpsd installed and working from the default serial port. Almost.

When first booting the RPi gpsd does /not/ autostart in spite of "-n"
being present in the options. This used to work under Wheezy.

So I enter: "sudo service gpsd restart" and gpsd is then running as
normal. I guess I'm missing something obvious, but what? Any thoughts
about what the problem might be, and how to proceed with further diagnosis?

Thanks!
--
Cheers,
David
Web: http://www.satsignal.eu

David

unread,
Mar 2, 2016, 7:22:13 AM3/2/16
to
Are you sure the script is being executed at start up?

Perhaps include a diagnostic message output to a temporary file to confirm
execution?

Assuming you can find the script that is supposed to start the process, of
course.

Systemd joys await me shortly.

Cheers

Dave R



--
Windows 8.1 on PCSpecialist box

Martin Gregorie

unread,
Mar 2, 2016, 7:37:05 AM3/2/16
to
On Wed, 02 Mar 2016 11:17:36 +0000, David Taylor wrote:

> When first booting the RPi gpsd does /not/ autostart in spite of "-n"
> being present in the options. This used to work under Wheezy.
>
Where are these options of which you speak?

> So I enter: "sudo service gpsd restart" and gpsd is then running as
> normal. I guess I'm missing something obvious, but what? Any thoughts
> about what the problem might be, and how to proceed with further
> diagnosis?
>
Is the -n option present in both the ExecStart and ExecReload lines in
the [Service] section of gpsd.service?


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |

David Taylor

unread,
Mar 2, 2016, 9:56:42 AM3/2/16
to
The options are entered by manually editing /etc/default/gpsd in
Jessie. I have:

START_DAEMON="true"
GPSD_OPTIONS="-n /dev/ttyAMA0"
DEVICES=""
USBAUTO="false"
GPSD_SOCKET="/var/run/gpsd.sock"

although I've also tried:

START_DAEMON="true"
GPSD_OPTIONS="-n"
DEVICES="/dev/ttyAMA0"
USBAUTO="false"
GPSD_SOCKET="/var/run/gpsd.sock"

Where might I find gpsd.service? That's not a file I am familiar with
at all, but I'd like to check it.

David Taylor

unread,
Mar 2, 2016, 9:59:26 AM3/2/16
to
On 02/03/2016 12:22, David wrote:
[]
> Are you sure the script is being executed at start up?
>
> Perhaps include a diagnostic message output to a temporary file to confirm
> execution?
>
> Assuming you can find the script that is supposed to start the process, of
> course.
>
> Systemd joys await me shortly.
>
> Cheers
>
> Dave R

Thanks, Dave. The script is a configuration one, rather than a start-up
one - see my other post. With Jessie I have no idea where the actual
start-up script lives.

I'm trying to get this figured out so that I can put it on my Web pages
to help others.

Martin Gregorie

unread,
Mar 2, 2016, 11:50:29 AM3/2/16
to
Not having gpsd installed, I looked at crond.service to check the keynames
in the [Service] section. There were copies in /etc/systemd/system/* and /
usr/lib/systemd/system - if its not in either, try "locate gpsd.service".

For an explanation of the content of .service files, try

man 5 systemd.service

which mainly covers the [Service] section of a .service file and contains
references to other manpages which cover the contents of the [Unit] and
[Install] sections as well as other material.

One thing I should have asked earlier: what does "systemctl status gpsd"
show?

The reason I ask is that by default systemd daemons are disabled when
they're first installed - under Fedora anyway. This means that although
you can start them with 'systemctl start servicename', they will not
start automatically at boot time until you've run
"systemctl enable servicename".

This is no different from sysVinit, where you had to do exactly the same
using syscontrol whenever you installed a new daemon in order to tell it
which runlevels it should be active at.

alister

unread,
Mar 2, 2016, 12:16:23 PM3/2/16
to
most things are no controlled by the systemctl command

systemctl status <service> Show the status of service
systemctl start <service> Starts Service
systemctl stop <service> stops service
systemctl enable <service> enables service @ startup
systemctl disable <service> disables service @ startup
systemctl is-enabled <service> Checks if service is enabled or disabled

this should help with your problem (I Hope)


--
A penny saved is a penny taxed.

David Taylor

unread,
Mar 4, 2016, 11:51:00 AM3/4/16
to
Martin,

Thanks for all that! I located the service file here:

/lib/systemd/system/gpsd.service

It contains:

[Unit]
Description=GPS (Global Positioning System) Daemon
Requires=gpsd.socket

[Service]
EnvironmentFile=-/etc/default/gpsd
ExecStart=/usr/sbin/gpsd -N $GPSD_OPTIONS $DEVICES

[Install]
Also=gpsd.socket

I don't see why that wouldn't start the service, but I really know very
little at this level.

Again the issue is:

- reboot
- gpsd service does/not/ start
- run cgps and exit
- gosd service is started

It's just as if the "-n" parameter is being ignored.

Tomasz Torcz

unread,
Mar 4, 2016, 12:14:41 PM3/4/16
to
Dzieki, David, za post o tresci:
> Martin,
>
> Thanks for all that! I located the service file here:
>
> /lib/systemd/system/gpsd.service
>
> It contains:
>
> [Unit]
> Description=GPS (Global Positioning System) Daemon
> Requires=gpsd.socket
>
> [Service]
> EnvironmentFile=-/etc/default/gpsd
> ExecStart=/usr/sbin/gpsd -N $GPSD_OPTIONS $DEVICES
>
> [Install]
> Also=gpsd.socket
>
> I don't see why that wouldn't start the service, but I really know very
> little at this level.

Well, this unit file doesn't have entries required for enabling
autostart. I guess because socket-activation is used – it
means GPSD is started on-demand, when first client connects.
The appearance of ”gpsd.socket” strongly suggest so.

Following confirms that gpsd is started on client access:

> Again the issue is:
>
> - reboot
> - gpsd service does/not/ start
> - run cgps and exit
> - gosd service is started
>
> It's just as if the "-n" parameter is being ignored.

It's not ignored, gpsd is not started at boot so it
can't intepret this option or not.
Your distribution decided to configure GPSD to be started
on-demand. There is probably some reasoning for it, especially
that there are no means to easily enable on-boot GPSD startup
(using systemctl enable).
Of course you can still manually override those decisions
and start gpsd on boot by issuing:

ln -s /lib/systemd/system/gpsd.service /etc/systemd/system/multi-user.target.wants/


--
Tomasz .. oo o. oo o. .o .o o. o. oo o. ..
Torcz .. .o .o .o .o oo oo .o .. .. oo oo
o.o.o. .o .. o. o. o. o. o. o. oo .. .. o.

Martin Gregorie

unread,
Mar 4, 2016, 12:35:24 PM3/4/16
to
As I also asked, what does:

systemctl status gpsd

show? The second line of output should show something like:

Loaded: loaded (/usr/lib/systemd/system/gpsd.service; enabled; ...
=======

The word (underlined) following the pathname of the service file should
be either 'enabled' or 'disabled'. IME the latter is the initial setting
when you install a new package: not surprising really, since you usually
don't want to run a daemon before you've configured it. Anyway, once its
configured and tested using:

systemctl start/stop/status gpsd

commands and you're happy with what its doing, then you leave gpsd
running and execute:

systemctl enable gpsd

to tell systemd that from now on this service/daemon should be started
when the system is (re)booted. This applies to any and all daemons you
want to have running all the time. Needless to say, if you no longer want
the daemon to start automatically, prevent it being started on boot-up
with:

systemctl disable gpsd

David Taylor

unread,
Mar 5, 2016, 3:58:23 PM3/5/16
to
On 04/03/2016 17:14, Tomasz Torcz wrote:
[]
> It's not ignored, gpsd is not started at boot so it
> can't intepret this option or not.
> Your distribution decided to configure GPSD to be started
> on-demand. There is probably some reasoning for it, especially
> that there are no means to easily enable on-boot GPSD startup
> (using systemctl enable).
> Of course you can still manually override those decisions
> and start gpsd on boot by issuing:
>
> ln -s /lib/systemd/system/gpsd.service /etc/systemd/system/multi-user.target.wants/

Thanks for that, Tomasz, works perfectly.

Martin, apologies for not answering the status question. I'm afraid I
can't now recall what the status was, but I now get a multi-line output.
Previously it was a single word.

I do appreciate everyone's help, and this is now written up on my Web
site for anyone to use.

markall...@gmail.com

unread,
Mar 5, 2016, 9:34:21 PM3/5/16
to
David,

Thank you so very much for your web site. It worked great for me over the past couple of days as I built a RPi with Adafruit GPS Hat -- except for starting gpsd on boot.

I finally found that running the following command from the "start)" section of /etc/init.d/ntp did the trick:

gpspipe -d -r -l -n 1 -o /dev/null

It waits 10 seconds, then accesses gpsd to read one NEMA sentence, then exits.

Seems to work, but is a bit of a kludge. I like the solution posted by Tomasz Torc much better.

Again, thanks for your great web site.

Tomasz Torc -- thanks for your solution!

Mark
0 new messages