From 922928bbecd45022053e6497024e3b5d6eb28ba7 Mon Sep 17 00:00:00 2001 From: Tara Subedi Date: Mon, 6 Oct 2025 15:28:11 -0400 Subject: [PATCH] After restarting gpsd.service, the /dev/ttyACM0.pty file becomes inaccessible In presence of gnss-monitor ptp-instance monitoring a device (/dev/ttyACM0), gpspipe@.service connects to gpsd daemon and provides NMEA output in /dev/ttyACM0.pty file. When gpsd.service daemon restarted, gpspipe@.service exits with success return-code and not restarted, causing the output file unavailable. This commit fixes the issue by restarting the gpspipe@.service always, whether the return-code be success or failure. Test Plan: PASS: Deploy gnss-monitor ptp-instance with device /dev/ttyACM0 - /dev/ttyACM0.pty file is accessible - systemctl restart gpsd.service /dev/ttyACM0.pty file accessible. gpspipe@-dev-ttyACM0.service is running (get restarted) PASS: stop gpsd.service, gpspipe service automatically restarts gpsd.service too, and /dev/ttyACM0.pty file accessible PASS: stop gpsd.socket, gpspipe service keep restarting, until gpsd.socket started again. PASS: Test same as above for two devices, after following: system ptp-instance-parameter-delete gnss0 'devices=/dev/ttyACM0' system ptp-instance-parameter-add gnss0 'devices=/dev/ttyACM0 /dev/ttyACM1' system ptp-instance-apply Closes-bug: 2126965 Change-Id: I445f99e548b96b0bbee4d35dfa31e2c4e3c768ca Signed-off-by: Tara Nath Subedi --- .../src/modules/platform/templates/gpspipe.service.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/puppet-manifests/src/modules/platform/templates/gpspipe.service.erb b/puppet-manifests/src/modules/platform/templates/gpspipe.service.erb index 027cca354..d53f8afcb 100644 --- a/puppet-manifests/src/modules/platform/templates/gpspipe.service.erb +++ b/puppet-manifests/src/modules/platform/templates/gpspipe.service.erb @@ -7,7 +7,8 @@ Type=simple ExecStart=/bin/bash -c 'python /usr/rootdirs/opt/collectd/extensions/python/gpspipe.py -r localhost:2947:%I | socat - PTY,link=%I.pty,raw,echo=0' ExecStartPost=/bin/bash -c 'echo $MAINPID > /var/run/gnss-monitor-%i.pid' ExecStopPost=/bin/rm -f /var/run/gnss-monitor-%i.pid -Restart=on-failure +Restart=always +RestartSec=5 [Install] WantedBy=multi-user.target