-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
wp-env: No longer working on Linux #20180
Comments
Sorry to hear about the trouble. Note that build scripts use Would a good first step be to add simple dummy |
It does sound as if that PR caused the issue. Instead of downloading the required files to cwd /wordpress and then putting a docker-compose override there, the new setup creates the docker-compose file and other dependencies at
I think yes. :) The wp-env tool is new enough that use cases like your own are still being uncovered. Indeed, your first issue dealing with the @wordpress/scripts env command was essentially the first point that @wordpress/env was really mentioned as the best way to start a local environment, so you're really on the bleeding edge of things here! 😁 I've been fixing other issues I'm finding along the way (#20158, #20157, #20113), and hopefully we can make this a robust tool for local wordpress environment. (It is already working much faster than the old @wordpress/scripts based solution when it works :)) If you like, you could try to fix the issue. I could see it being hard to replicate it since I don't have a linux box. I think the problem happens at these lines: gutenberg/packages/env/lib/env.js Lines 215 to 227 in a59a5d9
You can run the source code directly while developing (no need to build anything) $ path/to/gutenberg/packages/env/bin/wp-env start In the short term (and I hate suggesting this), I wonder if |
I run Ubuntu on Virtual box. It's like wading through slag in a treacle body suit, but it's good enough for testing. |
Sorry you're running into issues @ockham! Like @noahtallen says, I suspect that your user doesn't have write permission for the new environment temporary directory (
Replace We may need to look at using a different directory for |
I'm afraid that doesn't fix the issue. |
Possibly related: https://stackoverflow.com/questions/53344380/errno-13-while-running-docker-compose-up (I'm doing this inside of my home directory tho, so the answer about adding it to some AppArmor config don't seem to apply 🤔 ) |
AFAICT, the error is happening on this line: gutenberg/packages/env/lib/env.js Line 57 in 9d67638
Since Specifically, I think that prior to #20002, |
Nah, nothing to do with the diff --git a/packages/env/lib/env.js b/packages/env/lib/env.js
index 94421544d2..ace4502a51 100644
--- a/packages/env/lib/env.js
+++ b/packages/env/lib/env.js
@@ -216,6 +216,8 @@ async function initConfig() {
const configPath = path.resolve( '.wp-env.json' );
const config = await readConfig( configPath );
+ config.dockerComposeConfigPath = path.resolve( 'docker-compose.yml' );
+
await fs.mkdir( config.workDirectoryPath, { recursive: true } );
await fs.writeFile( |
There's a chance that the issue I'm seeing is related to the I think this is a rather widespread and recommended way to install Docker on Ubuntu (and other Linux distributions), plus it seems to be overall well-maintained and provides up-to-date versions. I think it's also the simplest way to install Docker on a number of Linux distributions; compare e.g. with these instructions. In conclusion, it'd be good to make |
Interesting, so docker cannot run a As I mentioned in #20002, what do you think about having an environment variable to change |
FWIW, I reported the problem (Docker snap being unable to access file in a hidden directory) here: https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1863604 |
The docker snap cannot access directories that start with a "." in the home folder. This is a generic security mechanism for all snaps. I'd recommend moving the directory out of |
Thanks @anonymouse64! So @noahtallen I guess it'll be good to proceed with #20253. Is there any chance we can make the default a non-hidden directory, so wp-env works OOTB on Ubuntu? /cc @noisysocks @epiqueras |
Yes, we need #20253 as an additional measure, but I'd prefer to also remove the |
The only thing I can think is that pretty much all developer dev tool folders like this are hidden by default. Not sure why, but it is the common practice: @ockham fantastic, I'll update the path in that PR as well. Maybe just on linux to start (if possible), but could also do it overall. |
Just on Linux would be better. Having it hidden is still nice, if possible. |
Would something like |
Does Linux also have that directory? |
I searched briefly and it looks like Oh well. I don't much mind. A hidden directory is preferable since the contents of |
Let's track https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1863604 and remove it ASAP. |
https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1863604 is closed with |
What’s the security concern?
|
@epiqueras Below is the copy of the answer.
|
Definitely :) I was mostly trying to test wp-env behavior at the time, which is why I used master (from the other plugin that I develop in) |
I ran ℹ NodeGit: Cloning or getting the repo.
ℹ NodeGit: Repo already exists, get it.
ℹ NodeGit: Fetching the specified ref.
ℹ NodeGit: Checking out the specified ref.
⠦ Downloading WordPress.
- core: 100/100%Creating network "6ac6b03bd54e5e922f0d180f6d7ff25d_default" with the default driver
✖ EACCES: permission denied, open '/home/me/wp-env/6ac6b03bd54e5e922f0d180f6d7ff25d/tests-WordPress/wp-config.php'
[Error: EACCES: permission denied, open '/home/me/wp-env/6ac6b03bd54e5e922f0d180f6d7ff25d/tests-WordPress/wp-config.php'] {
errno: -13,
code: 'EACCES',
syscall: 'open',
path: '/home/me/wp-env/6ac6b03bd54e5e922f0d180f6d7ff25d/tests-WordPress/wp-config.php'
} Not sure that's very useful tho 😅 |
- Uses a non-hidden default directory for Linux (~/wp-env) - Allows a user to override the directory in which wp-env creates generated files with the WP_ENV_HOME environment variable. Work towards #20180, but will need to continue in a follow-up.
- Uses a non-hidden default directory for Linux (~/wp-env) - Allows a user to override the directory in which wp-env creates generated files with the WP_ENV_HOME environment variable. Work towards #20180, but will need to continue in a follow-up.
After #20648 is merged, I can run the NOTE: For some reason, it fails at the first attempt like below:
But after that, it works without any problem:
If it's the case for everyone, we might need to close this issue and focus on solving why |
Is sudo required just the first time or also on all the subsequent runs? |
@noahtallen every time. |
I realized that the Docker env was working, even though I was still getting
The latter has just been fixed by #22682, so I'll close this issue. (I'm still getting an |
wait, what's this error!? 😋 @sainthkh Is the DB connection issue still problematic? Also, regarding |
Actually, things became worse after I upgraded to Ubuntu 20.04. It just fails with the segmentation fault message even with Because of that, I'm currently working on Windows. |
That's too bad. Could you open a new issue with that specific error message? |
@noahtallen Opened an issue at #22731. |
Thank you! didn't want to clutter this one up too much more, since it has already covered two or three different issues 😅 |
On WSL 2 (Ubuntu 20.04), and ran into this recently. The |
@ockham - Was this patched and just not released yet? I'm on the latest release and this is still happening for me. I'm having to do the |
@danieliser there was another (similar) issue I fixed in #23797. Can you paste the output of the error you see when running wp-env a second time so that we can see if the error is the same?
This specific issue should have been released, but the one I mentioned above has not yet been released :/ |
If you're running wp-env from Gutenberg, though, you should be referencing the local source code (e.g. npx wp-env or npm run wp-env), and shouldn't see issues developing the gutenberg project specifically. |
@noahtallen - Not using it for Gutenberg, just in general plugin development and testing. Hasn't happened today yet, but I will post the error. It was this same one though:
|
Does it happen every time you run Btw, this issue should fix this altogether and make filesystem permissions in wp-env work a lot better: #22515. But it needs some eyes and work to make progress |
@noahtallen No it seems to be related to either restarting the host OS (Windows 10) or the rebooting of the WSL vm. This one came up today after a reboot:
After running the command to fix it I still got this:
|
🙃 By the way, do you use |
No, I haven't had to do that. |
@danieliser I guess you have made special post setup docker group setup because in fact @noahtallen is correct that you can not run any https://docs.docker.com/engine/install/linux-postinstall/ Enabling it without sudo opens a security hole, running docker without root seems to have many restrictions and requires complicated extra setup. But running npm script with sudo is a total nogo, that it probably the biggest security risk. I guess I will go with the docker group thing. I have not tried it, but I guess it would work with sudo just like direct docker commands. |
I set up Gutenberg development on a new Linux box recently, and doing the postinstall steps to add my user to the docker group was a requirement to get wp-env working. I agree with you that requiring |
I'm running into this issue with a Raspberry Pi. I've run all post install steps in the Docker docs. Everything works fine the first time I start wp-env, but any subsequent times I restart it, I run into either the It seems the files it's complaining about are attached to the root user, instead of your current user that has been added to the docker group. |
Describe the bug
For the past couple of days, I haven't been able to run
wp-env
on my Linux box.To reproduce
On Linux, in your Gutenberg source directory, run
npx wp-env start
. It'll fail with the following error:(I got the same error with
npm -g i @wordpress/env && wp-env start
.)Desktop (please complete the following information):
Additional context
This might correlate with #20002 being merged, but I'm not sure it's caused by that PR. /cc @noisysocks
Can we harden Gutenberg against issues like this? For the past ten days, of the time I spent working on Gutenberg, an estimated 50% went into trying to get it to run, figuring out that docs were outdated, updating them, and, just as I thought that things were running smoothely, getting stuck again with this new issue. That doesn't feel like a good use of my time 🙁
The text was updated successfully, but these errors were encountered: