Skip to content
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

Fix for 'You are attempting to run Meteor as the "root" user' issue #120

Closed
wants to merge 1 commit into from

Conversation

dduvnjak
Copy link

This is a simple fix for the issue described on meteor/meteor#7959. Latest version of meteor cli doesn't allow the build command to run as root user, which broke the docker build.

@abernix
Copy link

abernix commented Oct 27, 2016

First of all, as a reminder, if you're using Meteor 1.4+ you should not be using this image because of other very important reasons (binary dependencies, node versions, etc). See recent conversation in #119 for more on that. If you're using newer versions of Meteor (1.4+), I'd highly recommend taking a look at @jshimko's meteor-launchpad which I've just become aware of – though I'm not sure it's compatible with mup.

For Meteor 1.3 users though, I don't believe the fix you're proposing would actually work, specifically because of the issue described in meteor/meteor#7959. Merging this change into this image still completely breaks because the --unsafe-perm flag still gets passed to the older versions of Meteor which are not aware of it – which is what meteor/meteor#7959 (and the attached PR) is documenting/fixing. This should fix itself when Meteor 1.4.2.1 is released, which will hopefully come in the next 24 hours.

Unfortunately, I have no idea of an easy work around if you're using this docker image until Meteor 1.4.2.1 comes out.

@abernix
Copy link

abernix commented Oct 27, 2016

this docker image will always pull down the latest version of meteor dsitribution.

The fact that it pulls down the latest version of the Meteor distribution is the exact problem and what is being described by everyone in that issue. The latest version of the Meteor tool simply passes its arguments to older versions (a process known as springboarding) which it also automatically downloads if it doesn't have. When it passes --unsafe-perm to Meteor 1.4.1.3 which has no idea what --unsafe-perm is, it crashes.

I actually used this fix to build a meteor 1.1.6 project and it worked.

I'm not sure what Meteor 1.1.6 (that's not a Meteor version, maybe you mean meteor-tool?) but it doesn't work for me on Meteor 1.1.0.3 (which uses [email protected]) :

$ meteor create --release  1.1.0.3 test-root-run-1.1.0.3
test-root-run-1.1.0.3: created.

To run your new app:
  cd test-root-run-1.1.0.3
  meteor
$ cd test-root-run-1.1.0.3
$ sudo meteor build

You are attempting to run Meteor as the "root" user. If you are developing, this is almost certainly *not* what you want to do and will likely result in incorrect file permissions.
However, if you are running this in a build process (CI, etc.) or you are absolutely sure you know what you are doing, add the `--unsafe-perm` flag to this command to proceed.

$ sudo meteor build --unsafe-perm

You have run Meteor as root. Your permissions in your app directory will be incorrect if you ever attempt to perform any Meteor tasks as your non-root user. You probably didn't want
this, but you can fix it by running the following from the root of your project:

sudo chown -Rh <username> .meteor/local

--unsafe-perm: unknown option.
... snipped ...

@dduvnjak
Copy link
Author

You're right, I just reran the automated build and it failed with the same error.
Not sure how it worked when I ran it manually, I must have missed something.

@dduvnjak dduvnjak closed this Oct 27, 2016
@abernix
Copy link

abernix commented Oct 27, 2016

If you're changing the image yourself already, the workaround for the next 24 hours or so would be to change this line to use https://install.meteor.com/?release=1.4.1.3 and add METEOR_NO_RELEASE_CHECK=true at the beginning of this line. That should work!

@dduvnjak
Copy link
Author

Thanks man, I'll give it a shot 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants