I’m hoping to be back - was active with Mycroft but then COVID changed everything. :((
I was using Pycroft because it’s just so turnkey. But I want to utilize the power of a RasPi 4 as a general purpose computer. So I switched to the 12/2/2020 version of what used to be called Raspbian. I was able to record and playback using arecord and aplay so I know the mic and speakers are working.
I installed Mycroft (and Jellyfin) and created the service file in /etc/systemd/system. I started the service and Mycroft was purported to be running. But I say “Hey Mycroft” and nothing happened. So I stopped the service and started it interactively with debug on. Now Mycroft is answering me. :))
I did see an error in the logs about down level Python or something. I followed the URL to the website and it was recommended to do this:
$ sudo apt-get install libatlas-base-dev
That made the error messages go away, but Mycroft will still not answer in background mode.
I Ctrl-C out of the debug mode and start mycroft with ‘service mycroft start’. I wait a minute and speak ‘Hey Mycroft’. I look at /var/log/mycroft/voice.log and I see:
Connection failure: Connection refused
pa_context_connect() failed: Connection refused
2021-01-23 16:08:07.901 | INFO | 4696 | __main__:handle_record_begin:37 | Begin Recording...
2021-01-23 16:08:14.178 | INFO | 4696 | __main__:handle_record_end:45 | End Recording...
2021-01-23 16:08:15.598 | ERROR | 4696 | mycroft.client.speech.listener:transcribe:239 | list index out of range
2021-01-23 16:08:15.601 | ERROR | 4696 | mycroft.client.speech.listener:transcribe:240 | Speech Recognition could not understand audio
So why the ‘Connection refused’? Hmm, maybe it’s running as root and not as pi?
Following up on my own reply. No, both in interactive mode and ‘systemctl mode’, all processes are running as pi.
Another thought - might the registration code not be getting sent in systemctl mode? So the mycroft.ai server is not recognizing my device as being being registered?
I searched the web and saw a similar issue by ‘marko’ in 2019.
I hate to sound like a broken record, but, what’s actually running when you start with the systemd start up vs debug? What all is in the logs of note from the systemd start up? What’s different for those on the debug startup?
Secondly; can you post the content of your pulseaudio.service file?
Thirdly; if the pulseaudio service is not running as the pi user, but a dedicated user instead. Did you add the pi user to the pulse and pulse-acces group?
It sounds to me, you do not start pulseaudio as system wide deamon utilizing pulseaudio.service.
If you start mycroft manually by CLI, it starts a session of pulseaudio for that program.
If you start mycroft via systemd, you state that it should start only after the pulseaudio service, but of course you need to make sure you also enable it at boot and that the pulseaudio service indeed is started and running for mycroft to connect to.
So what is the content of your pulseaudio.service file?
What does “sudo systemctl status pulseaudio” say?
I added an /etc/systemd/system/pulseaudio script, and that shows it is running after a reboot.
But mycroft still fails
After digging some, I see this:
journalctl -xe | grep mycroft
...
raspberrypi mycroft-start[785]: fatal: unable to access 'https://github.com/MycroftAI/mycroft-core.git/': Could not resolve host: github.com
...
So is mycroft trying to start too early and can’t get out to the internet?
I tried adding various 'after=network’s , all to no avail.
I also tried an old-fashioned /etc/init.d/mycroft script. This also failed where I see:
Jan 27 19:56:23 raspberrypi polkitd(authority=local)[485]: Operator of unix-process:1389:31208 successfully authenticated as unix-user:pi to gain ONE-SHOT authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.48 [/bin/systemctl --no-pager start mycroft.service] (owned by unix-user:pi)
There are so many bits and pieces that need to be aligned properly that it is just a lot easier for me if you just post your files instead of snippets. I still believe your issues lies in mycroft not being allowed to talk properly with pulse audio.