Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
1,124 Views

C++ Program as .service at startup gives SEGV

Jump to solution

Hey everyone,

I've got a Galileo Gen 2 board with a working Yocto Linux sd card that needs to do the following after boot up:

1.) Start a NodeJS website

2.) Start a C++ program

So far, I've gotten the NodeJS server to run by creating a .service file and having it run nohup after galileo-init.service. That is working well. The C++ program though, argh! The program works as a stand alone when I login and run it through ssh or serial, but when I try to package it in a .service file, I get this message through systemctl status:

smartprobe.service - Load NodeJS DESI SmartProbe

Loaded: loaded (/lib/systemd/system/smartprobe.service; enabled)

Active: failed (Result: signal) since Mon 2001-01-01 00:40:41 UTC; 14 years 8 months ago

Process: 85 ExecStart=/usr/bin/nohup /SmartProbe/SmartProbe & (code=killed, signal=SEGV)

Main PID: 85 (code=killed, signal=SEGV)

I don't understand why this is happening, since the program runs fine in stand alone and not at startup. I've got a log file being written through the program, but it seems to indicate that things are ok. The .service and program have both had chmod +x applied.

Any help would be really appriciated.

EDIT:

Just another piece of the puzzle, this error message showed up when doing a reboot through the serial interface:

[ 7.231657] SmartProbe[85]: segfault at 4 ip 4bdabe02 sp bfc85650 error 4 in libmraa.so.0.7.2[4bda3000+15000]

[FAILED] Failed to start Load NodeJS DESI SmartProbe.


Accepted Solutions
Highlighted
Beginner
11 Views

Hey guys,

I think I solved it. The problem was that I had put in the [Install] section of the script WantedBy=local-fs.target. This does not seem to be correct; after removing this dependency and setting [Unit] to have After=galileo-target.service, everything is running at startup.

Thanks,

Austin

View solution in original post

0 Kudos
1 Reply
Highlighted
Beginner
12 Views

Hey guys,

I think I solved it. The problem was that I had put in the [Install] section of the script WantedBy=local-fs.target. This does not seem to be correct; after removing this dependency and setting [Unit] to have After=galileo-target.service, everything is running at startup.

Thanks,

Austin

View solution in original post

0 Kudos