Community Packages

Please read this before reporting a bug:
http://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#53651 - [gpsd] Problems with service file and GPS devices with PPS

Attached to Project: Community Packages
Opened by Oscar Garcia (ogarcia) - Wednesday, 12 April 2017, 12:16 GMT
Last edited by Eli Schwartz (eschwartz) - Thursday, 03 August 2017, 19:52 GMT
Task Type Bug Report
Category Packages
Status Assigned
Assigned To Jaroslav Lichtblau (Dragonlord)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

I found two small issues with this package.

The first one is that in gpsd.service there is a line that says `After=chronyd.service`, this line must be `After=chrony.service` cause in archlinux the chrony unit is chrony.service. I think that this can be fixed with a simple sed in prepare:

# fix service
sed -i "s/After=chronyd.service/After=chrony.service/" \
systemd/gpsd.service

The second one is that if you have a GPS device with PPS, the /dev/pps0 can only be readed by root. If you make package with `gpsd_group=uucp` then gpsd cannot read the ppps device. The posible solutions for this is build package with `gpsd_group=root` or (I don't know if can make this) build kernel module to make /dev/pps0 device be owned by uucp group.
This task depends upon

Comment by Antonio Rojas (arojas) - Tuesday, 11 July 2017, 14:22 GMT
The first issue is in chrony IMO. The service file should be called chronyd, and in fact it ships an example service file with that name. The package should use that one instead of a custom one.
Comment by Oscar Garcia (ogarcia) - Tuesday, 11 July 2017, 14:31 GMT
Then the first issue must be fixed by @spupykin and post an update in Arch Linux news that warning about this change.
Comment by Oscar Garcia (ogarcia) - Saturday, 21 April 2018, 09:23 GMT
Any new about this? The package is still using `gpsd_group=uucp` and the device /dev/pps0 still have only root permissions (crw-rw---- 1 root root 243, 0 Apr 13 04:25 /dev/pps0). Is annoying have to rebuild this package in every update for this misconfiguration.
Comment by loqs (loqs) - Sunday, 22 April 2018, 19:36 GMT
What method are you currently using to resolve the issue?
Have you tried a udev rule that changes the group of /dev/pps0 to uucp?
Comment by Oscar Garcia (ogarcia) - Monday, 23 April 2018, 08:03 GMT
In my case the only method to get it to work is set gpsd_group=root in the buildtime. Seems that change permissions of device has no effect even using an udev rule:

$ cat /etc/udev/rules.d/50-gpsd.rules
KERNEL=="pps[0-9]*", GROUP="uucp"
$ ls -l /dev/pps0
crw-rw---- 1 root uucp 243, 0 Apr 13 04:25 /dev/pps0
$ id
uid=1000(ogarcia) gid=1000(ogarcia) groups=1000(ogarcia),10(wheel),14(uucp)
$ ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
cannot set parameters (Operation not permitted)

But with root:
$ sudo ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1524469971.000791567, sequence: 118 - clear 0.000000000, sequence: 0
source 0 - assert 1524469972.000794652, sequence: 119 - clear 0.000000000, sequence: 0
source 0 - assert 1524469973.000794737, sequence: 120 - clear 0.000000000, sequence: 0
...
Comment by loqs (loqs) - Monday, 23 April 2018, 13:21 GMT
What version of gpsd generated the ppstest you use as the messages the current git repo ppscheck.c http://git.savannah.gnu.org/cgit/gpsd.git/tree/ppscheck.c#n100 and
http://git.savannah.gnu.org/cgit/gpsd.git/tree/ppscheck.c#n109 should print do not match, they seem to match https://lwn.net/Articles/240153/
The output would indicate the permissions are enough to access the device but not to use iocontrol on it. (possibly needs CAP_SYS_ADMIN)
http://git.savannah.gnu.org/cgit/gpsd.git/tree/gpsd.c#n2118 the current git version shows awareness of the privilege issue and performing required operations before dropping caps.
Comment by Oscar Garcia (ogarcia) - Monday, 23 April 2018, 17:34 GMT
The ppstest is an example and may be have an issue, is pps-tools-1.0.
But with only gpsd latest package (pps-tools is not needed here) if I run gpsmon the PPS label shows nothing, but it I recompile package with gpsd_group=root and run gpsmon the PPS shows info.

Using the default package and fixing permissions to uucp to /dev/pps0:
│14 124 144 37 0 0110 │┌─────────────────────────────────────────────────┐
│15 126 139 35 0 0110 ││TOFF: 0.142412489 PPS: │
└────── NAV_SVINFO ────────┘└─────────────────────────────────────────────────┘

Using a rebuilded version with gpsd_group=root:
│14 124 144 37 0 0110 │┌─────────────────────────────────────────────────┐
│15 126 139 35 0 0110 ││TOFF: 0.154153138 PPS: 0.000001209 │
└────── NAV_SVINFO ────────┘└─────────────────────────────────────────────────┘
Comment by loqs (loqs) - Monday, 23 April 2018, 22:12 GMT
I would contact upstream about the issue as I mentioned the code appears to try and do all operations that require root privileges before dropping them.
Your tests show an obvious difference between root and none root use so something is being restricted.
http://www.catb.org/gpsd/faq.html#support
http://www.catb.org/gpsd/faq.html#bug-reporting
Comment by Ivy Foster (escondida) - Thursday, 10 October 2019, 22:09 GMT
Current chrony fixes the first issue; does the second still apply? If so, it does seem like more of an upstream problem.

Loading...