5

I am trying to figure out, what is preventing gpsd from automatically connecting to an external GPS BU 353 dongle via USB and receiving data. I have the same issue on both of my laptops (with different hardware), so this is purely a software configuration issue.

I have managed to get gpsd working manually, using the following steps, but every time my machine is powered off, I must go through these steps again.

  1. sudo killall gpsd

  2. Remove any sockets gpsd might have left behind with :

    sudo rm /var/run/gpsd.sock

  3. Check the device path:

    dmesg - which shows PLU353 
    
  4. Ensure no other programs are using the device. There are none listed

    lsof -n | grep /dev/ttyUSB0
    
  5. Manually launch gpsd:

    sudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock
    
  6. xgps sees the GPS output - so this works

My best guesses are that gpsd needs to join a group or be given additional permissions, or alternatively, that it is an issue with udev configuration. But I am blundering about in the dark, just making wild guesses.

3
  • Rather than lsof -n | grep /dev/ttyUSB0, I'd use sudo lsof /dev/ttyUSB0 - no need to grep
    – waltinator
    Feb 24, 2019 at 15:18
  • 1
    Possible duplicate of How do I allow non-root access to /ttyUSB0 on 12.04?
    – N0rbert
    Feb 24, 2019 at 15:33
  • This has 2 answers from high-reputation (~20k) users, and it still hasn't been edited! Guys - tidy it up when you answer, it's a key part of keeping this site high-quality! @waltinator, remember to try to fix everything in the question when you edit it!
    – Tim
    Feb 24, 2019 at 20:19

2 Answers 2

8

You're correct - it is a group membership problem. First, see who owns the device:

ls -l /dev/ttyUSB0

On MY system, I don't have /dev/ttyUSB0, so I'll use /dev/ttyS0 instead

walt@bat:~(0)$ ls -l /dev/ttyS0
crw-rw---- 1 root dialout 4, 64 Feb 23 08:19 /dev/ttyS0
walt@bat:~(0)$ 

The output of the ls command shows that it's owned by root:dialout, and allows group access to the device.

Add your user to the dialout (or whatever is right for your system) group with:

sudo adduser $USER dialout

Then to make this group membership take effect, logout/login, OR newgrp dialout to start a shell with that group membership.

Check your group membership with /usr/bin/id.

2
  • Hi Waltinator, I have run and get the same output ls -l /dev/ttyUSB0 giviing crw-rw---- 1 root dialout 188, 0 Feb 24 19:10 /dev/ttyUSB0
    – Geoffrey-c
    Feb 24, 2019 at 18:17
  • Additionally, I am in the dialout group as I just posted and I also tried adding gpsd into the dialout group as well and rebooting, but no joy
    – Geoffrey-c
    Feb 24, 2019 at 18:33
5
  • open TCP port 2947 in your firewall (if you wish other network clients access)
  • in terminal...
  • sudo adduser $USER dialout # add user to group dialout
    • log out/in to finish adduser command
  • sudo -H gedit /etc/default/gpsd # edit the gpsd settings file

# Start the gpsd daemon automatically at boot time
START_DAEMON="true"

# Use USB hotplugging to add new USB devices automatically to the daemon
USBAUTO="true"

# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
# DEVICES="/dev/ttyUSB0"
DEVICES=""

# Other options you want to pass to gpsd
GPSD_OPTIONS=""

  • save file and quit gedit
  • sudo systemctl restart gpsd # restart gpsd

gpsmon, cgps, and xgps will now work properly.

27
  • Wrong device name, and from what can be seen in first post, he doesn't have to open any ports for it to work; only re-start gpsd as root.
    – vidarlo
    Feb 24, 2019 at 15:54
  • @vidarlo fixed. Thanks! The open port IS required if you want any of the gps software to find the daemon output.
    – heynnema
    Feb 24, 2019 at 16:13
  • No, not unless you have modified /etc/ufw/before.rules, which by default allows all on lo interface. In addition, it should be noted that gpsd may use a socket as well, which does not touch the network stack at all. As I stated; in the question it works after restarting gpsd, without any modification to the firewall rules.
    – vidarlo
    Feb 24, 2019 at 16:45
  • @vidarlo ok... educate me... where is there any documentation about modifying /etc/ufw/before.rules, and what would you modify there? Also, re: tcp port... "Client applications will communicate with gpsd via a TCP/IP port, 2947 by default)".
    – heynnema
    Feb 24, 2019 at 16:55
  • /etc/ufw/before.rules contains iptables rules that are applied before any user rules in UFW. man ufw shows some information. You do not need to modify anything there, as all traffic over loopback is allowed by default rule set. Communication with gpsd running on the same machine happens either via socket or loopback, both which bypass any firewall rules. Again, please read the question; he gets it working witout modifying firewall rules. It is a device permission problem. If you come by chat I'll elaborate.
    – vidarlo
    Feb 24, 2019 at 17:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .