not-jan/apex-tux

Running software as a service fails by core dumping

Opened this issue · 11 comments

Hello,

Finally, with your help guys, I could make this run for my device (Apex PRO).

Now, I want this to run in the background as soon as I log in to my session(nice to close itself when there is no compatible device:?) ).

So, following the AUR package, which service file also does not work, I created the service file, moved binaries and settings to proper folders, and ran the service as follows:

sudo mkdir /etc/apex-tux && sudo cp settings.toml /etc/apex-tux/
sudo cp target/release/apex-tux /usr/bin
sudo nano /etc/systemd/system/apex-tux.service

The service is the following:

[Unit]
Description=Steelseries Apex OLED Support

[Service]
Type=simple
WorkingDirectory=/etc/apex-tux
ExecStart=/usr/bin/apex-tux

[Install]
WantedBy=default.target

Now, at starting it and checking the status, we will get the issue:

sudo systemctl start apex-tux
sudo systemctl status apex-tux                          ✔  4s  
× apex-tux.service - Steelseries Apex OLED Support
     Loaded: loaded (/etc/systemd/system/apex-tux.service; disabled; preset: disabled)
     Active: failed (Result: core-dump) since Tue 2023-06-13 20:09:40 +03; 2s ago
   Duration: 1.564s
    Process: 228275 ExecStart=/usr/bin/apex-tux (code=dumped, signal=SEGV)
   Main PID: 228275 (code=dumped, signal=SEGV)
        CPU: 128ms

Jun 13 20:09:38 luis-rogstrixg713qrg713qr systemd[1]: Started Steelseries Apex OLED Support.
Jun 13 20:09:40 luis-rogstrixg713qrg713qr systemd[1]: apex-tux.service: Main process exited, code=dumped, s>
Jun 13 20:09:40 luis-rogstrixg713qrg713qr systemd[1]: apex-tux.service: Failed with result 'core-dump'.
lines 1-11/11 (END)

When we execute this software stand-alone, it works fine, but executing it as a service fails.

Why? What can we do here?

Thank you

hi, just tried what you did, and to no surprise, I also have an error, I'm on manjaro 6.1.31-2
in dmesg I have

[ 1988.821015] apex-tux[7309]: segfault at e0 ip 00007f9b3c1856e4 sp 00007f9b3c4d7088 error 4 in libX11.so.6.4.0[7f9b3c176000+8b000] likely on CPU 8 (core 0, socket 0)
[ 1988.821025] Code: 07 48 03 b7 e8 00 00 00 48 8b 46 10 c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 8b 87 e0 00 00 00 c3 0f 1f 44 00 00 f3 0f 1e fa <48> 63 87 e0 00 00 00 48 c1 e0 07 48 03 87 e8 00 00 00 48 8b 40 10

(it's the exact same lines everytime)

Hi, just tried what you did, and to no surprise, I also have an error, I'm on Manjaro 6.1.31-2 in dmesg I have

[ 1988.821015] apex-tux[7309]: segfault at e0 ip 00007f9b3c1856e4 sp 00007f9b3c4d7088 error 4 in libX11.so.6.4.0[7f9b3c176000+8b000] likely on CPU 8 (core 0, socket 0)
[ 1988.821025] Code: 07 48 03 b7 e8 00 00 00 48 8b 46 10 c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 8b 87 e0 00 00 00 c3 0f 1f 44 00 00 f3 0f 1e fa <48> 63 87 e0 00 00 00 48 c1 e0 07 48 03 87 e8 00 00 00 48 8b 40 10

(it's the exact same lines every time)

How can we know which line of codes are related to this? It seems they are not optimum or they depend on external heavy processes.

it doesn't seem like it's apex-tux's fault here, but libx11, which shouldn't be called, unless it's used to make the graphics? no idea

Hi, I found out why, and it's not a good thing for most use case, it's the hotkey's fault.
I managed to find that thanks to this PR
if you recompile without the hotkey it will work just fine, another thing you can try, in most DE, you can execute a file when the user login, which should ensure that it's running in an interactive daemon

I'm not sure if you can launch a software in an interactive daemon with only systemd

Moreover, in systemd, since the executable can't access x11, and it's under a different user, it can't display discord notifications and the music provider will fail

Moreover, in systemd, since the executable can't access x11, and it's under a different user, it can't display discord notifications and the music provider will fail

Bad thing!

I ran into the same problem, but adding it to KDE's Autostart GUI works fine

how do you do it?
You could add it as a hotfix, monkey patch in the documentation @vardogor .

@SalahAdDin Looked into it, it's just creating a .desktop file, putting it in ~/.config/autostart and executing on login, which as @jehendeoff said most DEs support. I'd be happy to add a little autostart how-to in the doc?

@SalahAdDin Looked into it, it's just creating a .desktop file, putting it in ~/.config/autostart, and executing on login, which as @jehendeoff said most DEs support. I'd be happy to add a little autostart, how-to in the doc?

Just extend the documentation on the README.md file itself, and open a new PR.

@vardogor Your solution worked pretty fine!!!

Now, I just need a way to change the Apex RBG colors XD