craftcms / nitro

Speedy local dev environment for @craftcms.
https://getnitro.sh
MIT License
178 stars 24 forks source link

[Nitro 3] `unable to find user nitro: no matching entries in passwd file` #408

Closed mattstein closed 2 years ago

mattstein commented 3 years ago

Description

I’ve built Nitro locally, including the proxy and images, on my Mac. Starting completely fresh, after removing all Docker volumes and images and rebuilding (with export NITRO_DEVELOPMENT=true permanently added to my .zshrc profile), I can use nitro add once successfully. Adding one or more new sites, however, results in every site responding with either a blank page or Nitro’s generic default page:

Screen Shot 2021-09-09 at 10 33 53 AM@2x

Attempting to access a static file (like web/test.txt) returns an empty response.

In either case (empty response or default page), I cannot use nitro ssh to investigate the web container:

❯ nitro ssh
connecting to starterblog.nitro
unable to find user nitro: no matching entries in passwd file
Error: exit status 126

That “unable to find user nitro” message is identical regardless of which site I attempt.

The end result is that I can only use Nitro for one site after a fresh install before all sites are unusable.

I had been using Nitro 3 with multiple sites just fine, but it seems this only-one-site-before-they’re-all-borked problem is newer—probably introduced in the past two weeks?

I first assumed I’d made a mess not properly deleting Nitro’s existing volumes and images, but I definitely removed all Docker volumes and images from my system before this previous fresh install. (Also deleted ~/.nitro/nitro.yaml.)

Steps to reproduce

  1. Bulldoze and repave with nitro destroy, manually using the Docker GUI to “clean up” all volumes and images, and deleting nitro.yaml.
  2. Check out latest Nitro 3 branch and build locally.
    • git pull origin
    • export NITRO_DEVELOPMENT=true
    • make local
    • make proxy
    • make images
  3. Initialize with nitro init.
  4. Pick a project and set up a site for it using nitro add and following the prompts.
  5. Confirm the working site from step 4 in a browser.
  6. Repeat step 4 and nitro add another project.
  7. Observe that the original and new projects each return either an empty page or Nitro’s default page in the browser, instead of whatever you’d expect for that site.
  8. Attempt to nitro ssh into either project, and observe the “unable to find user nitro“ error as described above.

Additional info

mattstein commented 3 years ago

Started over again and have now added three sites without issue. 🙃

mattstein commented 3 years ago

Turns out the issue is with Nitro pulling public images. It seems you can get around the issue by adding export NITRO_DEVELOPMENT=true to your shell profile, and you can force it by inconsistently exporting that environment variable in a session and using Nitro with and without it.

Attaching docker inspect output for a healthy site and one that’s borked.

craftcom-working.txt craftcom-borked.txt

jasonmccallister commented 2 years ago

I believe we got this resolved in our local build @mattstein because it was a routing issue?

mattstein commented 2 years ago

I think so. I just plopped export NITRO_DEVELOPMENT=true into my shell profile and haven’t run into this since.

Boils down to user error, and only in the case of building Nitro for local development.

jasonmccallister commented 2 years ago

Sounds great!