I am trying to configure my coral board to boot to the Coco object detection model using a custom systemd service. I've created the executable file, unit file and then enabled the service. The intent is for the camera feed to display to a monitor, but when I power on the board, the monitor only displays a bluish background (I assume the "home screen" of the board).
The executable file:
edgetpu_detect \
--model mobilenet_ssd...
--labels coco...
The unit file:
[Unit]
Description=systemd service.
After=weston.target
[Service]
PAMName=login
Type=simple
User=mendel
WorkingDirectory=/home/mendel
ExecStart=/bin/bash /usr/bin/test_service.sh
Restart=always
[Install]
WantedBy=multi-user.targer
Status of service after enabling and after powering on:
mendel@jumbo-tang:/etc/system$ sudo systemctl status myservice.service
myservice.service - systemd service.
Loaded: loaded (/etc/systemd/system/system/myservice.service; enabled; vendor preset
Active: active (running) since Mon 2020-01-06 03:32:03 UTC; 1s ago
Main PID: 4847 (bash)
Tasks: 0 (limit: 4915)
CGroup: /system.slice/myservice.service
4847 /bin/bash /usr/bin/test_service.sh
Jan 06 03:32:03 jumbo-tang systemd[1]: myservice.service: Service hold-off time
Jan 06 03:32:03 jumbo-tang systemd[1]: Stopped Example systemd service..
Jan 06 03:32:03 jumbo-tang systemd[1]: Started Example systemd service..
Jan 06 03:32:03 jumbo-tang systemd[4847]: pam_unix(login:session): session opene
The executable is saved to /usr/bin
, and was made executable with sudo chmod +x /usr/bin/test_service.sh
The unit file was saved to /etc/systemd/system
, and was given permissions with sudo chmod 644 /etc/systemd/system/myservice.service
I'm curious to know if my executable cannot simply contain the code I'd normally use to launch a model, like I've done, or if my unit file is properly configured, or what else could be wrong I'm not thinking of.
Any help is appreciated!
I believe I've answered you via coral-support, we discussed that you're most likely just missing a couple things:
1) When starting a systemd service especially at boot, sometimes not all environment variable are loaded, in this case, you may need to add the line:
Environment=DISPLAY=:0
before ExecStart. However, I don't suspect that is is the issue, because the process does waits on weston.target, which should already waits on environment variables.
2) This one is a lot more complicated than the previous one but you misspelled
"target" in "WantedBy=multi-user.targer" (joking, of course)
1) create a file call detects.service with the following contents:
[Unit]
Description=systemd auto face detection service
After=weston.target
[Service]
PAMName=login
Type=simple
User=mendel
WorkingDirectory=/home/mendel
Environment=DISPLAY=:0
ExecStart=/bin/bash /usr/bin/detect_service.sh
Restart=always
[Install]
WantedBy=multi-user.target
2) mv the file /lib/systemd/system/detects.service
$ sudo mv detects.service /lib/systemd/system/detects.service
3) create a file call detect_service.sh with the following content
edgetpu_detect --model fullpath/mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite --label fullpath/coco_labels.txt
4) make it executable and mv it to /usr/bin
$ sudo chmod u+x detect_service.sh
$ sudo mv detect_service.sh /usr/bin
5) enable the service with systemctl
$ sudo systemctl enable detects.service