Github messages for voidlinux
 help / color / mirror / Atom feed
From: SorrelArticulata <SorrelArticulata@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [ISSUE] gpsd: Permission issues, does not work on USB serial GPS sources without manual chmod
Date: Wed, 30 Nov 2022 12:59:16 +0100	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-40858@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 2626 bytes --]

New issue by SorrelArticulata on void-packages repository

https://github.com/void-linux/void-packages/issues/40858

Description:
### Is this a new report?

Yes

### System Info

Void 5.19.17_1 x86_64 GenuineIntel uptodate rFFFFFFFFFFF

### Package(s) Affected

gpsd-3.24_2

### Does a report exist for this bug with the project's home (upstream) and/or another distro?

_No response_

### Expected behaviour

1. Plug in USB GPS source (mine is a u-blox 7)
2. Verify it works and has a GPS lock using gpsmon as root.  This tool directly talks to the GPS device rather than needing gpsd to be working.

``` # gpsmon /dev/ttyACM0 ```

3. Stop gpsmon

4. Start gpsd daemon in one terminal (as root, with verbose debugging flags like this)

```# gpsd -N -F /run/gpsd.sock -D5 /dev/ttyACM0```

5. Run cgps (or any other gps client) in another terminal.  This will talk to gpsd and (if everything is working) give you similar output to what gpsmon did.

``` $ cgps ```

### Actual behaviour

cgps fails to see any data and gpsd spits the following errors:

```
gpsd:PROG: CORE: gpsd_open(/dev/ttyACM0) fd -1
gpsd:PROG: SER: gpsd_serial_open(/dev/ttyACM0) sourcetype 12 fd -1
gpsd:INFO: SER: opening GPS data source type 12 at '/dev/ttyACM0'
gpsd:ERROR: SER: device open of /dev/ttyACM0 failed: Permission denied(13) - retrying read-only
gpsd:ERROR: SER: read-only device open of /dev/ttyACM0 failed: Permission denied(13)
gpsd:ERROR: /dev/ttyACM0: device activation failed, freeing device.
```

Looking at the running process list reveals that the gpsd process has changed to the 'gpsd' user. 

Permissions for the serial device:
```
$ ls -lh /dev/ttyACM0 
crw-rw---- 1 root dialout 166, 0 Nov 30 22:38 /dev/ttyACM0
```

Adding the gpsd user to the dialout group does NOT fix the problem.

Allowing anyone rw access to the serial device DOES fix the problem temporarily
```
# chmod a+x /dev/ttyACM0
```

According to the gpsd manpage:

>       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.

I do not understand how processes can have group ids, but regardless this feature does not seem to be working as intended.

The srcpkg template has this line in it, not sure if it is related to this problem or not:

```make_build_args="dbus_export=0 gpsd_user=gpsd gpsd_group=gpsd```



### Steps to reproduce

See above.

             reply	other threads:[~2022-11-30 11:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30 11:59 SorrelArticulata [this message]
2022-11-30 12:10 ` gpsd: User/group/permission " SorrelArticulata
2022-11-30 12:15 ` SorrelArticulata
2022-11-30 12:16 ` SorrelArticulata
2022-11-30 15:03 ` sgn
2022-11-30 20:27 ` SorrelArticulata

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-40858@inbox.vuxu.org \
    --to=sorrelarticulata@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).