title: MongoDB - shutting down with code:100
body: <p>I've been trying to set up MongoDB on my <code>Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-22-generic x86_64)</code> VPS and I've been running into a few problems. I am running as a user on my server that has <code>root</code> access but not using the <code>root</code> account itself.</p>
  
  <p>I started to notice the problem when I was executing <code>db.createUser()</code> on the <code>admin</code> database so I could add other users and I was getting this error:
  <code>not authorized to execute command</code></p>
  
  <p>So I then proceeded to uninstall and install again using the tutorial as provided on the website: <a href="https://docs.mongodb.com/v3.2/tutorial/install-mongodb-on-ubuntu/" rel="noreferrer">https://docs.mongodb.com/v3.2/tutorial/install-mongodb-on-ubuntu/</a></p>
  
  <p>Now when I'm on stage <strong>2 Verify that MongoDB has started successfully</strong> on the <strong>Run MongoDB Community Edition</strong> section, that is I look at my output from the file <code>/var/log/mongodb/mongod.log</code>, I get the following: </p>
  
  <pre><code>2017-04-14T14:23:09.309+0200 I CONTROL  [main] ***** SERVER RESTARTED *****
  2017-04-14T14:23:09.316+0200 I CONTROL  [initandlisten] MongoDB starting : pid=9691 port=27017 dbpath=/var/lib/mongodb 64-bit host=vps338741
  2017-04-14T14:23:09.316+0200 I CONTROL  [initandlisten] db version v3.4.3
  2017-04-14T14:23:09.316+0200 I CONTROL  [initandlisten] git version: f07437fb5a6cca07c10bafa78365456eb1d6d5e1
  2017-04-14T14:23:09.316+0200 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
  2017-04-14T14:23:09.316+0200 I CONTROL  [initandlisten] allocator: tcmalloc
  2017-04-14T14:23:09.316+0200 I CONTROL  [initandlisten] modules: none
  2017-04-14T14:23:09.316+0200 I CONTROL  [initandlisten] build environment:
  2017-04-14T14:23:09.316+0200 I CONTROL  [initandlisten]     distmod: ubuntu1604
  2017-04-14T14:23:09.316+0200 I CONTROL  [initandlisten]     distarch: x86_64
  2017-04-14T14:23:09.316+0200 I CONTROL  [initandlisten]     target_arch: x86_64
  2017-04-14T14:23:09.316+0200 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
  2017-04-14T14:23:09.349+0200 I STORAGE  [initandlisten] 
  2017-04-14T14:23:09.349+0200 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
  2017-04-14T14:23:09.349+0200 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem
  2017-04-14T14:23:09.349+0200 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=464M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
  2017-04-14T14:23:09.366+0200 E STORAGE  [initandlisten] WiredTiger error (2) [1492172589:366629][9691:0x7f1755946cc0], file:WiredTiger.wt, connection: /var/lib/mongodb/WiredTiger.wt: handle-open: open: No such file or directory
  2017-04-14T14:23:09.367+0200 I -        [initandlisten] Assertion: 28595:2: No such file or directory src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 267
  2017-04-14T14:23:09.367+0200 I STORAGE  [initandlisten] exception in initAndListen: 28595 2: No such file or directory, terminating
  2017-04-14T14:23:09.367+0200 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
  2017-04-14T14:23:09.367+0200 I NETWORK  [initandlisten] removing socket file: /tmp/mongodb-27017.sock
  2017-04-14T14:23:09.367+0200 I NETWORK  [initandlisten] shutdown: going to flush diaglog...
  2017-04-14T14:23:09.367+0200 I CONTROL  [initandlisten] now exiting
  2017-04-14T14:23:09.367+0200 I CONTROL  [initandlisten] shutting down with code:100
  </code></pre>
  
  <p>I've looked around and it is not the same error <a href="https://stackoverflow.com/questions/41420466/mongodb-shuts-down-with-code-100">as found here</a>, because that is to do with the fact there isn't an <code>/data/db</code> folder which I have. From that log I can see it is something to do with this line:</p>
  
  <pre><code>2017-04-14T14:23:09.366+0200 E STORAGE  [initandlisten] WiredTiger error (2) [1492172589:366629][9691:0x7f1755946cc0], file:WiredTiger.wt, connection: /var/lib/mongodb/WiredTiger.wt: handle-open: open: No such file or directory
  </code></pre>
  
  <p>Which is true, when I go to <code>/var/lib/mongodb</code> and do <code>ls -l</code> it results with:</p>
  
  <pre><code>drwxr-xr-x 2 mongodb mongodb 4096 Apr 14 14:10 journal
  -rw-r--r-- 1 mongodb mongodb    0 Apr 14 14:02 mongod.lock
  -rw-r--r-- 1 mongodb mongodb    0 Apr 14 14:10 WiredTiger
  -rw-r--r-- 1 mongodb mongodb   21 Apr 14 14:10 WiredTiger.lock
  -rw-r--r-- 1 mongodb mongodb 1004 Apr 14 14:10 WiredTiger.turtle
  </code></pre>
  
  <p>But I don't know if I should manually create that file as not seen this problem elsewhere. I made sure that <code>mongodb</code> user has permissions on these files too as stated <a href="https://stackoverflow.com/questions/18524925/mongodb-service-wont-start">in the answer to this question</a>, but still no luck.</p>
  
  <p>I'm really at a loss as to what to do, any help would be very appreciated as this is my like fifth attempt at getting it working!</p>
  
  <p>Thanks!</p>