Github messages for voidlinux
 help / color / mirror / Atom feed
* [ISSUE] gpsd: Permission issues, does not work on USB serial GPS sources without manual chmod
@ 2022-11-30 11:59 SorrelArticulata
  2022-11-30 12:10 ` gpsd: User/group/permission " SorrelArticulata
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: SorrelArticulata @ 2022-11-30 11:59 UTC (permalink / raw)
  To: ml

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gpsd: User/group/permission issues, does not work on USB serial GPS sources without manual chmod
  2022-11-30 11:59 [ISSUE] gpsd: Permission issues, does not work on USB serial GPS sources without manual chmod SorrelArticulata
@ 2022-11-30 12:10 ` SorrelArticulata
  2022-11-30 12:15 ` SorrelArticulata
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: SorrelArticulata @ 2022-11-30 12:10 UTC (permalink / raw)
  To: ml

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

New comment by SorrelArticulata on void-packages repository

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

Comment:
It looks like gpsd is changing to user 'gpsd' and group 'gpsd'; instead of user 'gpsd' and group 'dialout' (group of provided special serial file).  This does not match what the manpage says and is probably the cause of the issue here.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gpsd: User/group/permission issues, does not work on USB serial GPS sources without manual chmod
  2022-11-30 11:59 [ISSUE] gpsd: Permission issues, does not work on USB serial GPS sources without manual chmod SorrelArticulata
  2022-11-30 12:10 ` gpsd: User/group/permission " SorrelArticulata
@ 2022-11-30 12:15 ` SorrelArticulata
  2022-11-30 12:16 ` SorrelArticulata
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: SorrelArticulata @ 2022-11-30 12:15 UTC (permalink / raw)
  To: ml

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

New comment by SorrelArticulata on void-packages repository

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

Comment:
It looks like gpsd is changing to user 'gpsd' and group 'gpsd'; instead of user 'gpsd' and group 'dialout' (group of provided special serial file).  This does not match what the manpage says and is probably the cause of the issue here.

You can confirm this by (1) looking at the output of gpsd with verbose flags and then (2) checking the user/groupids with getend:
```
...
gpsd:INFO: running with effective group ID 977
gpsd:INFO: running with effective user ID 981
...
```
```
$ getent group 977
gpsd:x:977:
$ getent passwd 981
gpsd:x:981:977:gpsd unprivileged user:/var/empty:/sbin/nologin
```

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gpsd: User/group/permission issues, does not work on USB serial GPS sources without manual chmod
  2022-11-30 11:59 [ISSUE] gpsd: Permission issues, does not work on USB serial GPS sources without manual chmod SorrelArticulata
  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
  4 siblings, 0 replies; 6+ messages in thread
From: SorrelArticulata @ 2022-11-30 12:16 UTC (permalink / raw)
  To: ml

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

New comment by SorrelArticulata on void-packages repository

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

Comment:
It looks like gpsd is changing to user 'gpsd' and group 'gpsd'; instead of user 'gpsd' and group 'dialout' (group of provided special serial file).  This does not match what the manpage says and is probably the cause of the issue here.

You can confirm this by (1) looking at the output of gpsd with verbose flags and then (2) checking the user/groupids with getent:
```
...
gpsd:INFO: running with effective group ID 977
gpsd:INFO: running with effective user ID 981
...
```
```
$ getent group 977
gpsd:x:977:
$ getent passwd 981
gpsd:x:981:977:gpsd unprivileged user:/var/empty:/sbin/nologin
```

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gpsd: User/group/permission issues, does not work on USB serial GPS sources without manual chmod
  2022-11-30 11:59 [ISSUE] gpsd: Permission issues, does not work on USB serial GPS sources without manual chmod SorrelArticulata
                   ` (2 preceding siblings ...)
  2022-11-30 12:16 ` SorrelArticulata
@ 2022-11-30 15:03 ` sgn
  2022-11-30 20:27 ` SorrelArticulata
  4 siblings, 0 replies; 6+ messages in thread
From: sgn @ 2022-11-30 15:03 UTC (permalink / raw)
  To: ml

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

New comment by sgn on void-packages repository

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

Comment:
Switch `gpsd` to run with group `dialout` instead of `gpsd` would work, but I don't think it's a correct thing to do.
I **think** you should either `chown gpsd /dev/ttyACM0` or `chgrp gpsd /dev/ttyACM0` before running gpsd.
I don't really know about `gpsd`, just a pure guess.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: gpsd: User/group/permission issues, does not work on USB serial GPS sources without manual chmod
  2022-11-30 11:59 [ISSUE] gpsd: Permission issues, does not work on USB serial GPS sources without manual chmod SorrelArticulata
                   ` (3 preceding siblings ...)
  2022-11-30 15:03 ` sgn
@ 2022-11-30 20:27 ` SorrelArticulata
  4 siblings, 0 replies; 6+ messages in thread
From: SorrelArticulata @ 2022-11-30 20:27 UTC (permalink / raw)
  To: ml

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

New comment by SorrelArticulata on void-packages repository

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

Comment:
According to the gpsd manpage: it should be automatically setting its own group to dialout when you provide it a device node (eg /dev/ttyACM0) that has the group dialout.  Something in the default application behavior is being overridden.

N.B. the manpage makes no mention of the group 'gpsd'.  That might be unique to the packaging here.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-30 20:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30 11:59 [ISSUE] gpsd: Permission issues, does not work on USB serial GPS sources without manual chmod SorrelArticulata
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

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