Unable to create skill through msk

OS - Ubuntu 20.04

I am unable to create a skill template through the mycroft-msk create command.
The command returns the following error :-1 `

Could not prepare repo (GitCommandError([‘git’, ‘config’, ‘remote.origin.url’, ‘GitHub - MycroftAI/mycroft-skills: A repository for sharing and collaboration for third-party Mycroft skills development.’], 255, b’error: could not lock config file .git/config: Permission denied’, b’‘)), Creating temporary repo
Could not use temporary repo either (GitCommandError([‘git’, ‘config’, ‘remote.origin.url’, ‘link to mycroft-skills github repo’], 255, b’error: could not lock config file .git/config: Permission denied’, b’‘)), trying to use existing one without update
Failed to update repo: MergeConflict
Skill metadata couldn’t be fetched (PermissionError(13, ‘Permission denied’))
Could not prepare repo (GitCommandError([‘git’, ‘config’, ‘remote.origin.url’, ‘link to mycroft-skills github repo’], 255, b’error: could not lock config file .git/config: Permission denied’, b’‘)), Creating temporary repo
Could not use temporary repo either (GitCommandError([‘git’, ‘config’, ‘remote.origin.url’, ‘link to mycroft-skills github repo’], 255, b’error: could not lock config file .git/config: Permission denied’, b’')), trying to use existing one without update
Failed to update repo: MergeConflict
Enter a short unique skill name (ie. “siren alarm” or “pizza orderer”): turn on light

Class name: TurnOnLightSkill
Repo name: turn-on-light-skill

Looks good? (Y/n) y
Traceback (most recent call last):
File “/mycroft-core/.venv/bin/msk”, line 8, in
sys.exit(main())
File “/mycroft-core/.venv/lib/python3.8/site-packages/msk/main.py”, line 64, in main
return action_to_clsargs.action.perform()
File “/mycroft-core/.venv/lib/python3.8/site-packages/msk/actions/create.py”, line 397, in perform
self.initialize_template()
File “/mycroft-core/.venv/lib/python3.8/site-packages/msk/actions/create.py”, line 336, in initialize_template
result = handler()
File “/mycroft-core/.venv/lib/python3.8/site-packages/msk/actions/create.py”, line 313, in
(‘’, lambda: makedirs(self.path)),
File “/usr/lib/python3.8/os.py”, line 223, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: ‘/opt/mycroft/skills/turn-on-light-skill’
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File “/usr/lib/python3.8/shutil.py”, line 704, in rmtree
orig_st = os.lstat(path)
FileNotFoundError: [Errno 2] No such file or directory: '/opt/mycroft/skills/turn-on-light-skill`

if I try to run the command as sudo it returns the error - sudo: mycroft-msk: command not found.

Thanx for the help.

I’d say you have a permissions error that needs to be fixed. Try mkdir /opt/mycroft/skills/turn-on-light-skill and see what happens?

Aditya,

Exactly what command did you run?
Are you running as the user ‘pi’?
Do you have the directory /home/pi/mycroft-core/bin in your PATH?
Please post the output of ‘echo $PATH’.

Thanks.

-Mike M

Thanx for replying.

The command I ran was : mycroft-msk create

I’m sorry I don’t understand what you mean by “Are you running as the user ‘pi’”.
Yes I guess I have the mycroft directory in my PATH. ‘echo $PATH’ returns

home/aditya/anaconda3/condabin:/home/aditya/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/aditya/mycroft-core/bin.

Sorry for the late reply.

Manually creating the skill directory didn’t help. I got this error

Could not prepare repo (GitCommandError([‘git’, ‘config’, ‘remote.origin.url’, ‘GitHub - MycroftAI/mycroft-skills: A repository for sharing and collaboration for third-party Mycroft skills development.’], 255, b’error: could not lock config file .git/config: Permission denied’, b’')), Creating temporary repo
Enter a short unique skill name (ie. “siren alarm” or “pizza orderer”): turn on light

Class name: TurnOnLightSkill
Repo name: turn-on-light-skill

Looks good? (Y/n) y
Traceback (most recent call last):
File “/mycroft-core/.venv/bin/msk”, line 8, in
sys.exit(main())
File “/mycroft-core/.venv/lib/python3.8/site-packages/msk/main.py”, line 64, in main
return action_to_clsargs.action.perform()
File “/mycroft-core/.venv/lib/python3.8/site-packages/msk/actions/create.py”, line 397, in perform
self.initialize_template()
File “/mycroft-core/.venv/lib/python3.8/site-packages/msk/actions/create.py”, line 336, in initialize_template
result = handler()
File “/mycroft-core/.venv/lib/python3.8/site-packages/msk/actions/create.py”, line 288, in add_locale
makedirs(join(self.path, ‘locale’, self.lang))
File “/usr/lib/python3.8/os.py”, line 213, in makedirs
makedirs(head, exist_ok=exist_ok)
File “/usr/lib/python3.8/os.py”, line 223, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: ‘/opt/mycroft/skills/turn-on-light-skill/locale’

Thanks for replying.

This is definitely a problem:

PermissionError: [Errno 13] Permission denied: ‘/opt/mycroft/skills/turn-on-light-skill/locale’

To check which user you’re running as, issue the ‘id’ command. I get this:

$ id
uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),105(input),109(netdev),117(lpadmin),997(gpio),998(i2c),999(spi)

If you’re running as pi, I’m mostly sure it would be OK to change ownership of user and group to pi in all directories below /opt/mycroft/skills. So you could try:

$ cd /opt/mycroft/skills
$ sudo chown -R pi.pi *

The -R flag says change ownership of all files and directories recursively.

Hope this helps that error go away.

-Mike M