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

Re: systemd gpsd does not start on boot



Am 25.10.2015 um 12:59 schrieb Philippe Clérié:
> On 10/23/2015 05:33 PM, Philippe Clérié wrote:
>> I'm running raspbian jessy on a rpi2 with an Adafruit GPS board. Gpsd
>> refuses to load on boot, but works just fine on manual start.
>>
>> I am not yet familiar with systemd. Even if I've had to dig a bit to try
>> to understand how it works I'm still stumped at the moment, so I don't
>> know if there's a bug or I am doing something wrong.
>>
>> There are 3 systemd units related to gpsd in /lib/systemd/system.
>>
>> gpsd.service
>> gpsd.socket
>> gpsdctl@.service
>>
>> My (weak) understanding is that systemd will start .socket which in turn
>> will launch .service. That does not seem to be happening.

Well, was there actually a request over the socket /var/run/gpsd.sock
which would trigger the start of the service?

If there is no such request from a client, the service will not be
started. The maintainer of gpsd apparently has setup gpsd so it is
started on-demand and apparently there is no demand from a client.


> For what it's worth:
> 
> Edit /lib/systemd/system/gpsd.service:
> 
> [Install]
> + WantedBy=multi-user.target
> Also=gpsd.socket
> 
> Then:
> 
> sudo systemctl enable gpsd.service
> sudo reboot
> 
> And gpsd gets loaded.
> 
> I don't know if it is the correct fix but that seems to work.
> 


Editing files in /lib/systemd/system/gpsd.service is not a good idea,
since they will be overwritten on the next package update.

It's better to make a copy of that file as
/etc/systemd/system/gpsd.service and make your changes there, or simply
extend the service file with the desired changes using a drop-in snippet:

mkdir /etc/systemd/system/gpsd.service.d/
echo -e "[Install]\nWantedBy=multi-user.target" >
/etc/systemd/system/gpsd.service.d/local.conf

You can pick the names of that conf file as you like.

systemd in testing/unstable has a nice shortcut here:
Try systemctl edit foo.service (creates a drop-in in /etc)
or systemctl edit --full foo.service (creates a full copy in /etc)


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: