Vagrant up --provision issue

I am getting below error for vagrant up --provision

mongod-m103: + download_dataset
mongod-m103: + echo 'Downloading Dataset'
mongod-m103: Downloading Dataset
mongod-m103: + curl -s https://s3.amazonaws.com/edu-static.mongodb.com/lessons/M103/products.json.tgz -o products.json.tgz

The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
[root@isgmmldd01147 m103-vagrant-env]#

Could anyone help about this

The copy/paste you showed is not an actual error message. It’s simply the status display of the Vagrant provisioning.

I’m running it right now and I have noticed that the downloading of the dataset can take a looooong time. The dataset is pulled from Amazon AWS, but I guess that the MongoU hasn’t sprung for a world-wide CDN :slight_smile: For me in the Netherlands, data is trickling in at 40kBps. Guess I’d better leave it to download overnight :wink:

Hi

Thanks for update. Let me know once done your installation successfully. Actually I was tried 4-5 time but at that point it gives such status and come out on prompt.

Still later on I was able to do vagrant SSH and it is connected to created vm box but after that validate_box command is not working. It gives an error like validate_box command not found.

download_validators?

once you ssh’d did you run the above?

Hi Shubhangi,

Are you still not able to up your vagrant? If not, please look if your network is not blocking a request. And it will take time to download and run the first time. If you see any error message, then please let me know if I can help.

Here is the information needed to download validation scripts.

RUNNING VALIDATION SCRIPT

  • For first lab: Lab: Setting up the Vagrant Environment , you need to run validate command from your vagrant box i.e after you have ssh into you vagrant (after 7th point) like:

vagrant@m103:~$ validate_box

  • If by any chance, above command results into error like:

vagrant@m103:~$ validate_box

validate_box: command not found

Run below command from your vagrant box like:

vagrant@m103:~$ download_validators

It will download the required validation scripts. If by any bad luck, that too doesn’t work, re-provision vagrant from Point 5 to 7 (here). If it still doesn’t work, then don’t hesitate to post on the discussion forum. The validation scripts need to be run from outside the mongo shell but in the vagrant box, it won’t work from your local machine.

Let me know if you need more help.

Kanika

Hi,

I was tried download_validators but for this also, it is showing command not found. Now I will re-provision vagrant and let you know.

1 Like

Hi
Tried re-provision vagrant on same machine, also on another new machine but again facing the same issue. Find below some last lines of output.

mongod-m103: Setting up python-wheel (0.24.0-1~ubuntu1.1) ...
mongod-m103: + sudo pip install pymongo
mongod-m103: Downloading/unpacking pymongo
mongod-m103:   Running setup.py (path:/tmp/pip_build_root/pymongo/setup.py) egg_info for package pymongo
mongod-m103:
mongod-m103: Installing collected packages: pymongo
mongod-m103:   Running setup.py install for pymongo
mongod-m103:     building 'bson._cbson' extension
mongod-m103:     x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/include/python2.7 -c bson/_cbsonmodule.c -o build/temp.linux-x86_64-2.7/bson/_cbsonmodule.o
mongod-m103:     bson/_cbsonmodule.c:23:20: fatal error: Python.h: No such file or directory
mongod-m103:      #include "Python.h"
mongod-m103:                         ^
mongod-m103:     compilation terminated.
mongod-m103:     /tmp/pip_build_root/pymongo/setup.py:305: UserWarning:
mongod-m103:     ********************************************************************
mongod-m103:     WARNING: The bson._cbson extension module could not
mongod-m103:     be compiled. No C extensions are essential for PyMongo to run,
mongod-m103:     although they do result in significant speed improvements.
mongod-m103:     The output above this warning shows how the compilation failed.
mongod-m103:
mongod-m103:     Please see the installation docs for solutions to build issues:
mongod-m103:
mongod-m103:     http://api.mongodb.org/python/current/installation.html
mongod-m103:
mongod-m103:     Here are some hints for popular operating systems:
mongod-m103:
mongod-m103:     If you are seeing this message on Linux you probably need to
mongod-m103:     install GCC and/or the Python development package for your
mongod-m103:     version of Python.
mongod-m103:
mongod-m103:     Debian and Ubuntu users should issue the following command:
mongod-m103:
mongod-m103:         $ sudo apt-get install build-essential python-dev
mongod-m103:
mongod-m103:     Users of Red Hat based distributions (RHEL, CentOS, Amazon Linux,
mongod-m103:     Oracle Linux, Fedora, etc.) should issue the following command:
mongod-m103:
mongod-m103:         $ sudo yum install gcc python-devel
mongod-m103:
mongod-m103:     If you are seeing this message on Microsoft Windows please install
mongod-m103:     PyMongo using pip. Modern versions of pip will install PyMongo
mongod-m103:     from binary wheels available on pypi. If you must install from
mongod-m103:     source read the documentation here:
mongod-m103:
mongod-m103:     https://api.mongodb.com/python/current/installation.html#installing-from-source-on-windows
mongod-m103:
mongod-m103:     If you are seeing this message on macOS / OSX please install PyMongo
mongod-m103:     using pip. Modern versions of pip will install PyMongo from binary
mongod-m103:     wheels available on pypi. If wheels are not available for your version
mongod-m103:     of macOS / OSX, or you must install from source read the documentation
mongod-m103:     here:
mongod-m103:
mongod-m103:     http://api.mongodb.org/python/current/installation.html#osx
mongod-m103:     ********************************************************************
mongod-m103:
mongod-m103:       "The output above "
mongod-m103:     command 'x86_64-linux-gnu-gcc' failed with exit status 1
mongod-m103:     building 'pymongo._cmessage' extension
mongod-m103:     x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Ibson -I/usr/include/python2.7 -c pymongo/_cmessagemodule.c -o build/temp.linux-x86_64-2.7/pymongo/_cmessagemodule.o
mongod-m103:     pymongo/_cmessagemodule.c:23:20: fatal error: Python.h: No such file or directory
mongod-m103:      #include "Python.h"
mongod-m103:                         ^
mongod-m103:     compilation terminated.
mongod-m103:     /tmp/pip_build_root/pymongo/setup.py:305: UserWarning:
mongod-m103:     ********************************************************************
mongod-m103:     WARNING: The pymongo._cmessage extension module could not
mongod-m103:     be compiled. No C extensions are essential for PyMongo to run,
mongod-m103:     although they do result in significant speed improvements.
mongod-m103:     The output above this warning shows how the compilation failed.
mongod-m103:
mongod-m103:     Please see the installation docs for solutions to build issues:
mongod-m103:
mongod-m103:     http://api.mongodb.org/python/current/installation.html
mongod-m103:
mongod-m103:     Here are some hints for popular operating systems:
mongod-m103:
mongod-m103:     If you are seeing this message on Linux you probably need to
mongod-m103:     install GCC and/or the Python development package for your
mongod-m103:     version of Python.
mongod-m103:
mongod-m103:     Debian and Ubuntu users should issue the following command:
mongod-m103:
mongod-m103:         $ sudo apt-get install build-essential python-dev
mongod-m103:
mongod-m103:     Users of Red Hat based distributions (RHEL, CentOS, Amazon Linux,
mongod-m103:     Oracle Linux, Fedora, etc.) should issue the following command:
mongod-m103:
mongod-m103:         $ sudo yum install gcc python-devel
mongod-m103:
mongod-m103:     If you are seeing this message on Microsoft Windows please install
mongod-m103:     PyMongo using pip. Modern versions of pip will install PyMongo
mongod-m103:     from binary wheels available on pypi. If you must install from
mongod-m103:     source read the documentation here:
mongod-m103:
mongod-m103:     https://api.mongodb.com/python/current/installation.html#installing-from-source-on-windows
mongod-m103:
mongod-m103:     If you are seeing this message on macOS / OSX please install PyMongo
mongod-m103:     using pip. Modern versions of pip will install PyMongo from binary
mongod-m103:     wheels available on pypi. If wheels are not available for your version
mongod-m103:     of macOS / OSX, or you must install from source read the documentation
mongod-m103:     here:
mongod-m103:
mongod-m103:     http://api.mongodb.org/python/current/installation.html#osx
mongod-m103:     ********************************************************************
mongod-m103:
mongod-m103:       "The output above "
mongod-m103:     command 'x86_64-linux-gnu-gcc' failed with exit status 1
mongod-m103:
mongod-m103: Successfully installed pymongo
mongod-m103: Cleaning up...
mongod-m103: + download_dataset
mongod-m103: + echo 'Downloading Dataset'
mongod-m103: Downloading Dataset
mongod-m103: + curl -s https://s3.amazonaws.com/edu-static.mongodb.com/lessons/M103/products.json.tgz -o products.json.tgz

The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
[root@isgmmldd31144 m103-vagrant-env]#

I was tried download_validators but for this also, it is showing command not found. Now I will re-provision vagrant and let you know.

I have the same problem, I tried to re-provision vagrant and have same problem again… What to do?

I have downloaded validator scripts directly from url specified in provision-mongod file and placed on required location. It worked for me.

2 Likes

Thnaks for the answer :slightly_smiling_face:

¿Como solucionaste? el problema

Hi Luis,

Please check this post here.

Let me know if you need more help!

Kanika

My vagrant side of things seems to be working. I receive a validation code when I enter validate_box at vagrant prompt.
But I still can’t boot mongod with or without --config. It hangs there waiting for connection to port 27017.
I’ve tried mongod --port 27000 and with --bind_ip 127.0.0.1 but it still hangs waiting for connection to port 27000.
What’s the best way to uninstall vagrant and Virtual Box. I need to start again. Even though I’ve just updated my Ubuntu server and that was an effort and not without warnings on that.

Mongod does not hang but stay connected to the terminal when --fork is not specified on the command line with --logpath. It also say connected to the terminal when a configuration file is specified and logs are not redirected to a file (or logging utility).

You may read about mongod and the command line options at https://docs.mongodb.com/manual/reference/program/mongod/ and about the configuration file at https://docs.mongodb.com/manual/reference/configuration-options/.

Pay attention to the --fork and --logpath command line options and processManagement: and systemLog: configuration file sections.

1 Like

@steevej is right: it’s not “hanging”, it’s working like it should. In Unix, many processes that are started manually will simply stay in your terminal, so you can follow their log output. MongoD does this too, unless you specifically tell it to go away (fork) and to send it’s logs elsewhere (logpath).

I don’t understand what you’re saying about --fork. I’ve successfully run the flag with the logpath. What I have now is a broken package. I just want to uninstall and reinstall cleanly. I can’t successfully run vagrant up --provision now. I’ve tried changing settings in the VBox gui, such as enabling the server on 192.168.103.1-24, which wasn’t, and setting the network to internal network (it was on NAT). The shared folders setting seem to be as you’d expect but I’ve never been able to ls them at the vagrant@m103:~$ prompt and certainly never been able to run Mongod with a --config flag to a file, even when I create the file on the Nano editor and save to the working directory.
So, is there any advice to an uninstall followed by a reinstall?
Do I just reinstall and hope it cleans up any issues in the process?
In the event I persevere with the course, having reinstalled (a heroic assumption) is there something about “graceful” exits from mongo shell and from the vagrant prompt and from the cmd shell that I need to be religious about?

I think I mean ls at the mongo shell prompt not the vagrant prompt. It’s been days since I’ve got that far.

The command ‘ls’ has to be run from the vagrant shell, not on the mongo shell.

I understand the misunderstanding. There is 3 level of shell.

  1. The windows shell aka PowerShell or cmd.exe : From there you execute the 'vagrant' commands such as 'vagrant up', 'vagrant ssh' ...
  2. The vagrant (linux) shell. The command 'vagrant ssh' connects you to the vagrant VM and present you with the shell prompt 'vagrant@m103:~$ '. From this you invoke commands such as 'mongod' to start the server, 'mongo' to start the mongo shell, 'ls' to get the list of files, 'netstat' and 'ps' to see what is running in the vagrant machine. This is also where you run the 'validate_...' script for the labs.
  3. Finally there is the mongo shell. Sometime the prompt is simply '>', at other time it is 'MongoDB Enterprise > ' or 'MongoDB Enterprise Cluster0-shard-0:PRIMARY> '. This is were you run commands like 'show dbs', 'show collections', 'use MyDatabaseName', 'db.MyCollectionName.find()'. And from this course commands 'rs.isMaster()'.
2 Likes

You don’t have to reinstall anything. It is expected behaviour that MongoD stays on your terminal window, waiting for incoming connections, unless you tell it to “–fork”. If that’s done, the terminal will return the prompt to you when MongoD has started.

When it comes to the basics that @steevej-1495 describes, I can heartily recommend Linux Academy or one of the many trainings on Safari Books. A basic intro to Linux would help you quickly grasp the differences between the various layers we’re working with.

I’ll try installing the box on a second laptop. I’ve emailed Vagrant to see if they’d help me with uninstall. Otherwise, I’ll just do it. I’m just concerned that I’d leave legacy issues, since I’ve found compounding issues.
When I looked at the task manager the last time vagrant up failed, I had 3 instances of VBoxHeadless running, although only one is running in the CPU, the other two occupied memory only. The Vbox Interface was also in memory.
I was never able to site any host files from the vagrant vagrant@m103:~$ prompt. Shouldn’t I be able to do that with the ls command?
And when I wrote a config file to the directory that the prompt was issued at (using the online editor) mongod wouldn’t pick it up. (I ran the config file through a yaml verifier. Everything was good.)
Of course, now I can’t do a thing. So it’s over to another lap top.