Closed Astro-Otter-Space closed 1 year ago
If you run this:
hamham@astroloutre:~/www/virtualgps$ sudo systemctl restart virtualgps.service
hamham@astroloutre:~/www/virtualgps$ sudo -u gpsd python3 virtualgps.py
you obviously get error because after the first command the script is running as a service and /tmp/vgps exists. That's why the second command complaints about it. No compaints means everything is ok, so #nothing means OK. Stop the service, remove the file, start the service, check service status, run gpsmon or cgps and check your virtual location.
Here's what i have doing following your instructions after boot my rpi :
# stop service
hamham@astroloutre:~$ sudo systemctl stop virtualgps.service
# delete /tmp/vgps
hamham@astroloutre:~$ sudo rm /tmp/vgps
rm: cannot remove '/tmp/vgps': No such file or directory
# restart and check status
hamham@astroloutre:~$ sudo systemctl start virtualgps.service
hamham@astroloutre:~$ sudo systemctl status virtualgps.service
● virtualgps.service - Virtual GPS
Loaded: loaded (/etc/systemd/system/virtualgps.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-08-17 17:35:14 CEST; 7s ago
Process: 2534 ExecStartPost=/bin/sleep 3 (code=exited, status=0/SUCCESS)
Process: 2535 ExecStartPost=/usr/sbin/gpsdctl add /tmp/vgps (code=exited, status=0/SUCCESS)
Main PID: 2533 (python3)
Tasks: 1 (limit: 1864)
CGroup: /system.slice/virtualgps.service
└─2533 /usr/bin/python3 /usr/bin/virtualgps.py
août 17 17:35:14 astroloutre systemd[1]: Started Virtual GPS.
août 17 17:35:17 astroloutre gpsdctl[2535]: gpsd_control(action=add, arg=/tmp/vgps)
août 17 17:35:17 astroloutre gpsdctl[2535]: reached a running gpsd
Line gpsd_control(action=add, arg=/tmp/vgps)
is in red (error ?)
I'm checking if copy are OK :
hamham@astroloutre:~$ ll /usr/bin/ | grep virtualgps
-rw-r--r-- 1 root root 4576 août 10 15:16 virtualgps.py
hamham@astroloutre:~$ ll /etc/systemd/system/ | grep virtualgps
-rw-r--r-- 1 root root 380 août 10 15:16 virtualgps.service
Seems OK
I'm checking with cgps command :
┌───────────────────────────────────────────┐┌──────────────────Seen 0/Used 0┐
│ Time: n/a ││ PRN Elev Azim SNR Use │
│ Latitude: n/a ││ │
│ Longitude: n/a ││ │
│ Alt (HAE, MSL): n/a, n/a ││ │
│ Speed: n/a ││ │
│ Track (true, var): n/a deg ││ │
│ Climb: n/a ││ │
│ Status: NO FIX (0 secs) ││ │
│ Long Err (XDOP, EPX): n/a , n/a ││ │
│ Lat Err (YDOP, EPY): n/a , n/a ││ │
│ Alt Err (VDOP, EPV): n/a , n/a ││ │
│ 2D Err (HDOP, CEP): n/a , n/a ││ │
│ 3D Err (PDOP, SEP): n/a , n/a ││ │
│ Time Err (TDOP): n/a ││ │
│ Geo Err (GDOP): n/a ││ │
│ ECEF X, VX: n/a n/a ││ │
│ ECEF Y, VY: n/a n/a ││ │
│ ECEF Z, VZ: n/a n/a ││ │
│ Speed Err (EPS): n/a ││ │
│ Track Err (EPD): n/a ││ │
│ Time offset: n/a ││ │
│ Grid Square: n/a ││ │
└───────────────────────────────────────────┘└─────────────────────────────────┘
{"class":"VERSION","release":"3.20","rev":"3.20","proto_major":3,"proto_minor":14}
{"class":"DEVICES","devices":[]}
{"class":"WATCH","enable":true,"json":true,"nmea":false,"raw":0,"scaled":false,"timing":false,"split24":false,"pps":false}
and gpsmon return this :
tcp://localhost:2947 JSON slave driver>
(82) {"class":"VERSION","release":"3.20","rev":"3.20","proto_major":3,"proto_minor":14}
(32) {"class":"DEVICES","devices":[]}
(122) {"class":"WATCH","enable":true,"json":false,"nmea":false,"raw":2,"scaled":false,"timing":false,"split24":false,"pps":true}
Please run ls -al /tmp/vgps
after running sudo systemctl status virtualgps.service
and post the output here
hamham@astroloutre:~$ sudo systemctl status virtualgps.service
● virtualgps.service - Virtual GPS
Loaded: loaded (/etc/systemd/system/virtualgps.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-08-17 17:35:14 CEST; 52min ago
Main PID: 2533 (python3)
Tasks: 1 (limit: 1864)
CGroup: /system.slice/virtualgps.service
└─2533 /usr/bin/python3 /usr/bin/virtualgps.py
août 17 17:35:14 astroloutre systemd[1]: Started Virtual GPS.
août 17 17:35:17 astroloutre gpsdctl[2535]: gpsd_control(action=add, arg=/tmp/vgps)
août 17 17:35:17 astroloutre gpsdctl[2535]: reached a running gpsd
hamham@astroloutre:~$ ls -al /tmp/vgps
lrwxrwxrwx 1 gpsd dialout 10 août 17 17:35 /tmp/vgps -> /dev/pts/0
It looks like /tmp/vgps file is accessible to gpsd service but it is not addedd/recognized. Strange, I must say. What is you /etc/default/gpsd content?
hamham@astroloutre:~$ more /etc/default/gpsd
# Devices gpsd should collect to at boot time.
# They need to be read/writeable, either by user gpsd or the group dialout.
DEVICES=""
# Other options
hi! i'm not an expert but i had the same problem and i found a solution here
longstory short: using apparmor and set /usr/sbin/gpsd to complain mode
sudo apt install apparmor-profiles apparmor-utils
sudo aa-complain /PATH/TO/gpsd
please @rkaczorek check if this solution could work for everybody
It looks like apparmor prevents gpsd from accessing virtual gps device file (/tmp/vgps -> /dev/pts/[0-9])
The best way to approach it is adding /dev/pts/[0-9] rw,
to /etc/apparmor.d/usr.sbin.gpsd just below /tmp/gpsfake-*.sock rw,
. Then run sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.gpsd
to reload the apparmor profile
Hi, it seems i have the same problem than issue #3 , i've remove the symlink like you say, stop service.
My file
/etc/location.conf
:I'm starting service :
Service status :
Did i miss something ?
Conf: Raspberry Pi 3 model b+ Ubuntu Mate 20.04