MongoDB, change db path, not working - mongodb

I upgraded from debian 6 to debian 8. After that I upgraded MongoDB from ~2.5 to 3.2.9. They seemed to have changed the db path since I could not see any of my databases. I upgraded the dbpath. Stil I can't see any of my databases.
seprst#SESTOWS011:/data/db$ ls
graddays graddays.0 graddays.ns journal local local.0 local.ns mongod.lock mypdb mypdb.0 mypdb.ns
seprst#SESTOWS011:/data/db$ sudo service mongod stop
seprst#SESTOWS011:/data/db$ mongod --dbpath /data/db
2016-08-17T12:02:26.468+0200 I CONTROL [initandlisten] MongoDB starting : pid=22283 port=27017 dbpath=/data/db 64-bit host=SESTOWS011
2016-08-17T12:02:26.468+0200 I CONTROL [initandlisten] db version v3.2.9
2016-08-17T12:02:26.468+0200 I CONTROL [initandlisten] git version: 22ec9e93b40c85fc7cae7d56e7d6a02fd811088c
2016-08-17T12:02:26.468+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t 3 May 2016
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] allocator: tcmalloc
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] modules: none
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] build environment:
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] distmod: debian71
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] distarch: x86_64
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] target_arch: x86_64
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] options: { storage: { dbPath: "/data/db" } }
2016-08-17T12:02:26.513+0200 I - [initandlisten] Detected data files in /data/db created by the 'mmapv1' storage engine, so setting the ac tive storage engine to 'mmapv1'.
2016-08-17T12:02:26.530+0200 I JOURNAL [initandlisten] journal dir=/data/db/journal
2016-08-17T12:02:26.545+0200 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2016-08-17T12:02:26.590+0200 I JOURNAL [initandlisten] warning couldn't write to / rename file /data/db/journal/prealloc.0: couldn't open file / data/db/journal/prealloc.0 for writing errno:9 Bad file descriptor
2016-08-17T12:02:26.590+0200 I STORAGE [initandlisten] exception in initAndListen: 13516 couldn't open file /data/db/journal/j._0 for writing er rno:9 Bad file descriptor, terminating
2016-08-17T12:02:26.590+0200 I CONTROL [initandlisten] now exiting
2016-08-17T12:02:26.590+0200 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2016-08-17T12:02:26.590+0200 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2016-08-17T12:02:26.590+0200 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2016-08-17T12:02:26.590+0200 I NETWORK [initandlisten] shutdown: going to close sockets...
2016-08-17T12:02:26.591+0200 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2016-08-17T12:02:26.591+0200 I STORAGE [initandlisten] shutdown: final commit...
2016-08-17T12:02:26.591+0200 I STORAGE [initandlisten] shutdown: closing all files...
2016-08-17T12:02:26.591+0200 I STORAGE [initandlisten] closeAllFiles() finished
2016-08-17T12:02:26.591+0200 I CONTROL [initandlisten] dbexit: rc: 100
seprst#SESTOWS011:/data/db$ sudo service mongod start
seprst#SESTOWS011:/data/db$ mongo
MongoDB shell version: 3.2.9
connecting to: test
Server has startup warnings:
2016-08-17T12:02:40.540+0200 I CONTROL [initandlisten]
2016-08-17T12:02:40.540+0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-08-17T12:02:40.540+0200 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-08-17T12:02:40.540+0200 I CONTROL [initandlisten]
> show dbs
local 0.000GB
>
Any suggestions?

there is formatting issue with comment so posting as answer
ps -xa | grep mongod
open config file cat /etc/mongod.conf
for me it's dbPath: /var/lib/mongodb
you can check your settings.
to make changes permanent at your own risk
sudo service mongod stop
sudo ln -s /data/db/ /var/lib/mongodb
sudo chown mongodb:mongodb /data/db/
sudo service mongod start
//test if mongodb user can access new location:
sudo -u mongodb -s cd /data/db/

Related

Mongod error (installed with homebrew)

I have installed mongodb with
brew install mongodb
Created folder
mkdir -p /data/db
Handle permissions
sudo chown -R `id -un` /data/db
Run
mongod
Error log
2018-01-06T14:28:51.450+0100 I CONTROL [initandlisten] MongoDB starting : pid=6120 port=27017 dbpath=/data/db 64-bit host=Zigas-MBP-2
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] db version v3.6.1
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] git version: 025d4f4fe61efd1fb6f0005be20cb45a004093d1
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2n 7 Dec 2017
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] allocator: system
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] modules: none
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] build environment:
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] distarch: x86_64
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] target_arch: x86_64
2018-01-06T14:28:51.451+0100 I CONTROL [initandlisten] options: {}
2018-01-06T14:28:51.452+0100 I - [initandlisten] Detected data files in /data/db created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
2018-01-06T14:28:51.470+0100 I JOURNAL [initandlisten] journal dir=/data/db/journal
2018-01-06T14:28:51.471+0100 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2018-01-06T14:28:51.494+0100 I JOURNAL [durability] Durability thread started
2018-01-06T14:28:51.494+0100 I JOURNAL [journal writer] Journal writer thread started
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten]
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten]
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** Remote systems will be unable toconnect to this server.
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-01-06T14:28:51.495+0100 I CONTROL [initandlisten]
2018-01-06T14:28:51.762+0100 F CONTROL [initandlisten] ** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details.
2018-01-06T14:28:51.762+0100 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2018-01-06T14:28:51.763+0100 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2018-01-06T14:28:51.763+0100 I REPL [initandlisten] shutdown: removing all drop-pending collections...
2018-01-06T14:28:51.763+0100 I REPL [initandlisten] shutdown: removing checkpointTimestamp collection...
2018-01-06T14:28:51.763+0100 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2018-01-06T14:28:51.763+0100 I STORAGE [initandlisten] shutdown: final commit...
2018-01-06T14:28:51.770+0100 I JOURNAL [initandlisten] journalCleanup...
2018-01-06T14:28:51.770+0100 I JOURNAL [initandlisten] removeJournalFiles
2018-01-06T14:28:51.770+0100 I JOURNAL [initandlisten] old journal file will be removed: /data/db/journal/j._0
2018-01-06T14:28:51.771+0100 I JOURNAL [initandlisten] Terminating durability thread ...
2018-01-06T14:28:51.870+0100 I JOURNAL [journal writer] Journal writer thread stopped
2018-01-06T14:28:51.870+0100 I JOURNAL [durability] Durability thread stopped
2018-01-06T14:28:51.870+0100 I STORAGE [initandlisten] shutdown: closing all files...
2018-01-06T14:28:51.883+0100 I STORAGE [initandlisten] closeAllFiles() finished
2018-01-06T14:28:51.883+0100 I STORAGE [initandlisten] shutdown: removing fs lock...
2018-01-06T14:28:51.883+0100 I CONTROL [initandlisten] now exiting
2018-01-06T14:28:51.883+0100 I CONTROL [initandlisten] shutting down with code:62
Any help would be apprichiated.
2018-01-06T14:28:51.762+0100 F CONTROL [initandlisten] ** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details.
This is the fault error in your log.
So I guess you have some 3.4 data in your /data/db.
If you want a clean installation, just remove the contents of /data/db and restart mongod
or
Get a 3.4 mongod
Ref: https://docs.mongodb.com/manual/release-notes/3.6-upgrade-standalone/
The error is telling you that you have mongo 3.4 data inside /data/db but you have version 3.6 of Mongo installed.
To fix this you can use one of the options listed below...
Remove the contents of /data/db and restart mongod. This should probably be backed up or you'll lose your data.
Install mongodb 3.4 you can check if you previously installed it using brew list --versions mongodb then if a 3.4.* version comes up, 3.4.10 for example use brew switch mongodb 3.4.10 to move back to that version. If you never had the version installed see this answer to install the older version Homebrew install specific version of formula?
Use #2 to move back to 3.4 then go into mongo shell using mongo and run db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } ). Exit the mongo shell and use the brew switch command to switch back to 3.6.

mongod src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp no file

I've really been all over StackOverflow on this and couldn't find a solution. I have uninstalled Homebrew and Mongo via, well, brew. Nothing seems to fix it. Any help would be much appreciated.
2017-08-03T20:29:40.017-0400 I CONTROL [initandlisten] MongoDB starting : pid=7684 port=27017 dbpath=/data/db 64-bit host=Matts-MacBook-Pro.local
2017-08-03T20:29:40.017-0400 I CONTROL [initandlisten] db version v3.4.6
2017-08-03T20:29:40.017-0400 I CONTROL [initandlisten] git version: c55eb86ef46ee7aede3b1e2a5d184a7df4bfb5b5
2017-08-03T20:29:40.017-0400 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2l 25 May 2017
2017-08-03T20:29:40.017-0400 I CONTROL [initandlisten] allocator: system
2017-08-03T20:29:40.017-0400 I CONTROL [initandlisten] modules: none
2017-08-03T20:29:40.017-0400 I CONTROL [initandlisten] build environment:
2017-08-03T20:29:40.017-0400 I CONTROL [initandlisten] distarch: x86_64
2017-08-03T20:29:40.017-0400 I CONTROL [initandlisten] target_arch: x86_64
2017-08-03T20:29:40.017-0400 I CONTROL [initandlisten] options: {}
2017-08-03T20:29:40.018-0400 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=3584M,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-08-03T20:29:40.019-0400 E STORAGE [initandlisten] WiredTiger error (2) [1501806580:19955][7684:0x7fffbdc783c0], file:WiredTiger.wt, connection: /data/db/WiredTiger.wt: handle-open: open: No such file or directory
2017-08-03T20:29:40.029-0400 I - [initandlisten] Assertion: 28595:2: No such file or directory src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 269
2017-08-03T20:29:40.029-0400 I STORAGE [initandlisten] exception in initAndListen: 28595 2: No such file or directory, terminating
2017-08-03T20:29:40.029-0400 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-08-03T20:29:40.029-0400 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2017-08-03T20:29:40.029-0400 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-08-03T20:29:40.029-0400 I CONTROL [initandlisten] now exiting
2017-08-03T20:29:40.029-0400 I CONTROL [initandlisten] shutting down with code:100
I also have to spent more than 4 hours to find a solution you asked. In my case, the stack trace is same as in your case.
I used MongoDB 4.2. But I need to downgrade it to MongoDB 3.4. After downgrading to 3.4 above error can be seen. Then again I updated MongoDB to 4.2. Still there was that error.
Tried many solutions on Stack Overflow but nothing solved my issue. As my final option I run below command.
mongod --dbpath /data/db --repair
But it also did not work.
There were some files on my /data/db directory.
Those are WiredTiger, WiredTiger.lock, WiredTiger.turtle, diagnostic.data, journal and mongod.lock.
Removed all the files in /data/db directory.
rm -rf /data/db/*
Run above command with sudo if you are not the root user.
Then I run mongod --dbpath /data/db --repair command again.
Then I could start MongoDB successfully by running mongod --dbpath /data/db.
Do not forget add bin/mongod to PATH in .bash_profile(If you are using Mac).

Trouble Starting MongoDB (Mac) - Code: 100

I installed MongoDB via Homebrew and seem to be having some trouble starting when I run the mongod command. I have tried setting a up the data/db directory correctly and viewed a few other answers on stackoverflow, but haven't been able to figure this out. Here is what I keep getting (sorry I am new to this):
2017-01-02T23:45:53.444-0500 I CONTROL [initandlisten] MongoDB starting : pid=1419 port=27017 dbpath=/data/db 64-bit host=Johns-MacBook-Pro-3.local
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] db version v3.4.0
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] git version: f4240c60f005be757399042dc12f6addbc3170c1
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] allocator: system
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] modules: none
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] build environment:
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] distarch: x86_64
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] target_arch: x86_64
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] options: {}
2017-01-02T23:45:53.446-0500 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=7680M,session_max=20000,eviction=(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-01-02T23:45:53.447-0500 E STORAGE [initandlisten] WiredTiger error (2) [1483418753:447985][1419:0x7fffe84c03c0], file:WiredTiger.wt, connection: /data/db/WiredTiger.wt: handle-open: open: No such file or directory
2017-01-02T23:45:53.457-0500 I - [initandlisten] Assertion: 28595:2: No such file or directory src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 267
2017-01-02T23:45:53.458-0500 I STORAGE [initandlisten] exception in initAndListen: 28595 2: No such file or directory, terminating
2017-01-02T23:45:53.458-0500 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-01-02T23:45:53.458-0500 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2017-01-02T23:45:53.458-0500 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-01-02T23:45:53.458-0500 I CONTROL [initandlisten] now exiting
2017-01-02T23:45:53.458-0500 I CONTROL [initandlisten] shutting down with code:100
Just create directory - /data/db/ on system hdd
This worked for me: sudo mongod --dbpath ~/data/db

Can't get MongoDB to start?

Version 2.67 of MongoDB is installed. When I run MongoD in Terminal (mac os x 10.95), here is the message I get. (BTW, I have tried Sudo)![Error][1]
Alis-MacBook-Air:~ alitaghikhani$ mongod
mongod --help for help and startup options
2015-02-08T19:00:43.915-0500 [initandlisten] MongoDB starting : pid=40591 port=27017 dbpath=/data/db 64-bit host=Alis-MacBook-Air.local
2015-02-08T19:00:43.916-0500 [initandlisten]
2015-02-08T19:00:43.916-0500 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2015-02-08T19:00:43.916-0500 [initandlisten] db version v2.6.7
2015-02-08T19:00:43.916-0500 [initandlisten] git version: nogitversion
2015-02-08T19:00:43.916-0500 [initandlisten] build info: Darwin minimavericks.local 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2015-02-08T19:00:43.916-0500 [initandlisten] allocator: tcmalloc
2015-02-08T19:00:43.916-0500 [initandlisten] options: {}
2015-02-08T19:00:43.919-0500 [initandlisten] exception in initAndListen: 10310 Unable to lock file: /data/db/mongod.lock. Is a mongod instance already running?, terminating
2015-02-08T19:00:43.919-0500 [initandlisten] dbexit:
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: going to close listening sockets...
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: going to flush diaglog...
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: going to close sockets...
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: waiting for fs preallocator...
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: lock for final commit...
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: final commit...
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: closing all files...
2015-02-08T19:00:43.920-0500 [initandlisten] closeAllFiles() finished
2015-02-08T19:00:43.920-0500 [initandlisten] dbexit: really exiting now
If it is the first time you are running MongoDB, make sure you have you have owner permission to create mongod.lock file to create in /data/db path.
sudo chown -R `id -u` /data/db
first try:
mongo localhost
to see if there already a mongod instance running. if not, you should delete the mongod.lock
sudo rm /data/db/mongod.lock
if means you had an unclear shutdown of mongod.
Important: this assumes you don't have anything important in the DB because it seems it's running on your macbook air.

Unable to start mongod service

I installed mongodb using the information in this link. However, when I user the service mongod start command I get the following error. Can someone help me troubleshoot?
[Piyush#localhost ~]$ service mongod start
/etc/init.d/mongod: line 54: ulimit: open files: cannot modify limit: Operation not permitted
/etc/init.d/mongod: line 56: ulimit: max user processes: cannot modify limit: Operation not permitted
Starting mongod: runuser: using restricted shell /bin/false
runuser: cannot set groups: Operation not permitted
[FAILED]
[Piyush#localhost ~]$ sudo service mongod start
[sudo] password for Piyush:
Starting mongod: [FAILED]
I tried using --repair command. I get the following output for that:
[Piyush#localhost ~]$ sudo mongod --repair
2014-09-24T00:05:06.089-0400 [initandlisten] MongoDB starting : pid=2807 port=27017 dbpath=/data/db 64-bit host=localhost.localdomain
2014-09-24T00:05:06.089-0400 [initandlisten] db version v2.6.4
2014-09-24T00:05:06.089-0400 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910
2014-09-24T00:05:06.089-0400 [initandlisten] build info: Linux build7.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-09-24T00:05:06.089-0400 [initandlisten] allocator: tcmalloc
2014-09-24T00:05:06.090-0400 [initandlisten] options: { repair: true }
2014-09-24T00:05:06.106-0400 [initandlisten] finished checking dbs
2014-09-24T00:05:06.106-0400 [initandlisten] dbexit:
2014-09-24T00:05:06.106-0400 [initandlisten] shutdown: going to close listening sockets...
2014-09-24T00:05:06.106-0400 [initandlisten] shutdown: going to flush diaglog...
2014-09-24T00:05:06.106-0400 [initandlisten] shutdown: going to close sockets...
2014-09-24T00:05:06.106-0400 [initandlisten] shutdown: waiting for fs preallocator...
2014-09-24T00:05:06.106-0400 [initandlisten] shutdown: closing all files...
2014-09-24T00:05:06.106-0400 [initandlisten] closeAllFiles() finished
2014-09-24T00:05:06.107-0400 [initandlisten] shutdown: removing fs lock...
2014-09-24T00:05:06.107-0400 [initandlisten] dbexit: really exiting now
[EDIT 1]_____________________________________________________________________________
In the log file I see:
[root#localhost ~]# cat /var/log/mongodb/mongod.log.2014-09-24T16-00-32
2014-09-24T11:54:23.636-0400 ***** SERVER RESTARTED *****
2014-09-24T11:54:23.665-0400 [initandlisten] MongoDB starting : pid=3004 port=27017 dbpath=/var/lib/mongo 64-bit host=localhost.localdomain
2014-09-24T11:54:23.665-0400 [initandlisten] db version v2.6.4
2014-09-24T11:54:23.665-0400 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910
2014-09-24T11:54:23.665-0400 [initandlisten] build info: Linux build7.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-09-24T11:54:23.665-0400 [initandlisten] allocator: tcmalloc
2014-09-24T11:54:23.665-0400 [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1" }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" }, storage: { dbPath: "/var/lib/mongo" }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2014-09-24T11:54:23.680-0400 [initandlisten] journal dir=/var/lib/mongo/journal
2014-09-24T11:54:23.680-0400 [initandlisten] recover : no journal files present, no recovery needed
2014-09-24T11:54:23.680-0400 [initandlisten]
2014-09-24T11:54:23.680-0400 [initandlisten] ERROR: Insufficient free space for journal files
2014-09-24T11:54:23.680-0400 [initandlisten] Please make at least 3379MB available in /var/lib/mongo/journal or use --smallfiles
2014-09-24T11:54:23.680-0400 [initandlisten]
2014-09-24T11:54:23.681-0400 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
2014-09-24T11:54:23.681-0400 [initandlisten] dbexit:
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: going to close listening sockets...
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: going to flush diaglog...
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: going to close sockets...
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: waiting for fs preallocator...
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: lock for final commit...
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: final commit...
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: closing all files...
2014-09-24T11:54:23.681-0400 [initandlisten] closeAllFiles() finished
2014-09-24T11:54:23.681-0400 [initandlisten] journalCleanup...
2014-09-24T11:54:23.681-0400 [initandlisten] removeJournalFiles
2014-09-24T11:54:23.684-0400 [initandlisten] shutdown: removing fs lock...
2014-09-24T11:54:23.684-0400 [initandlisten] dbexit: really exiting now
The --repair flag is meant to repair a corrupt database, not to solve any permission problems
You obviously didn't follow the instructions of the link too closely, because he did start the service as root. ;) sudo may only allow certain parts of the init scripts to be executed with superuser rights by the user calling it. Others may (though they shouldn't) silently fail. As for init scripts at least: sudo != being root.
To fix the problem: sudo chown mongod -R /var/log/mongodb/ && sudo chown mongod -R /var/run/mongodb && sudo chown mongod -R /var/lib/mongo Then become root and try to run mongo manually with sudo -u mongod mongod --dbpath /var/lib/mongo --logpath /var/log/mongodb/mongod.log. In case there are other problems left, mongodb will tell you. Fix those until starting mongodb manually as written above works flawless, then use the initscript from that point on.
Edit: corrected the --dbpath option as per comment