home directory of user changed owner to ubuntu user

Hello, after the last update I made a small change in the template, just added one line into the apt-get install command to include the ZIP utility. Now the whole folder of the user is owned by user ubuntu from group ubuntu and not the user that runs the workspace. That prevent workspaces from starting correctly as the script will get permissions denied on nearly every file. I do not use the user ubuntu in any line of my template files. Any idea what is going on? The issue happened on all of our workspaced that I updated to the last version. I also add a screenshot of the only change in the template: thank you!
No description
No description
Solution:
Thank you. We should probably pin Ubuntu version in the example templates
Jump to solution
13 Replies
Codercord
Codercord6mo ago
<#1234891132706488341>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys6mo ago
hey could you send your template over ?
Šimon DJ Čecháček
Of course! Dockerfile: https://paste.brcb.eu/cegafaryhe.properties Main.tf: https://paste.brcb.eu/myrivewybe.sh Does someone have an idea what can be the issue? 🙂 I read all my templates and the zip package was really all that changed.
Atif
Atif6mo ago
If you build and run the image outside of Coder using docker CLI, do you see the same issue?
Šimon DJ Čecháček
Eeeh. will try, how? 😄
Atif
Atif6mo ago
docker build -t sometag -f Dockerfile .
Šimon DJ Čecháček
Okay, is there a location where the dockerfile i stored? Or should I just copy it?
Atif
Atif6mo ago
pull your template from coder coder template pull <TEMPLATE-NAME>
Šimon DJ Čecháček
I am unable to start the container on my desktop. Are there any Variables that coder uses to start the container? I am sorry but I never worked with self-built Docker images. :/ I was able to pull the template to my windows machine and build it, but it will instantly crash with exit code 0 after start a container Okay, made it work to a level that I can access te terminal in docker. And yes, it created a ubuntu user folder. but as there is no terraform, it will not finish all my scripts and stuff, so I do not know if it works correctly. but I do not understand adding one package as ZIP zo the dockerfile will do such a change. I really checked in diff checker and the zip \ line is the only difference. Maybe it is something with ubuntu 24.04 being used now? as I did not specify the ubuntu version in the docker file? Anyway, I removed the latest version, took the last working (wihtout the one line) and added ze zip install as a separate RUN sudo apt-get install -y zip command and now it works just fine 😄 Okay. I think thats the change, ubuntu version change is the issue. When I starta new workspace, runs fine. When I update an old one, issue appears
Solution
Atif
Atif6mo ago
Thank you. We should probably pin Ubuntu version in the example templates
Šimon DJ Čecháček
Yea that should help. I tested it on all my workspaces and I can confirm that the issue appears on all of them that were creqated with 23.04 version. Luckily there is a single fix, just open the terminal on even not fully started workspace (as it fails to start completely) and run sudo chown -R $USER:$USER /home/$USER. Then you restart and workspace works just fine on a new version and can even be updated to a new versions with no problems.
dodgepong
dodgepong3w ago
Hi there, doing a Discord server search and ran into this same issue. Is adding a chown command before startup really the solution here? Interestingly, I get this error when starting up the upgraded workspace:
cp: cannot create regular file '/home/btorell/.bash_logout': Permission denied
cp: cannot create regular file '/home/btorell/.bashrc': Permission denied
cp: cannot create regular file '/home/btorell/.profile': Permission denied
cp: cannot create regular file '/home/btorell/.bash_logout': Permission denied
cp: cannot create regular file '/home/btorell/.bashrc': Permission denied
cp: cannot create regular file '/home/btorell/.profile': Permission denied
though the workspace does start (btorell is my user) And SSHing into the server gives me this:
==> ⧗ Running workspace agent startup scripts (non-blocking)
2024-10-02 12:09:42.717-04:00 Startup Script: cp: cannot create regular file '/home/btorell/.bash_logout': Permission denied
2024-10-02 12:09:42.717-04:00 Startup Script: cp: cannot create regular file '/home/btorell/.bashrc': Permission denied
2024-10-02 12:09:42.717-04:00 Startup Script: cp: cannot create regular file '/home/btorell/.profile': Permission denied
=== ✘ Running workspace agent startup scripts (non-blocking) [21ms]
Warning: A startup script exited with an error and your workspace may be incomplete.
For more information and troubleshooting, see https://coder.com/docs/templates/troubleshooting#startup-script-exited-with-an-error and https://coder.com/docs/templates/troubleshooting
==> ⧗ Running workspace agent startup scripts (non-blocking)
2024-10-02 12:09:42.717-04:00 Startup Script: cp: cannot create regular file '/home/btorell/.bash_logout': Permission denied
2024-10-02 12:09:42.717-04:00 Startup Script: cp: cannot create regular file '/home/btorell/.bashrc': Permission denied
2024-10-02 12:09:42.717-04:00 Startup Script: cp: cannot create regular file '/home/btorell/.profile': Permission denied
=== ✘ Running workspace agent startup scripts (non-blocking) [21ms]
Warning: A startup script exited with an error and your workspace may be incomplete.
For more information and troubleshooting, see https://coder.com/docs/templates/troubleshooting#startup-script-exited-with-an-error and https://coder.com/docs/templates/troubleshooting
I guess I'll make a new thread
Atif
Atif3w ago
If your base image is Ubuntu 24.04 it contains a built-in user ubuntu with uid 1000. It might be conflicting with your user permissions. You can either delete the built-in user or user a different uid for your user in your Dockerfile
Want results from more Discord servers?
Add your server