Access denied on everything

Hi guys. I am currently unable to deploy new coder workspaces as nearly every single command fails on no permissions or nu such directory. Its the same template we used for months and I was not changing anything in it. Do you have any idea what is going on? I checked what I can think of and I am unable to find any issue I attach the log and my templates. Main.tf: https://paste.brcb.eu/ynyqudepyp.sh Dockerfile: https://paste.brcb.eu/zeloseqaby.properties
10 Replies
Codercord
Codercord5mo ago
Codercord
Codercord5mo ago
<#1371064742243991583>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys5mo ago
does /home/simonc actually exist? if it can you send the output of the following commands: - id - stat /home/simonc - stat /home/simonc/filebrowser.db also, fyi, in your startup_script, you should be able to use $HOME instead of templating every time (e.g on L172 of your main.tf)
Šimon Čecháček
Šimon ČecháčekOP5mo ago
simonc@noCurtest:~$ id
uid=1000(simonc) gid=1000(simonc) groups=1000(simonc),27(sudo)
simonc@noCurtest:~$ stat /home/simonc
File: /home/simonc
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fd00h/64768d Inode: 11319207 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2025-05-12 12:06:35.393586532 +0000
Modify: 2025-05-11 09:53:37.000000000 +0000
Change: 2025-05-12 12:06:24.961478549 +0000
Birth: 2025-05-11 09:44:09.508297492 +0000
simonc@noCurtest:~$ stat /home/simonc/filebrowser.db
stat: cannot statx '/home/simonc/filebrowser.db': No such file or directory
simonc@noCurtest:~$ id
uid=1000(simonc) gid=1000(simonc) groups=1000(simonc),27(sudo)
simonc@noCurtest:~$ stat /home/simonc
File: /home/simonc
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: fd00h/64768d Inode: 11319207 Links: 2
Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2025-05-12 12:06:35.393586532 +0000
Modify: 2025-05-11 09:53:37.000000000 +0000
Change: 2025-05-12 12:06:24.961478549 +0000
Birth: 2025-05-11 09:44:09.508297492 +0000
simonc@noCurtest:~$ stat /home/simonc/filebrowser.db
stat: cannot statx '/home/simonc/filebrowser.db': No such file or directory
Yes, the folder exists. Here is the output of commands you asked me to send 🙂
Phorcys
Phorcys5mo ago
does this only happen on new workspaces or existing ones too ? @Šimon Čecháček I found the issue, your Docker image is not creating the home folder so, what happens when a volume mount is first created in Docker is that if the folder exists in the container, it's going to copy the contents and permissions inside the volume and continue from there on the other hand though, if it doesn't exist, Docker will create the folder with root:root permissions, which is what's happening in your case because the folder didn't exist prior to the volume mount's creation so you should edit L39 of your Dockerfile to create the home folder
Šimon Čecháček
Šimon ČecháčekOP5mo ago
Hi there. sorry for the delay only new ones One thing is that for me is /home/simonc, but the username should be changing for the user creating the workspace. I changed the the line to RUN useradd --groups sudo --shell /bin/bash ${USER} \ && echo "${USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER} \ && chmod 0440 /etc/sudoers.d/${USER} But that did nto help. I explicitely added:
RUN useradd --groups sudo --shell /bin/bash ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER} \
&& chmod 0440 /etc/sudoers.d/${USER}
RUN mkdir /home/${USER}
USER ${USER}
RUN sudo chown ${USER}:${USER} /home/${USER}
RUN useradd --groups sudo --shell /bin/bash ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER} \
&& chmod 0440 /etc/sudoers.d/${USER}
RUN mkdir /home/${USER}
USER ${USER}
RUN sudo chown ${USER}:${USER} /home/${USER}
and now it looks like it works 😄 Not sure if this is the correct solution though.
Phorcys
Phorcys5mo ago
use adduser instead, that'll create the home folder
flyerzrule
flyerzrule5mo ago
I had the same issue, and this fixed it for me. Thank you!!
Šimon Čecháček
Šimon ČecháčekOP5mo ago
Will try after school finals. Now this workaround works 😄 thanks for the help! Any idea what happened as it stopped working after months?
Phorcys
Phorcys5mo ago
i think we changed the base image or something but honestly i'm unsure

Did you find this page helpful?