Genie Community Forum

Autostart Genie client on satellite?

Hi

As the deb package of genie-client doesn’t include an auto-start script I’m trying to do one but it looks like genie-client doesn’t want to be started like that :frowning: Any ideas ? Testing on Pi 0W here !

> pi@genie-satellite:~ $ more /etc/systemd/system/genie.service 
> [Unit]
> Description=Autostart Genie Voice Assistant
> After=sshd.service
> 
> [Service]
> ExecStart=/usr/bin/genie-client
> User=pi
> 
> [Install]
> WantedBy=multi-user.target
pi@genie-satellite:~ $ sudo systemctl status genie
● genie.service - Autostart Genie Voice Assistant
     Loaded: loaded (/etc/systemd/system/genie.service; disabled; vendor preset: enabled)
     Active: failed (Result: signal) since Fri 2021-12-24 17:02:49 CET; 1min 35s ago
    Process: 5603 ExecStart=/usr/bin/genie-client (code=killed, signal=TRAP)
   Main PID: 5603 (code=killed, signal=TRAP)
        CPU: 387ms

déc 24 17:02:49 genie-satellite genie-client[5603]: Config key [sound] stt_error missing, using default 'no-match.oga'
déc 24 17:02:49 genie-satellite genie-client[5603]: Config key [buttons] evinput_dev missing, using default '/dev/input/event0'
déc 24 17:02:49 genie-satellite genie-client[5603]: Config key [vad] start_speaking_ms missing, using default '3000'
déc 24 17:02:49 genie-satellite genie-client[5603]: Config key [vad] done_speaking_ms missing, using default '500'
déc 24 17:02:49 genie-satellite genie-client[5603]: Config key [vad] input_detected_noise_ms missing, using default '600'
déc 24 17:02:49 genie-satellite genie-client[5603]: Config key [vad] listen_timeout_ms missing, using default '10000'
déc 24 17:02:49 genie-satellite genie-client[5603]: Config key [webui] port missing, using default '8000'
déc 24 17:02:49 genie-satellite genie-client[5603]: pa_context_connect() failed: Connection refused
déc 24 17:02:49 genie-satellite systemd[1]: genie.service: Main process exited, code=killed, status=5/TRAP
déc 24 17:02:49 genie-satellite systemd[1]: genie.service: Failed with result 'signal'.
pi@genie-satellite:~ $

Thanks

Vincèn

Tried a more elaborate systemd startup scriot but still exact same error :frowning: Why it doesn’t want to start from a script ? :frowning:

[Unit]
Description=Genie
After=syslog.target network.target

[Service]
Type=simple
WorkingDirectory=/home/pi
ExecStart=/bin/bash -lc '/usr/bin/genie-client'
User=pi
Group=staff
UMask=0002

RestartSec=1
Restart=on-failure

StandardOutput=syslog
StandardError=syslog

SyslogIdentifier=rhasspy

[Install]
WantedBy=multi-user.target

In the current implementation, genie-client must be started as a user (session) systemd service, because it connects to the normal PulseAudio instance which runs as a user service. You’re instead writing a system service, which won’t work.

We’re about to change that, as we need to run genie-client as root to configure wifi and other device aspects. When that happens, we’ll have instructions to set up PulseAudio in system mode as well.

Confused here as it’s well a system service but I have setup a specific user in it so it’s a user service no ? When I check logs after running my systemd script it starts well a bash shell before running/trying to run genie…

Impatient for that as for now Genie is unusable for me if it can’t be started automatically :frowning:

Confused here as it’s well a system service but I have setup a specific user in it so it’s a user service no ? When I check logs after running my systemd script it starts well a bash shell before running/trying to run genie…

No, a user service is started by the systemd user manager (user@1000.service or similar). The systemd file would be installed in /usr/lib/systemd/user or /etc/systemd/user.
What you wrote is a system service which is run as a regular user, which is a different thing. In particular, PAM, loginuid, environment variables, and other settings will be different if it’s not a proper user service, and the PulseAudio socket won’t be available.