Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot create directory '/backend/out/...': Permission denied using macOS #13

Open
cboiangiu opened this issue Mar 8, 2024 · 7 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@cboiangiu
Copy link

Encountered this while using release 0.0.2 on macOS 14.2.1 (M1) with OrbStack 1.4.3.

This is my entrypoint.sh:

#!/bin/sh
set -e

OUTDIR="/backend/out"

cd /backend

cp -r /vosk /backend/out/

cp -r /nerd-dictation /backend/out/

This is the error encountered:

 => => writing image sha256:1c6698adc262a63cc3d1ba0de529cdbfa23753ca5961aaf780c89e00c5677efa                                                                                                                      0.0s
 => => naming to docker.io/library/decky-dictation                                                                                                                                                                0.0s

What's Next?
  View a summary of image vulnerabilities and recommendations → docker scout quickview
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
cp: cannot create directory '/backend/out/vosk': Permission denied
Error: Failed to build backend. There might be more information in the output above.

Caused by:
    child status was: exit status: 1

Tried to cp the folders into out2 just to test and that seems to work without any problems.

@AAGaming00
Copy link
Member

This is an issue with your container runtime. We only support official podman and docker.

@AAGaming00 AAGaming00 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 8, 2024
@AAGaming00 AAGaming00 added invalid This doesn't seem right wontfix This will not be worked on labels Mar 8, 2024
@cboiangiu
Copy link
Author

cboiangiu commented Mar 8, 2024

@AAGaming00 Funny you mentioned that 😅. I was using docker in the beginning and the same issue happened there. I have moved onto OrbStack to give it a try as well since the PR that added the macOS build used it, but unfortunately it just had the same issue.

I have been successful in getting a build using docker and the previous build script I've been using. This leads me to believe that this is not an issue with the runtime used (docker).

I will use docker going forward in the hopes that we can find a fix for this issue.

Edit: Just gave it another try using docker. Same issue. cp: cannot create directory '/backend/out/vosk': Permission denied

@AAGaming00
Copy link
Member

odd, I've used the cli on Linux and it builds fine with docker

@AAGaming00 AAGaming00 reopened this Mar 8, 2024
@AAGaming00 AAGaming00 added bug Something isn't working help wanted Extra attention is needed and removed invalid This doesn't seem right wontfix This will not be worked on labels Mar 8, 2024
@xfangfang
Copy link

I encountered a similar problem on m2 mac. The conclusion is: do not use sudo to run cli/decky

If you have previously used sudo to run, you may need to run the following command in the project root directory to fix it:

sudo rm -rf ./out
sudo rm -rf ./backend/out
sudo rm -rf /tmp/decky
sudo rm -rf /tmp/output
sudo chown $USER -R ~/.docker/buildx/activity

@cboiangiu
Copy link
Author

@xfangfang Just gave this a try, but unfortunately it just gives the same error: cp: cannot create directory '/backend/out/vosk': Permission denied. Last command had a small typo: sudo chown -R $USER ~/.docker/buildx/activity.
Could you please give this PR a try on your m2 mac? Just trying to rule out any problems on my end, though I am not even sure where to begin troubleshooting this, since even different docker runtimes seem to give me the same issue.

@cboiangiu
Copy link
Author

@xfangfang After a bit more digging, I think I understand what you meant about not sudo running cli/decky. I am using the build.sh from decky-plugin-template, which does seem to be using sudo.
After removing sudo, I now get this error ERROR: mkdir /Users/catalinboiangiu/.docker/buildx/refs/desktop-linux: permission denied.
Seems like my refs is owned by root:

drwx------  5 catalinboiangiu  staff  160 Mar 14 19:54 activity
-rw-------  1 catalinboiangiu  staff   48 Mar 14 19:24 current
drwx------  2 catalinboiangiu  staff   64 Feb 25 14:55 defaults
drwx------  2 catalinboiangiu  staff   64 Feb 25 14:55 instances
drwx------  5 root             staff  160 Feb 25 16:13 refs

I guess it is safe to chown this folder to my user?

@cboiangiu
Copy link
Author

cboiangiu commented Mar 14, 2024

Finally the build was successful 🎉
Thank you @xfangfang for the help!
This seemed to be the fix required. Not sure how it got owned by root, but all seems to be well now.
Guess this can be closed now, although it may be a good idea to update build.sh from decky-plugin-template to not use sudo for macOS?

Edit: @AAGaming00 If this is indeed the intended behavior for macOS, I can make a PR for decky-plugin-template with this change for build.sh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants