DietPi-Software | Mycroft: Skills folder created with incorrect permissons

Created on 9 Nov 2020  路  15Comments  路  Source: MichaIng/DietPi

@MichaIng
before creating a PR, just like to check with you. There was an issue reported on incorrect permissions for skills folder inside /mnt/dietpi_userdata/mycroft-data. The directory is created by installation script dev_setup.sh and usually it should change permission according the script.

    if [[ ! -d /opt/mycroft/skills ]] ; then
        echo 'This script will create that folder for you.  This requires sudo'
        echo 'permission and might ask you for a password...'
        setup_user=$USER
        setup_group=$(id -gn $USER)
        $SUDO mkdir -p /opt/mycroft/skills
        $SUDO chown -R ${setup_user}:${setup_group} /opt/mycroft
        echo 'Created!'

However it's not gonna do that and directory belongs to root still. Probably setup_user=$USER is not detected correctly.

Basically we would have following options

  1. adjust dietpi-software and change owner after execution of dev_setup.sh
  2. create skills our self before changing folder permissions
  3. adjust dev_setup.sh to change user correctly?

I could create RP if you prefer option 1 or 2.

Related forum post: https://dietpi.com/phpbb/viewtopic.php?f=11&t=8252

EDIT: probably easiest to change
https://github.com/MichaIng/DietPi/blob/a5407d1b5fefe4e1647eca69d8341c7a5ff0bdf4/dietpi/dietpi-software#L6120

into
mkdir -p /mnt/dietpi_userdata/mycroft-data/skills

Bug Solution available

All 15 comments

That is strange indeed, let me try to debug. In case it is easiest to re-set mycroft:mycroft owner recursively on all dirs: core, data, log

We already create mycroft-data ourselves, let's add skills and we are done

mkdir -p /mnt/dietpi_userdata/mycroft-data/skills

Jep indeed, that'll do it. However, still good to understand what's going wrong with dev_setup.sh as this might produce other issues, if not now then in the future.

probably it might be related to sudo. We call dev_setup.sh as user mycroft

https://github.com/MichaIng/DietPi/blob/a5407d1b5fefe4e1647eca69d8341c7a5ff0bdf4/dietpi/dietpi-software#L6141

However the directory skills is created as user root. 馃
Therefore I guess following returns root as well

setup_user=$USER
setup_group=$(id -gn $USER)

and permissions are not changed
$SUDO chown -R ${setup_user}:${setup_group} /opt/mycroft

Or, it's due to the sym link we created to point to dietpi user data?? 馃

I was thinking the same first, but that works:

2020-11-10 21:24:02 root@dietpi:~# sudo -u www-data bash -c 'echo $USER'
www-data

Found it:

$SUDO chown -R ${setup_user}:${setup_group} /opt/mycroft

chown does not follow symlinks, so the above sets the permissions for the /opt/mycroft symlink only, but not for the contained skills directory 馃槃.

2020-11-12 15:48:18 root@VM-Buster:/mnt/dietpi_userdata/mycroft-core# ls -l /opt
total 0
lrwxrwxrwx 1 mycroft mycroft 33 Nov 12 14:59 mycroft -> /mnt/dietpi_userdata/mycroft-data

It is intended to be a regular directory, so this is not an issue with the Mycroft installer. Pre-creating the directory makes that code block being skipped, which is indeed the cleanest solution.

On dev branch:

[ INFO ] DietPi-Software | sudo -u mycroft ./dev_setup.sh -sm, please wait...
sudo: ./dev_setup.sh: command not found
[FAILED] DietPi-Software | sudo -u mycroft ./dev_setup.sh -sm

Setting

root@DietPi:/mnt/dietpi_userdata/mycroft-core# chmod +rx dev_setup.sh

let me continue with the installation.

Besides that, I got it to understand my "Hey Jarvis" as a wakeword once (in about 1 hour of testing), so this probably works.

Besides that, I got it to understand my "Hey Jarvis" as a wakeword once (in about 1 hour of testing), so this probably works.

Lol, I never hot "Hey Mycroft" to work, "Hey Jarvis" not well (probably one of two times, better after some attempts), "Hey Ezra" almost great and "Christopher" by far best. Not sure if the microphone plays a role as well, or if it needs to learn your voice for a while (not sure if it actually learns it or STT is done a static way). I'll fix the permissions issue.


Strange, did you face the missing execute permissions on a fresh install? Since 775 (world read+execute) is what the file has by default 馃.

Ezra didn't work at all (or maybe it did, but with a similar success rate as Jarvis), and I didn't try Christopher (my name is too similiar, and I don't want it to react if I get called :D ) I got it to work it with Jarvis a few more times, but so far, it's not really usable for me. It also always falls back to Pocket Sphinx, because no model for Precise gets found.

Strange, did you face the missing execute permissions on a fresh install?

If uninstalling via Dietpi and reinstalling it (after updating to the dev branch) counts as fresh, it's fresh. I didn't touch any files there myself.

I got "Hey Mycroft" to work most of the time, but it never responds to me. I know the sound works, because I get the beep when it hears the wake word. Looking at the CLI, it hears me and responds with text, but that's it.

Interesting how different the experiences are. Pocket Sphinx fallback btw is expected in all cases but "Hey Mycroft", AFAIK.

I got "Hey Mycroft" to work most of the time, but it never responds to me.

You did not install Mimic, did you? I needed to learn that the default British Male voice it the local Mimic instance, there is no online version of it. The other two voices, American Male and Google Voice are online voices which should work OOTB. Check out the docs about how to install local Mimic: https://dietpi.com/docs/software/hardware_projects/#mycroft-ai

I used American Male, but I'll try Mimic anyway.

Okay, if American Male fails, then probably the /var/log/mycroft/audio.log will give a hint, or voice.log, I always mix up those two 馃槃.

After reinstalling, the audio is working some of the time, and to be honest, this is probably the configuration of my VM messing it up. Don't know why it wasn't working before. Though I am getting errors when I try to use Google Voice, along the lines of GoogleTTS server could not be verified. Please check your internet connection in audio.log.

Seems to be an external issue with GoogleTTS:

Looks like next Home Assistant update will have it fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bhaveshgohel picture bhaveshgohel  路  3Comments

mok-liee picture mok-liee  路  3Comments

k-plan picture k-plan  路  3Comments

aesirteam picture aesirteam  路  3Comments

Invictaz picture Invictaz  路  3Comments