Problems with installing Mycroft

Hello! I’m new to Dietpi and Raspberry Pi in general. I’m using it for about a week, and got OwnCloud and Pi-Hole running. I’m using a Raspberry Pi 4. Today, I started the next project: Mycroft AI. I installed it as described in the guide here.

When I start the client, I get the following error for every single skill:

I couldn’t even pair my device. I assume the culprit is

OSError: [Errno 18] Invalid cross-device link: '/tmp/tmpu_tbamtv' -> '/mnt/dietpi_userdata/mycroft-data/skills/mycroft-timer.mycroftai'

A bit of googling said that the error appears if it tries to create a symlink between two different devices, but this shouldn’t be: I’m using a SD card and a portable HDD (mounted on /mnt/extern ), and this should all happen on the SD card.
I’m running the client as root.

I’m not sure if this problem is related to DietPi at all, but since it’s an OSError, my first idea was to ask here.

Hi,

many thanks for your message. I see some permission error on your screen print. (Last line). Pls can you have a look what permission are set?

BWT, next time copy/past the output from your SSH terminal. Contrast of the blue/black screen print is low and it’s hard to read :wink:

Oh, yeah, of course. Sorry :smiley:

 16:08:18.945 | INFO     | 18698 | msm.skill_entry | Problem performing action. Restoring skill to previous state...
 16:08:18.945 | INFO     | 18698 | msm.mycroft_skills_manager | invalidating skills cache
 16:08:18.951 | WARNING  | 18698 | mycroft.skills.skill_updater:install_or_update:221 | Failed to install default skill: mycroft-weather
 16:08:18.952 | ERROR    | 18698 | msm.mycroft_skills_manager | Error running install_or_update on mycroft-weather:
Traceback (most recent call last):
  File "/usr/lib/python3.7/shutil.py", line 563, in move
    os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/tmp/tmpl019bk89' -> '/mnt/dietpi_userdata/mycroft-data/skills/mycroft-weather.mycroftai'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/dietpi_userdata/mycroft-core/.venv/lib/python3.7/site-packages/msm/mycroft_skills_manager.py", line 461, in run_item
    func(skill)
  File "/mnt/dietpi_userdata/mycroft-core/mycroft/skills/skill_updater.py", line 217, in install_or_update
    self.msm.install(skill, origin='default')
  File "/mnt/dietpi_userdata/mycroft-core/.venv/lib/python3.7/site-packages/msm/mycroft_skills_manager.py", line 73, in func_wrapper
    ret = func(self, *args, **kwargs)
  File "/mnt/dietpi_userdata/mycroft-core/.venv/lib/python3.7/site-packages/msm/mycroft_skills_manager.py", line 376, in install
    skill.install(constraints)
  File "/mnt/dietpi_userdata/mycroft-core/.venv/lib/python3.7/site-packages/msm/skill_entry.py", line 82, in wrapper
    func(self, *args, **kwargs)
  File "/mnt/dietpi_userdata/mycroft-core/.venv/lib/python3.7/site-packages/msm/skill_entry.py", line 479, in install
    move(tmp_location, self.path)
  File "/usr/lib/python3.7/shutil.py", line 574, in move
    symlinks=True)
  File "/usr/lib/python3.7/shutil.py", line 321, in copytree
    os.makedirs(dst)
  File "/usr/lib/python3.7/os.py", line 221, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/mnt/dietpi_userdata/mycroft-data/skills/mycroft-weather.mycroftai'
 16:08:19.033 | INFO     | 18698 | mycroft.skills.skill_updater:_log_next_download_time:265 | Next scheduled skill update: 2020-11-09 16:13:19.031303

The PermissionError refers to a folder that does not exist.

root@DietPi:~# ls -l /mnt/dietpi_userdata/mycroft-data/skills/mycroft-weather.mycroftai
ls: cannot access '/mnt/dietpi_userdata/mycroft-data/skills/mycroft-weather.mycroftai': No such file or directory
root@DietPi:~# ls -l /mnt/dietpi_userdata/mycroft-data/skills/
total 0
root@DietPi:~# ls -l /mnt/dietpi_userdata/mycroft-data/
total 4
drwxr-xr-x 2 root root 4096 Nov  9 15:19 skills

ok that’s the issue. skills folder is owned by root. Therefore mycroft is not able to write data on it. pls do

systemctl stop mycroft.service
chown mycroft:mycroft /mnt/dietpi_userdata/mycroft-data/skills/
systemctl start mycroft.service
mycroft-cli-client

Now you should see skills to be installed.

This solved my problem, thank you very much! I could pair the device now and skills loaded.

I’ve noticed to more problems:

There’s no sound output. I’m not sure where the problem is here, Pulseaudio was installed with Mycroft, but I’ll look into it.

My OwnCloud isn’t reachable anymore. The client says the responses are empty. Since it worked right before the installation of Mycroft, I assume it’s somehow related, but I don’t see how yet. I’m routing all incoming https traffic to my Pi.

Are you running RPi4 and try to get sound via 3.5 jack??

Maybe this link could help https://github.com/MichaIng/DietPi/issues/3887

and pls check if Audio is activated on dietpi-config

I’m running RPi4, audio via headphone jack. No HDMI.

root@DietPi:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7



root@DietPi:~# cat /etc/asound.conf
pcm.!default {
        type hw
        card 0
        device 0
}

ctl.!default {
        type hw
        card 1
}

Starting the Mycroft Audio Test:

root@DietPi:~# mycroft-start audiotest.conf
Already up to date.
Initializing...
Starting audiotest
 ========================== Info ===========================
 Input device: Default device @ Sample rate: 48000 Hz
 Playback commandline: aplay WAV_FILE

 ===========================================================
 ==         STARTING TO RECORD, MAKE SOME NOISE!          ==
 ===========================================================
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/mnt/dietpi_userdata/mycroft-core/mycroft/util/audio_test.py", line 132, in <module>
    main()
  File "/mnt/dietpi_userdata/mycroft-core/mycroft/util/audio_test.py", line 119, in main
    record(args.filename, args.duration)
  File "/mnt/dietpi_userdata/mycroft-core/mycroft/util/audio_test.py", line 66, in record
    with mic as source:
  File "/mnt/dietpi_userdata/mycroft-core/mycroft/client/speech/mic.py", line 140, in __enter__
    return self._start()
  File "/mnt/dietpi_userdata/mycroft-core/mycroft/client/speech/mic.py", line 151, in _start
    input=True,  # stream is an input stream
  File "/mnt/dietpi_userdata/mycroft-core/.venv/lib/python3.7/site-packages/pyaudio.py", line 750, in open
    stream = Stream(self, *args, **kwargs)
  File "/mnt/dietpi_userdata/mycroft-core/.venv/lib/python3.7/site-packages/pyaudio.py", line 441, in __init__
    self._stream = pa.open(**arguments)
OSError: [Errno -9996] Invalid input device (no default output device)

I tried changing the Soundcard in dietpi-config, but no changes. Currently, it’s set on [rpi-bcm2835-3.5mm].

let’s do following and try again

sed -i 's/card 1/card 0/' /etc/asound.conf

Same problem.

speaker-test produces noise, though.

let’s ask the developer. MichaIng any ideas regarding missing sound via jack 3.5

Thank you for your help so far, I really appreciate it.

Do you have any idea why my owncloud is just sending empty responses since the installation? I hope I haven’t screwed up much with the installation of Mycroft. Going to the default website gives me an expected 403, the owncloud subdomain is just empty, and the owncloud client gets an empty response, too. (Since I think this has nothing to do with DietPi, I’ll probably take this to another forum later)

pls open a new topic if the ownloud issue persist. Just to avoid any mix-up. If not done, just do a reboot first

Well, it looks like a restart solved it. The microphone is working and I can get it to speak. It’s still not detected if I run the mycroft test, which is a bit strange, but it’s mostly working, I guess. Except for the wake word, but this is a problem with Mycroft. Thanks for your help! I really, really appreciate it.

It’s the other way round: sed -i ‘s/card 0/card 1/’ /etc/asound.conf
Known issue since RPi changed the sound device layout: https://github.com/MichaIng/DietPi/issues/3887

EDIT: Whoops, I’ve overseen page two :smiley:, has the sound issue been solved?

there is just a card0 MichaIng according one of the post before :wink:
https://dietpi.com/forum/t/problems-with-installing-mycroft/4606/7

Ah and it’s “Headphones” means 3.5mm jack, okay. I guess HDMI on card 0 only shows up if an HDMI monitor is actually attached. Okay ignore my post above :smiley:.