Open GallopingTurtle opened 4 months ago
What is your umask?
umask
If its not 022 before you did the git clone, that might be your problem.
umask
was 0002
, changed it to 0022
and retried, got the same error
Permissions are always fun. The openc3.sh script tries to run containers as the same user that is on the host and that generally works around most issues with doing host volume mounts.
If you look into openc3.sh, this is the line that runs the generators:
docker run -it --rm --env-file "$(dirname -- "$0")/.env" --user=$OPENC3_USER_ID:$OPENC3_GROUP_ID --network openc3-cosmos-network -v `pwd`:/openc3/local:z -w /openc3/local $OPENC3_REGISTRY/$OPENC3_NAMESPACE/openc3-operator$OPENC3_IMAGE_SUFFIX:$OPENC3_TAG ruby /openc3/bin/openc3cli $args
Its a bit complicated, but the important parts are:
--user=$OPENC3_USER_ID:$OPENC3_GROUP_ID
OPENC3_USER_ID is set earlier in the script doing:
docker info | grep -e "rootless$" -e "rootless: true"
if [ "$?" -ne 0 ]; then
export OPENC3_ROOTFUL=1
export OPENC3_USER_ID=`id -u`
export OPENC3_GROUP_ID=`id -g`
else
export OPENC3_ROOTLESS=1
export OPENC3_USER_ID=0
export OPENC3_GROUP_ID=0
fi
For a normal docker setup (not rootless) that will be the userid returned by id -u
Then we volume mount in the current folder:
-v `pwd`:/openc3/local:z
And that is where the generators try to write files and are currently getting a permissions error.
If you have a support contract, I'd be happy to jump on a call and help debug. Otherwise, hopefully this points you in the right direction. The container must be running as a user that has permissions to write to your host filesystem via the volume mount.
Changing the umask to 0000
worked, but I'm not sure that should be the solution.
I hijacked that run command (which is rootful based on my install and uses my uid and gid) and ran ls -ltr
.
For some reason root
is the owner of /openc3/local
. openc3
is the owner of /openc3
but root
also owns (in /openc3
) .bundle
, Gemfile.lock
, gems
, local
. From my research, this is the source of my issue. I can take ownership of local
, but not the other items and my issue still persists.
I'll spin up an ubuntu VM and see if I can reproduce. How was docker installed (system package or script from docker.io)? Feels like some sort of Docker security setting.
Ah, just noticed you are using the linux Docker Desktop version of docker. I've never tried that and it is most likely the problem. We recommend installing docker directly on linux machines and not using Docker Desktop.
Installed from the docs here: https://docs.docker.com/desktop/install/ubuntu/#install-docker-desktop (downloaded the deb) as referenced from here: https://docs.openc3.com/docs/getting-started/installation#prerequisites
This is what is causing the issue: https://docs.docker.com/desktop/faqs/linuxfaqs/#how-do-i-enable-file-sharing
From reading that it sounds like we'll want to treat docker desktop on linux, like using a rootless setup. Let me try it out and see if we can autodetect that configuration.
In the near term, you can modify your openc3.sh to force it to detect a rootless setup and run the containers as "root". It will just be root inside the docker desktop VM, not on the host for that case, and the user should map back to your host user account and I think it work.
Can confirm forcing the else
branch of the mentioned if
solved this issue in full
Describe the bug
For many operations, including generating a plugin, I get a filesystem permission denied error.
To Reproduce
If not installed, install docker as directed in the docs. Else, terminate and delete all images and volumes.
after running the generate, I see
Possible Solution?
openc3.sh cliroot generate plugin demotest
works as intended.Browser Impact
On the fresh install we just made, navigate to
http://localhost:2900
, set a password the telemetry viewer > new page (there should have already been an unhelpful error toast) > Target=INST2 > New Screen Packet=[BLANK] > screen name=helpmeResponse
Response value was
{"status":"error","message":"Permission denied @ dir_s_mkdir - /plugins/DEFAULT/targets_modified"}
from thehttp://localhost:2900/openc3-api/screen/?scope=DEFAULT
endpoint.Expected behavior No errors, be able to complete the examples
Environment (please complete the following information):
Docker version 27.0.3, build 7d4bcd8
Docker Compose version v2.28.1-desktop.1
Docker Desktop Version: 4.32.0