Hey Folks,
It’s been a long time since I used a CLI and never under any kind of linux - so I thought these were great conditions to launch into building a Picroft/Mycroft device.
I’ve got myself into deep water much quicker than I imagined.
The audio output is confused - If I ask it to sing a song, the song comes out of my HDMI connection but nothing else can be heard from any output.
I’ve spent a couple of days on google and determined that I might need to edit one of the mycroft.conf files and that the easiest way to do that is using “mycroft-config edit system”.
This brings up the config file in a kind of nano editor. I make the changes I want and hit exit. It the asks me if i want to save the file and I hit ‘y’. Then it asks if I want to “replace ‘/etc/mycroft/mycroft.conf’ , overriding mode 0664 (rw-rw-r–)”.
Responding “y” to this gets me “cannot move ‘/tmp/mycroft.json’ to ‘/etc/mycroft/mycroft.conf’ : Permission denied”
I’ve tried all sorts to get around this (including “sudo mycroft-config…” and chmod) but they all end in a problem with permissions.
It’s set to auto-login as the ‘pi’ user. I’m not sure if they own /etc/mycroft/mycroft.com but, based on what I’m seeing, I’m going to guess that they don’t.
I saw somewhere that suggested using something like ‘sudo su mycroft’ but, from memory, that returned something like ‘no such user’ or ‘user unrecognised’, or something like that.
@amartin - Looking at my system, I don’t even see an /etc/mycroft/ directory. I try the same command and get the same error. Sounds like a bug in mycroft-config trying to write to a file in a directory that doesn’t exist.
The user pi cannot create a file under /etc/. This shows the permissions for that directory. It is owned by root and only the owner has write permission:
Let’s back up on the issue. Have you tried arecord and aplay to test your mic and speakers? I believe this should work (if arecord fails, try removing the -c 2 args):
The arecord command will record for 5 seconds, so say anything after you run it. It saves it to a file in /tmp/. The aplay command then should play back what you said.
ls -ld /etc returns drwxr-xr-x 86 root root 4096 Sep 10 13:34
The same permissions as you shared but the numbers are different (86 and 4096 vs 138 and 8192) - I don’t know if that’s important.
I tried the arecord command but it returned arecord: main:828: audio open error: No such file or directory
For reference, during the initialisation, the mic test didn’t output any sound either.
I’ve been trying to follow the guidance set out In another thread but keep running into the permissions problem - I’m using a 4B (4Gb) and seem to have everything running correctly except the sound. I haven’t tinkered with anything else or installed any skills other than the ones that came as part of the regular install process.
mycroft-cli-client shows that it’s hearing me and is responding but the only time is has any audible output is when asked to sing and that comes through on the HDMI audio channel.
“mycroft-config edit system” brings up a file that shows the outputs as:
"play_wav_cmdline": "aplay -Dhw:0,0 %1",
"play_mp3_cmdline": "mpg123 -a hw:0,0 %1"
This seems to be the HDMI output but nothing except the singing comes through on that.
I tried running Sonic Pi under Raspbian on the same machine and the sound comes through fine - so I know it’s not a hardware issue.
Resigning myself to the possibility that I may have to run through the whole install again just to choose a different audio output during setup. That’s a project for NEXT weekend.
Well this is a problem. But it may be in how you called arecord - which is finicky because microphones have a lot of variables. So I wrote a wrapper around it to look in /proc/sound/card* files and pass the correct args. Could you please do this to get the script named testrecord:
$ cd
$ git clone https://github.com/mike99mac/mycroft-tools.git
$ cd mycroft-tools
$ sudo ./setup.sh
$ which testrecord
The commands do this:
cd - change to home directory
git clone - pull code down from the Internet
cd mycroft-tools - change to the new directory
setup.sh - copy the scripts to /usr/local/sbin
which - test if the executable is found in your PATH
If the which command fails, something went wrong. If it succeeds, you can run testrecord and testplay.
Also, there is a script lsenv which lists your environment, like where mycroft, pulseaudio and emby are running, plus other info. That might give some clues.
Installing mycroft-tools went well and seemed to work although there was still no audio after running testrecord followed by testplay (obviiously I was making noises while recording!). No errors were reported.
The lsenv script returned the following
Status of mycroft:
Unit mycroft.service could not be found.
–) WARNING: mycroft is not running as a service ... checking for processes ...
Found matching processes:
pi. 703 1 6 13:29 tty1 00:00:29 python3 -m mycroft.messagebus.service
pi. 706 1 18 13:29 tty1 00:01:30 python3 -m mycroft.skills
pi. 709 1 1 13:29 tty1 00:00:05 python3 -m mycroft.audio
pi. 712 1 5 13:29 tty1 00:00:24 python3 -m mycroft.client.speech
pi. 715 1 4 13:29 tty1 00:00:20 python3 -m mycroft.client.enclosure
pi. 855 712 0 13:29 tty1 00:00:00 /home/pi/.local/share/mycroft/precise/precise-engine/precise-engine /home/pi/.local/share/mycroft/precise/hey-mycroft.pb 2048
pi. 860 855 41 13:29 tty1 00:03:20 /home/pi/.local/share/mycroft/precise/precise-engine/precise-engine /home/pi/.local/share/mycroft/precise/hey-mycroft.pb 2048
----------------------------------------------------------------
Status of emby-server:
Unit emby-server.service could not be found.
–) WARNING: emby-server is not running as a service ... checking for processes ...
WARNING: no porcesses matching emby-server found
----------------------------------------------------------------
Status of pulseaudio:
–) pulseaudio is running as a process:
pi 607 543 3 13:29 ? 00:00:17 /usr/bin/pulseaudio --daemonize=no
------------------------------------------------------
IP address: 192.168.0.53
temperature: 55C / 131F
Memory usage:
total used free shared buff/cache available
Mem: 3.7Gi 243Mi 3.1Gi 8.0Mi 447Mi 3.4Gi
Swap: 99Mi 0B 99Mi
CPU usage: 18%
EDIT: I’m going to try building the image again on a spare sd card. Then I can experiment with different audio options during setup
@amartin - good you’re making some progress. It sounds like record is working, but not playback is not.
You wrote: "I’m going to try building the image again on a spare sd card. " - yes, good idea. I’ve probably done that a couple dozen times since starting with Mycroft. Take good notes. Practice makes perfect.
It’s possible that it was any one of a number of things that I changed:
When setting up Buster, before installing Picroft, I changed the audio outputs to 1 instead of 0.
When installing Picroft, before rebooting to run the setup, I edited the /etc/mycroft/mycroft.conf file to change the output from 0 to 1
Finally, as it ran through the guided setup, I chose the HDMI output instead of the more obvious 3.5mm.
I suspect it was the last one that actually did the job since the last stage before the setup is to run the mycroft-wipe --keep-skills command which would reset everything else to default.
EDIT:
I clearly need to keep working on this - Now it outputs through the 3.5mm no matter what I choose during setup BUT only if the HDM cable is plugged in - as soon as I try to run it headless it goes silent.
I can see the activity like working as normal but no sound again!
Back to the drawing board!
That’s the problem - I can’t edit mycroft.conf without running into the permissions problem.
Although, I might try editing it before the guided setup runs as I did to change it from 0 to 1.
Id skip the guided setup completely if I knew what I was doing!
I ran a new build and when it asked me if I wanted guided setup I said no.
Something in that setup must change permissions because I was now able to edit the /etc/mycroft/mycroft.conf file without getting getting denied.
I removed both lines specifying the audio and restarted the whole thing - it worked!
Thanks for yours and everyone else’s help!
[Picroft config permission denied picroft-config-permission-deniedThis requires sudo permission and might ask you for a password… mkdir: cannot create directory mycroft* ': Permission denied . When 192.168.l.254 I try to save I get [ Error writing /boot/config .txt: Permission denied . I have checked the file on my PC and it is not read only. — This requires sudo permission and might ask you for a password… mkdir: cannot create directory ‘/opt/mycroft’: Permission denied.