Page 1 of 1

Cat reads UART but not GPSD, UBlox Arch Linux

Posted: Thu Dec 19, 2013 11:50 pm
by alexellis
I'm using Arch Linux on a rev 1 model B with a Ublox GPS chip connected to the pins on a breakout board.

I can cat /dev/ttyAMA0 and this gives me lots of NMEA type strings and I have a flashing LED. However as soon as I launch GPSD in debug mode I get errors which I have included below.

Code: Select all

gpsd -b -N -D 3 /dev/ttyAMA0 -n -F /var/run/gpsd.sock
gpsd:INFO: launching (Version 3.9)
gpsd:ERROR: can't create IPv6 socket
gpsd:INFO: listening on port gpsd
gpsd:INFO: NTPD ntpd_link_activate: 1
gpsd:INFO: stashing device /dev/ttyAMA0 at slot 0
gpsd:INFO: opening read-only GPS data source type 2 and at '/dev/ttyAMA0'
gpsd:ERROR: /dev/ttyAMA0 already opened by another process
gpsd:ERROR: initial GPS device /dev/ttyAMA0 open failed
gpsd:ERROR: PPS ioctl(TIOCMIWAIT) failed: 9 Bad file descriptor
gpsd:INFO: running with effective group ID 14
gpsd:INFO: running with effective user ID 99
gpsd:INFO: startup at 2013-12-19T23:47:39.000Z (1387496859)
I then typed in gpspipe -r and got the following:

gpsd:INFO: reconnection attempt on device 0
gpsd:INFO: opening read-only GPS data source type 2 and at '/dev/ttyAMA0'
gpsd:ERROR: device open failed: Permission denied - retrying read-only
gpsd:ERROR: read-only device open failed: Permission denied
gpsd:ERROR: /dev/ttyAMA0: device activation failed.
gpsd:INFO: opening read-only GPS data source type 2 and at '/dev/ttyAMA0'
gpsd:ERROR: device open failed: Permission denied - retrying read-only
gpsd:ERROR: read-only device open failed: Permission denied
gpsd:ERROR: /dev/ttyAMA0: device activation failed.
I have tried going through the steps in several different web sites. What I am finding odd is that the cat command is giving me data with a fix, but GPSD is not working.

Any help would be appreciated.

Thanks,

Alex

Re: Cat reads UART but not GPSD, UBlox Arch Linux

Posted: Fri Dec 20, 2013 12:26 am
by DougieLawson
Try adding your gpsd userid to the dialout group.

sudo usermod -a -G dialout gpsd

Re: Cat reads UART but not GPSD, UBlox Arch Linux

Posted: Fri Oct 24, 2014 11:14 am
by wb2ifs
sudo usermod -a -G dialout gpsd
gave me unknown user errors

I got better results with gpspipe -r when I did

Code: Select all

sudo usermod -a -G dialout pi
but "cgps -s" still gives "NO FIX" even though "gpspipe -r" shows sentences :(

Re: Cat reads UART but not GPSD, UBlox Arch Linux

Posted: Fri Oct 24, 2014 11:59 am
by wb2ifs
I was able to get cgps to work :) after doing a

Code: Select all

sudo dpkg-reconfigure gpsd
as described here http://savannah.nongnu.org/bugs/?40299 but I had to run

Code: Select all

sudo service ntp restart
after reboot. Will I have to restart ntp after every reboot? :? I hope not. My research continues... :ugeek:

Re: Cat reads UART but not GPSD, UBlox Arch Linux

Posted: Fri Oct 24, 2014 2:06 pm
by wb2ifs
By the way, I've been following these instructions https://learn.adafruit.com/adafruit-ult ... rything-up and I noticed that they recommend restarting gpsd to get cgps to work. In my case, I have to restart ntp as previously indicated, restarting gpsd doesn't work.

Re: Cat reads UART but not GPSD, UBlox Arch Linux

Posted: Sat Jan 30, 2016 12:30 pm
by screspo
Hi,

I had a similar problem, got information with cat from the ttyAMA0 (cat /dev/ttyAMA0), even gps information using gpsmon /dev/ttyAMA0 but could not make gpsd working nor cgps -s receiving information.

I fixed it uninstalling the gpsd using this command:

sudo apt-get purge gpsd

Then reinstalling it fresh:

sudo apt-get install gpsd gpsd-clients python-gps

And then making sure that /etc/default/gpsd looked like this (you can edit it with sudo nano /etc/default/gpsd )

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

did a reboot and got it working instantly.

I hope it helps.

Hasta pronto,

Santi

Re: Cat reads UART but not GPSD, UBlox Arch Linux

Posted: Thu Dec 07, 2017 10:33 am
by mshock
Hello!
I've got the same problem... :-(

I use u-blox NEO-6Mv2 GPS module connected to GPIO (VCC to pin 1, TX to pin 10, RX to pin 8, Gnd to Pin 6) of Raspberry Pi Zero Wireless.
I installed gpsd and clients. /etc/default/gpsd configuration file is the following

Code: Select all

START_DAEMON="true"
USBAUTO="true"
DEVICES="/dev/ttyAMA0"
GPSD_OPTIONS="-n"
GPSD_SOCKET="/var/run/gpsd.sock"
sudo cat /dev/ttyAMA0 shows the stream of NMEA text messages.

But cgps -s shows the STATUS:NOFIX and reports the error:

Code: Select all

cgps: GPS timeout
Then I stoped gpsd by sudo service gpsd stop and ran it manually with debugging output by
sudo gpsd /dev/ttyAMA0 -b -n -N -D3 -F /var/run/gpsd.sock
Running cgps -s results the same "GPS timeout" error and GPSD output says:

Code: Select all

gpsd:INFO: launching (Version 3.11)
gpsd:ERROR: can't create IPv6 socket
gpsd:INFO: listening on port gpsd
gpsd:INFO: stashing device /dev/ttyAMA0 at slot 0
gpsd:INFO: opening read-only GPS data source type 2 and at '/dev/ttyAMA0'
gpsd:ERROR: /dev/ttyAMA0 already opened by another process
gpsd:ERROR: initial GPS device /dev/ttyAMA0 open failed
gpsd:INFO: running with effective group ID 20
gpsd:INFO: running with effective user ID 110
gpsd:INFO: startup at 2017-12-07T09:53:10.000Z (1512640390)
gpsd:CLIENT: => client(0): {"class":"VERSION","release":"3.11","rev":"3.11-3","proto_major":3,"proto_minor":9}\x0d\x0a
gpsd:INFO: reconnection attempt on device 0
gpsd:INFO: opening read-only GPS data source type 2 and at '/dev/ttyAMA0'
gpsd:ERROR: device open failed: Permission denied - retrying read-only
gpsd:ERROR: read-only device open failed: Permission denied
gpsd:ERROR: /dev/ttyAMA0: device activation failed.
gpsd:CLIENT: <= client(0): ?WATCH={"enable":true,"json":true};\x0a
gpsd:INFO: opening read-only GPS data source type 2 and at '/dev/ttyAMA0'
gpsd:ERROR: device open failed: Permission denied - retrying read-only
gpsd:ERROR: read-only device open failed: Permission denied
gpsd:ERROR: /dev/ttyAMA0: device activation failed.
gpsd:CLIENT: => client(0): {"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/ttyAMA0"}]}\x0d\x0a{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}\x0d\x0a
gpsd:INFO: detaching 127.0.0.1 (sub 0, fd 6) in detach_client
gpsd:INFO: reconnection attempt on device 0
gpsd:INFO: opening read-only GPS data source type 2 and at '/dev/ttyAMA0'
gpsd:ERROR: device open failed: Permission denied - retrying read-only
gpsd:ERROR: read-only device open failed: Permission denied
gpsd:ERROR: /dev/ttyAMA0: device activation failed.
It shows that "gpsd" failed to open /dev/ttyAMA0 with UID=110(gpsd) and GID=20(dialout)

ls -l /dev/ttyAMA0 shows that RW rights are really granted only to the group with GID=5(tty).

Code: Select all

crw-rw---- 1 root tty 204,    64 Dec  7 14:40 /dev/ttyAMA0
It's strange that "gpsd" uses GID=20 because earlier I've assigned the "tty"(5) group as the default group for the "gpsd" user:
id gpsd

Code: Select all

uid=110(gpsd) gid=5(tty) groups=5(tty),20(dialout)
SECURITY AND PERMISSIONS ISSUES section of man gpsd says:

Code: Select all

gpsd must start up as root in order to open the NTPD shared-memory segment, open its logfile, and create its local control socket. Before doing any processing of GPS data, it tries to drop root privileges by setting its UID to "nobody" (or another configured userid) and its group ID to the group of the initial GPS passed on the command line — or, if that device doesn't exist, to the group of /dev/ttyS0.
But ls -l /dev/ttyS0 says "ttyS0" has the same "tty" group as "ttyAMA0":

Code: Select all

crw-rw---- 1 root tty 4, 64 Dec  7 15:14 /dev/ttyS0
Running "gpsd" with the forced "tty" group sudo -g tty gpsd /dev/ttyAMA0 -b -n -N -D3 -F /tmp/gpsd.sock results in the same permission error:

Code: Select all

gpsd:INFO: launching (Version 3.11)
gpsd:ERROR: can't create IPv6 socket
gpsd:INFO: listening on port gpsd
gpsd:INFO: stashing device /dev/ttyAMA0 at slot 0
gpsd:INFO: opening read-only GPS data source type 2 and at '/dev/ttyAMA0'
gpsd:ERROR: device open failed: Permission denied - retrying read-only
gpsd:ERROR: read-only device open failed: Permission denied
gpsd:ERROR: initial GPS device /dev/ttyAMA0 open failed
gpsd:INFO: running with effective group ID 5
gpsd:INFO: running with effective user ID 1000
gpsd:INFO: startup at 2017-12-07T12:06:28.000Z (1512648388)
gpsd:CLIENT: => client(0): {"class":"VERSION","release":"3.11","rev":"3.11-3","proto_major":3,"proto_minor":9}\x0d\x0a
gpsd:INFO: reconnection attempt on device 0
gpsd:INFO: opening read-only GPS data source type 2 and at '/dev/ttyAMA0'
gpsd:ERROR: device open failed: Permission denied - retrying read-only
gpsd:ERROR: read-only device open failed: Permission denied
gpsd:ERROR: /dev/ttyAMA0: device activation failed.

Re: Cat reads UART but not GPSD, UBlox Arch Linux

Posted: Thu Dec 07, 2017 10:36 am
by mshock
One more strange thing:
After stopping sudo service gpsd stop
ls -l /dev/ttyAMA0 says the serial port is only Writable for the "tty" group:

Code: Select all

crw--w---- 1 root tty 204, 64 Dec  7 15:31 /dev/ttyAMA0
And after starting sudo service gpsd start
ls -l /dev/ttyAMA0 says the serial port has RW permissions for the "tty" group:

Code: Select all

crw-rw---- 1 root tty 204, 64 Dec  7 15:31 /dev/ttyAMA0
But cgps still fails with "GPS timeout" error!