Getting Mycroft to autostart with systemctl propertly... what is my "working directory"?

Don’t know if it will be useful, as I’m speaking of the arch linux package which is done with love and works out of the box, but here, the daemon is launched by the user, and it makes sense, as the configuration files are owned by the user and involving root just would add complexity, incongruence, and file permission issues on the short and mid-term.

Systemd user init files are placed on /usr/lib/systemd/user/ if you want any user can manage those daemons, or inside ~/.config/systemd/user for the user who wants to start anything as a service. Then, you should be able to start them with
systemctl --user start|stop|restart|enable name-of-the.service

My /usr/lib/systemd/user/mycroft.service unit file is this:

[Unit]
Description=Mycroft main service
After=network.target local-fs.target remote-fs.target

[Service]
Type=forking
RemainAfterExit=no
ExecStart=/usr/share/mycroft-core/start-mycroft.sh all
ExecStop=/usr/share/mycroft-core/stop-mycroft.sh all

[Install]
WantedBy=multi-user.target

So, you can start and enable at boot the mycroft daemon, just for your user, with

systemctl --user start mycroft.service
systemctl --user enable mycroft.service

More information about systemd user units can be found, as you almost always can, on the arch linux wiki: https://wiki.archlinux.org/index.php/Systemd/User#Writing_user_units

For the sound permissions, I would bet your user is not a member of the mycroft-core group, please, run the command:

$ getent group | grep mycroft

To see see the exact mycroft group name and to see if your username belong to that group

$ getent group | grep mycroft
mycroft-core:x:965:malevolent

If your user is not a member of that group, you can add it with the usermod command

sudo usermod -aG <MYCROFT_GROUP> <USERNAME>

Then close and start the terminal|session and run the following command to make sure your user is member of the mycroft group

$ id
uid=1000(malevolent) gid=1000(malevolent) groups=1000(malevolent),3(sys),90(network),98(power),965(mycroft-core),991(lp),998(wheel)

As you can see, besides sudo (wheel) membership, my username has no other special “sound” membership like “audio” or whatsoever, just mycroft-core.

1 Like