-
Notifications
You must be signed in to change notification settings - Fork 486
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
Storage folder write permissions fail on newly installed Sail #81
Comments
I've rebuilt the images to the PHP 7.4 version, used |
Hi there, Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels: However, this issue will not be locked and everyone is still free to discuss solutions to your problem! Thanks. |
@driesvints, I installed Sail exactly step by step as instructed in the official guide, and it reports a malfunction upon first use, I would classify this as a bug. |
@cyrrill I can write to the storage folder just fine and this is the first report we've gotten on it. Please try a support channel. |
Currently on the host the storage folder is at 775, and when I The issue appears possibly to be with the
Don't really have time to delve into making this work at the moment, was hoping it would work out of the box. (and it likely does for freshly installed L8 apps) Thanks for getting back to me though, will try this another time or check on Laracasts as you suggest 👍 |
For reference this is not an isolated issue and has been reported before: https://laracasts.com/discuss/channels/laravel/groupadd-invalid-group-id-sail |
@cyrrill Are you running Docker in rootless mode? |
Hi @hirusi, thanks for following up on this. On first attempt I was running it as default which requires root, given that the Dockerfile requires access to port 80 which is privileged on Linux. After seeing the issue with the permissions, I installed rootless mode and allowed port 80 via |
I'm writing down my discoveries and attempts to make 775 work over here, but unfortunately, like you, I haven't had a breakthrough on a clean solution yet. I'm not sure how far I'll push my attempts, but I have subscribed to the thread here and would love to keep up with what anyone else is attempting. Edit: I saw you mentioned somewhere up that "it probably works fine on a fresh L8 app." That's not the case for me. |
This bug is also present here. I can't write to the laravel.log in the storage folder after going through the Laravel installation guide. I'm using WIN10,docker desktop+ ubuntu20.04 WSL2. This is not an isolated incident |
I have this problem whenever I use laravel sail, both in new and old applications! I use Linux Ubuntu 20.04 I fix this problem these problems using inside the project repository: $ sudo chmod -R 777 storage I tried to write this command using This is not an isolated incident |
I also have many many issues with permissions with:
Not sure which user or group are these files/folders meant to belong to. No issues on a machine running Arch however. |
Hi @driesvints, There have been 4 other people having this issue. Any chance you could consider having a look again? Or at the very least update the documentation to explain how this is supposed to work? |
Is |
I've had this issue with WSL2. The ProblemLaravel Sail executes all commands using the 'sail' user and you can see this in the The solution I did was to change the owners and groups of the html folder to their respective group so that the sail command will work. Temp fix
You should now stop running into permission errors on any sail command you run such as when you install jetstream. Potential Permanent SolutionMy guess is that on mac this problem doesn't happen because the user groups are set up correctly however on WSL2 they are set as root. Perhaps someone on a mac can let me know what the users and groups are set to for the html folder in the docker container. If they aren't set to root by default that could be the bug. Edit: This ended out being related to me running WSL2 as a root user instead of my regular user. |
I have installed docker the recommended way from docker docs. After the install was done I did sail up and headed to localhost and was presented with the same message. Tmp fix from @tomheadifen by changing the owner of the project worked for me |
This happens to me (Ubuntu 20.04 - docker Server Version: 20.10.1) as well when using sail, there is definitely something wrong with permissions here. |
Ok I've figured out my issue. I was running as wls2 as a root user and sail is not built to be running as the root user. Solutions
|
Hi guys, how are you? I believe I have figured out the problem to solve the problems, at least on linux! For MacOS and Windows it should have similar configuration but I didn't perform the tests. When we are running something with docker, we need to inform that our user "external" to the service container has permission to create, change files inside the service container. To do this, just run this comand in your terminal before run
I found this solution in this question on StackOverflow If you don't want to export these variables, you can use the following configuration within the service that runs the application in your
A point of attention, the value 1000 is my user's UID, follow the article to understand about UID and how to find your user's UID If I knew how Sail works I would create a PR with these updates, it would be interesting if Laravel's team look my solution ps: Sorry for my English, I'm learning and I used google translate to help me Regards, Nicolas |
Solves it, and if your user id is not 1000 just set it in .env file.
|
For me the problem in the end was that I was using WSL2 with I'm just going back to a regular user account instead of keeping on using |
I also have this problem with permissions in sail( |
using one of the artisan commands works for m php artisan optimize <--- this did not work |
If you are using Sail (Docker) then try this command
It's Solve my storage folder access issue, I am using Laravel 9. |
Hi, I have been struggling with this issue recently, I am using windows 10 and WSL2 and start/run sail container from Docker Desktop, turns out it was a mistake, I should have run it from WSL by running |
Have you tried this ? |
Yes, and it worked !
…On Thu, Mar 24, 2022, 2:30 PM Techinfocomp ***@***.***> wrote:
Hi, I have been struggling with this issue recently, I am using windows 10
and WSL2 and start/run sail container from Docker Desktop, turns out it was
a mistake, I should have run it from WSL by running sail up -d command
since when you look at script file it contains what @NicolasPereira
<https://github.com/NicolasPereira> mentions, and it's been running fine.
Have you tried this ?
sail artisan storage:link
—
Reply to this email directly, view it on GitHub
<#81 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AI3BT3BAMLIZ5GFYFY53FXTVBQK2PANCNFSM4ZYXY44Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
That's Nice. Have a good day. |
Glad to hear it!
…On Thu, Mar 24, 2022, 10:00 PM Harsh Gupta ***@***.***> wrote:
Yes, and it worked !
… <#m_4874753885818855053_>
On Thu, Mar 24, 2022, 2:30 PM Techinfocomp *@*.*> wrote: Hi, I have been
struggling with this issue recently, I am using windows 10 and WSL2 and
start/run sail container from Docker Desktop, turns out it was a mistake, I
should have run it from WSL by running sail up -d command since when you
look at script file it contains what @NicolasPereira
<https://github.com/NicolasPereira> https://github.com/NicolasPereira
<https://github.com/NicolasPereira> mentions, and it's been running fine.
Have you tried this ? sail artisan storage:link — Reply to this email
directly, view it on GitHub <#81 (comment)
<#81 (comment)>>, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AI3BT3BAMLIZ5GFYFY53FXTVBQK2PANCNFSM4ZYXY44Q
<https://github.com/notifications/unsubscribe-auth/AI3BT3BAMLIZ5GFYFY53FXTVBQK2PANCNFSM4ZYXY44Q>
. You are receiving this because you commented.Message ID: @.*>
That's Nice. Have a good day.
—
Reply to this email directly, view it on GitHub
<#81 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AI3BT3B6B7A5A6557E2AX33VBR7RJANCNFSM4ZYXY44Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@matthiascw Same here: I did not find the time—nor the motivation—to delve into the reason(s) why that so-called « desktop-linux context » is not working with Sail. Honestly, I'm so busy at work, I can't really get any further than this on that specific topic. But I'm still wondering why @cyrrill, the original author of this thread, has once considered that this issue was closed; I mean, even with my fix, this thread should remain open. |
@basvdhoeven Glad to hear this! |
On the contrary, 2 years and 80+ comments later, I'm still following this thread hoping it actually gets fixed :) |
@cyrrill Oh! Sorry for my wrong assumption, my bad. Have you tried to escalate this issue elsewhere? |
@erictourigny23 not really, as this is the place where these bugs ought to get reported and the maintainer decided to close it. If you have luck elsewhere, please let us know. 👍 |
Can't believe this is still happening with a completely fresh and stock install of Linux and Docker. |
@driesvints Could there at least be some documentation added on this problem? Since it seems rootless or Desktop Docker seem to be the main culprits here and they aren't uncommon setups. |
Hi all. I'm sorry, I unsubscribed after my original comment and didn't see all the replies here. We'd be more than happy to accept a PR to the docs about some notes around this if anyone is willing to send one in. Sorry I didn't give this ticket the attention it deserved. |
@driesvints would it be possible to change the status of this issue back to open then? |
@driesvints I've made a PR which adds a warning about this issue to the docs (laravel/docs#8898). |
The docs have been updated: laravel/docs#8901. |
I was able to solve this by adding to docker-compose, in environment:
WWWUSER: '${WWWUSER:-1000}'
WWWGROUP: '${WWWGROUP:-$(id -g)}' Before adding this, |
for me the problem is because i'm using docker desktop. it cause the owner of container directory became root, but my user is sail. when i change the owner from root to sail my host also change into 100999:100999. now i can generate file using artisan make, but i can edit the file because of the ownership became 100999:100999. |
Yesterday I finally got the time to try out sail.
Does not work either. This should be a pretty big show stopper for a lot of people? |
I bumped into this as well and read this issue seeking for help. I'm running an Ubuntu 22.04, fresh install. The suggestions around changing the docker context lead me to uninstall Docker Desktop and to install Docker Engine the way we used to before Docker desktop, through Docker's apt repo (https://docs.docker.com/engine/install/ubuntu/). I also made the known configurations to be able to run Docker Engine CLI commands without sudo. With this, the problem went away for me. I know it's not really a solution but until there is one, maybe this will help other people like me trying to learn Laravel from an Ubuntu machine. |
@Dasher83 I am pretty sure this is what happened to me early this year. I was install docker on a lot of systems and early in that process I tried docker decktop for Linux and this is the only time I saw this issue. Using the Docker Engine is the way to go. |
Thank you so much. Thats worked for me. |
For me the solution was running:
|
A similar error could occur if you cleaned the cache, not through the |
This turned out to be the issue for me. Re-running as |
Hello ! RUN useradd -ms /bin/bash --no-user-group -o -g $WWWGROUP -u $WWWUSER sail And i set WWWGROUP and WWWUSER to 0:0 |
I'm able to reproduce this on a fresh install of Ubuntu 22.04.5 LTS, a fresh install of the latest version of Laravel, and a fresh install of Docker Desktop. Running From looking into this, the issue could be solved on Laravel's side by making sure that the user has proper access permission when the container is built. On Docker's side, there's something about Docker Desktop that makes this change necessary. If someone familiar with Sail wants to point me in the right direction, I'm happy to make a pull request to resolve. |
Description:
Unable to write to storage folder.
Steps To Reproduce:
I have installed Sail into an existing Laravel 8 application as per the installation guide. The container and associated services come up and yield no errors.
When I attempt to access the application from the browser, the exception mentioned above shows up.
Normally, all you need to do is
chmod
and/orchown
the /storage/ folder in order for Laravel to run.When I try to publish the Dockerfiles (in order to attempt to set permissions), I get this other exception:
The text was updated successfully, but these errors were encountered: