Kplex service need restarting waking up from sleep-hybernation

58 views
Skip to first unread message

Serge Robitaille

unread,
Jan 26, 2022, 5:47:04 AM1/26/22
to kplex
I have enabled Kplex to run as a service on my Debian distro using systemctl enable kplex. It starts on reboot just fine but needs to be restarted manually with systemctl restart kplex each time the computer wakes up from sleep-hybernation

Am I missing something in how to configure kplex ?

Here is my kplex.conf file:

[serial]
# Input from Vesper AIS
filename=/dev/AIS
direction=in
baud=38400

[udp]
address=127.0.0.1
port=10110
direction=out

Keith Young

unread,
Jan 26, 2022, 12:01:56 PM1/26/22
to kplex
Could you add:
[global]
debuglevel=3

...to your config, then check your logs after return from hibernation.

I'm wondering if the udp interface is exiting on return from sleep either because it's waking up before networking is fully up again or because dhcp is acquiring a new address.

An outstanding problem is that udp interfaces shut down when dhcp acquires a new address.  For the past year it's been on my "to do" list to add a "persist" option for udp such that it re-initializes if a write fails (as it will if the address changes on an interface) but a new job has meant I haven't devoted much time to development in the past year and the advice remains "use a static address".  But it's the no. 1 feature I need to add.

But let's just check that that is actually what's happening...if it is you'll see a log message about the interface shutting down when kplex wakes up

Serge Robitaille

unread,
Jan 26, 2022, 4:01:07 PM1/26/22
to kplex
Thank you for the quick reply.

Here is the output of journalctl -u kplex.service :
-1- restarting kplex service manually
-2- sleep
-3- waking up with not data on udp port

Jan 27 09:23:34 M93p systemd[1]: Starting NMEA 0183 Multiplexer...
Jan 27 09:23:34 M93p kplex[56053]: kplex DEBUG: kplex starting, config file /etc/kplex.conf
Jan 27 09:23:34 M93p kplex[56053]: kplex DEBUG: _serial-id1: opened serial device /dev/AIS for input
Jan 27 09:23:34 M93p kplex[56053]: kplex DEBUG: _pty-id2: created pty link /home/sergio/virtual_com to /dev/pts/2
Jan 27 09:23:34 M93p systemd[1]: Started NMEA 0183 Multiplexer.
Jan 27 09:23:34 M93p kplex[56053]: kplex DEBUG: _udp-id3: output address 127.0.0.1, port 10110
Jan 27 09:32:53 M93p kplex[56053]: kplex DEBUG: Cleaning up data for exiting input interface _serial-id1 id 10000
Jan 27 09:32:53 M93p kplex[56053]: Failed to restore serial line: Input/output error
Jan 27 09:32:56 M93p kplex[56053]: kplex DEBUG: Cleaning up data for exiting output interface _udp-id3 id 30000
Jan 27 09:32:56 M93p kplex[56053]: kplex DEBUG: Cleaning up data for exiting output interface _pty-id2 id 20000
Jan 27 09:32:56 M93p kplex[56053]: kplex DEBUG: Removing pid file
Jan 27 09:32:56 M93p kplex[56053]: kplex DEBUG: Kplex exiting
Jan 27 09:32:56 M93p systemd[1]: kplex.service: Succeeded.

Noteworthy:
I added this in kplex.conf:
[pty]
direction=out
baud=38400
mode=master
filename=/home/sergio/virtual_com
group=dialout
owner=sergio

After waking up from sleep, it's also not working.../home/sergio/virtual_com has not been recreated.

Serge Robitaille

unread,
Jan 27, 2022, 1:45:05 AM1/27/22
to kplex
Using TCP server instead of UDP is more stable coming out of sleep/hibernation but sometimes Kplex.service does not restart out of a long sleep-hibernation period!

[tcp]
mode=server
address=127.0.0.1
port=10110
direction=out

$ systemctl status kplex.service
● kplex.service - NMEA 0183 Multiplexer
    Loaded: loaded (/lib/systemd/system/kplex.service; enabled; vendor preset: enabled)
    Active: inactive (dead) since Thu 2022-01-27 15:31:01 NZDT; 4h 1min ago
      Docs: http://www.stripydog.com/kplex/configuration.html
   Process: 14831 ExecStart=/usr/bin/kplex -p /var/run/kplex.pid -o mode=background (code=exited, status=0/SUCCESS)
  Main PID: 14832 (code=exited, status=0/SUCCESS)



Reply all
Reply to author
Forward
0 new messages