workspaces-images icon indicating copy to clipboard operation
workspaces-images copied to clipboard

cp: cannot access '/home/kasm-default-profile/./.cache': Permission denied

Open dattapw opened this issue 4 years ago • 5 comments

I run:

$ sudo docker build -t kasmweb/firefox:dev -f dockerfile-kasm-firefox-flash .        

It builds fine. BUT when I try to run it, it exits with the following error:

$ sudo docker run --rm  -it --shm-size=512m -p 6901:6901 -e VNC_PW=password kasmweb/firefox:dev

+ DEFAULT_PROFILE_HOME=/home/kasm-default-profile
+ PROFILE_SYNC_DIR=/kasm_profile_sync
+ '[' -f /home/kasm-user/.bashrc ']'
+ echo 'Profile Sync Directory Does Not Exist. No Sync will occur'
Profile Sync Directory Does Not Exist. No Sync will occur
+ copy_default_profile_to_home
+ echo 'Copying default profile to home directory'
Copying default profile to home directory
+ cp -rp /home/kasm-default-profile/. /home/kasm-user/
cp: cannot access '/home/kasm-default-profile/./.cache': Permission denied

dattapw avatar Aug 01 '21 20:08 dattapw

Same here...

gonzalu avatar Jul 06 '23 22:07 gonzalu

anyone found solution of it?

shkpk avatar Aug 04 '23 20:08 shkpk

The entrypoint scripts use ~/ or $HOME to find the home directory, but since you must run these scripts as root to create some of the directories, that directory path changes from /home/kasm-user to /root, resulting in directory does not exist.

Also I think some of the startup scripts in some images use "kasm_user" and others use "kasm-user", but I still end up with the issue above after rebuilding the image with them reconciled. The process of making new users in the image build, then at startup, copying them, linking them, removing old ones, creating root level directories, is all a little too convoluted for me to wrap my head around. I have not yet been able to decipher the order in which it is all happening. I think we need to use a variable other than $HOME, like $KASM_DEFAULT_HOME and $NEW_USER_HOME so that running sudo commands or as root still uses the intended base path.

jackgray avatar Nov 19 '23 16:11 jackgray

The entrypoint scripts use ~/ or $HOME to find the home directory, but since you must run these scripts as root to create some of the directories, that directory path changes from /home/kasm-user to /root, resulting in directory does not exist.

Also I think some of the startup scripts in some images use "kasm_user" and others use "kasm-user", but I still end up with the issue above after rebuilding the image with them reconciled. The process of making new users in the image build, then at startup, copying them, linking them, removing old ones, creating root level directories, is all a little too convoluted for me to wrap my head around. I have not yet been able to decipher the order in which it is all happening. I think we need to use a variable other than $HOME, like $KASM_DEFAULT_HOME and $NEW_USER_HOME so that running sudo commands or as root still uses the intended base path.

this is because of bug in docker https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/2028392 use different version

shkpk avatar Nov 20 '23 08:11 shkpk

I ran into the "cp: cannot access '/home/kasm-default-profile/./.cache': Permission denied" error as well. In my case, the problem was my DockerFile - I had inadvertently put the customizations outside of the "######### Customize Container Here ###########" / "######### End Customizations ###########" delimiters and after the following section:

RUN chown 1000:0 $HOME
RUN $STARTUPDIR/set_user_permission.sh $HOME

Once I fixed that and put my customizations where they belonged, rebuilt the docker image with: sudo docker build -t name:ver -f Dockerfile .

and then ran the following to test the new docker file: sudo docker run name:ver

Hopefully that will help someone else save a few hours of beating their head against the wall.

calvin-rempel-prs26 avatar Dec 10 '24 21:12 calvin-rempel-prs26