gpsd-users
[Top][All Lists]
Advanced

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

Re: GPS Mac OS challenges


From: Marc Rosen
Subject: Re: GPS Mac OS challenges
Date: Thu, 9 Dec 2021 17:54:19 -0600

14” MBP M1 Pro running Mac OS v12.0

the version of brew is:

Homebrew/homebrew-core (git revision 4568016b7c0; last commit 2021-12-05)

versions of gpsd & ntp:

Marcs-2020-MacBook-Pro-2:Cellar marc$ ls gpsd/
3.23.1
Marcs-2020-MacBook-Pro-2:Cellar marc$ ls ntp
4.2.8p15
Marcs-2020-MacBook-Pro-2:Cellar marc$ 


When the system restarts:

kern.sysv.shmall: 25600
kern.sysv.shmmax: 52428800
kern.sysv.shmmin: 1
kern.sysv.shmmni: 32
kern.sysv.shmseg: 8

gpsd:ERROR: shmat failed: Too many open files

afterwards there are 8 shared memory segments present


when I run this command and retry gpsd ( after removing existing segments) that error goes away

sudo  sysctl  -w  kern.sysv.shmseg=32
kern.sysv.shmseg: 8 -> 32

there are now 9 shared memory segments present  ( running gpsd as root)

When I restart the laptop - the shmem change reverts

when I run gpsd as root - I get a warning to run it as user from user space/login

when I run it as user - it opens 7 shared memory segments, then running ntpd as root opens 2 more

either way I get a permission denied error running ntpshmmon ( either as user or root)

there was one time when I did not see this error - not sure what was different

Marcs-2020-MacBook-Pro-2:ntp marc$ ntpshmmon
WARNING: could not open SHM(0): Permission denied(13)
WARNING: could not open SHM(1): Permission denied(13)
ntpshmmon: version 3.23.1
#      Name  Seen@                 Clock                 Real                 L Prc

* Running ntpshmmon as root gives this error:

Marcs-2020-MacBook-Pro-2:bin marc$ sudo ntpshmmon
Password:
WARNING: could not open SHM(0): Permission denied(13)
WARNING: could not open SHM(1): Permission denied(13)
ntpshmmon: version 3.23.1
#      Name  Seen@                 Clock                 Real                 L Prc


marc$ ntpshmmon -V
ntpshmmon: version 3.23.1 (revision 3.23.1)

ntpd - NTP daemon program - Ver. 4.2.8p15


*************************** gpsdebuginfo (gpsd as user, ntpd as root, started from rebooted Mac with shared mem segs increased to 32

++ id -u
+ '[' 0 '!=' 0 ']'
+ id
uid=0(root) gid=0(wheel) groups=0(wheel),1(daemon),2(kmem),3(sys),4(tty),5(operator),8(procview),9(procmod),12(everyone),20(staff),29(certusers),61(localaccounts),80(admin),33(_appstore),98(_lpadmin),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae)
+ uname -a
Darwin Marcs-2020-MacBook-Pro-2.local 21.0.1 Darwin Kernel Version 21.0.1: Tue Sep 14 20:56:24 PDT 2021; root:xnu-8019.30.61~4/RELEASE_ARM64_T6000 arm64
+ cat '/etc/*release'
cat: /etc/*release: No such file or directory
+ command -v gpsd
/opt/homebrew/sbin/gpsd
+ gpsd -V
gpsd: 3.23.1 (revision 3.23.1)
+ gpsd -h
+ grep '^#.*enabled'
# Control socket for hotplug notifications enabled.
# Netfeed enabled.
# NTRIP enabled.
# Shared memory export enabled.
# Socket export enabled.
+ command -v sockstat
+ command -v lsof
/usr/sbin/lsof
+ lsof -iTCP:2947 -s TCP:LISTEN
COMMAND PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
gpsd    958 marc    4u  IPv4 0x6a723775c2bd8313      0t0  TCP localhost:gpsd (LISTEN)
gpsd    958 marc    5u  IPv6 0x6a723775b9f54bdb      0t0  TCP localhost:gpsd (LISTEN)
+ lsof -c gpsd
+ sed -nE '1p;/CHR|LISTEN/p'
COMMAND PID USER   FD   TYPE             DEVICE SIZE/OFF                NODE NAME
gpsd    958 marc    0u   CHR               16,0 0t207248                1217 /dev/ttys000
gpsd    958 marc    1u   CHR               16,0 0t207248                1217 /dev/ttys000
gpsd    958 marc    2u   CHR               16,0 0t207248                1217 /dev/ttys000
gpsd    958 marc    4u  IPv4 0x6a723775c2bd8313      0t0                 TCP localhost:gpsd (LISTEN)
gpsd    958 marc    5u  IPv6 0x6a723775b9f54bdb      0t0                 TCP localhost:gpsd (LISTEN)
gpsd    958 marc    6u   CHR                9,1  0t30673                1199 /dev/cu.usbmodem1203
+ ps ax
+ sed -nE '1p;/gpsd/p'
  PID   TT  STAT      TIME COMMAND
  958 s000  S+     0:00.13 gpsd -n /dev/cu.usbmodem1203 -ND4 -F /opt/homebrew/var/gpsd.sock
 1039 s002  S+     0:00.01 sudo ./gpsdebuginfo
 1040 s002  S+     0:00.00 /bin/sh ./gpsdebuginfo
 1054 s002  S+     0:00.00 sed -nE 1p;/gpsd/p
+ command -v gpspipe
/opt/homebrew/bin/gpspipe
+ gpspipe -V
gpspipe: 3.23.1 (revision 3.23.1)
+ gpspipe -w -n 2 -x 20
{"class":"VERSION","release":"3.23.1","rev":"3.23.1","proto_major":3,"proto_minor":14}
{"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/cu.usbmodem1203","driver":"NMEA0183","activated":"2021-12-09T23:50:01.947Z","flags":1,"native":0,"bps":57600,"parity":"N","stopbits":2,"cycle":1.00}]}
+ command -v ipcs
/usr/bin/ipcs
+ ipcs -m
+ sed -nE '/key/p;/KEY/p;/0x4e5450/p'
T     ID     KEY        MODE       OWNER    GROUP
m  65536 0x4e545032 --rw-rw-rw-     marc    staff
m  65537 0x4e545033 --rw-rw-rw-     marc    staff
m  65538 0x4e545034 --rw-rw-rw-     marc    staff
m  65539 0x4e545035 --rw-rw-rw-     marc    staff
m  65540 0x4e545036 --rw-rw-rw-     marc    staff
m  65541 0x4e545037 --rw-rw-rw-     marc    staff
m  65543 0x4e545030 --rw-------     root    wheel
m  65544 0x4e545031 --rw-------     root    wheel
+ command -v ntpshmmon
/opt/homebrew/bin/ntpshmmon
+ ntpshmmon -V
ntpshmmon: version 3.23.1 (revision 3.23.1)
+ ntpshmmon -n 6 -t 10
WARNING: could not open SHM(0): Permission denied(13)
WARNING: could not open SHM(1): Permission denied(13)
ntpshmmon: version 3.23.1
#      Name  Seen@                 Clock                 Real                 L Prc

****************************************


On Dec 6, 2021, at 1:54 PM, Gary E. Miller <gem@rellim.com> wrote:

Yo Marc!

On Mon, 6 Dec 2021 10:42:05 -0600
Marc Rosen <marc.rosen@mac.com> wrote:

I'm most of the way done connecting my GPS to my MBP OS X Monterrey ,
that's to persistence and some help from Gary Miller

Should be nothing ahrd about that.

In the end I'm using homebrew (package) versions of ntp and gpsd.

What versions?


The
GPS is from an Icom IC-705 radio.


That's a new one.  I assume it sends standard NMEA?

The main difficulties were setting
the correct serial/usb device for the GPS to connect to ,

I'm not sure that is hard.  Just put the device path on the
gpsd command line.

increasing
the shared memory,

I'm not sure why you would need that.

and dealing with Mac env restrictions

I'm not sure why you would need that.

I still can't get ntpshmemmon to run properly- permission denied to
connect to SHM1&2 Everything is running from sudo/root

I've never had that problem on a mac.  Maybe some new Apple specific
hardening.

Any solutions?

Can it work?  Yes.  Do I understand your problem?  No.

cgps shows great data

Good.

ntpq -p shows the GPS data updating ( no PPS)

You are skipping a lot of dettails.  Please rung gpsdebuginfo and
send the output here.

In general, if ntpshmmon is not working, you can stop right that and
not look at anything else NTP.

One question is how to test it properly

Run gpsdebuginfo, and send the result herre.  Also try the
Toubleshooting Guide:

   https://gpsd.io/troubleshooting.html

I want the Mac system clock to rely on the gps

No, you want it to rely on ntpd, which may rely on GPS for part if
its data.

I tried setting the date time system prefs to use 127.0.0.1 ,

No, you want ntpd to control your system time, not macOS.

the
turning off WiFi and resetting the clock manually then restore to
automatically w 127.0.0.1 - not sure this is working right

If that is what you are doing, that is wrong.

Any suggestions for testing?

See above.

Does anyone know if PPS is supported by the Radio?

Probably not, but the output of "-ND 4" that I already asked for
would tell you.

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


reply via email to

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