I was frequently getting Segmentation fault (core dumped). Not knowing what to do, I just restarted my ubuntu. Then tried repair which failed because of Segmentation fault. Now when I am trying to start mongod

root@ubuntu-s-4vcpu-8gb-nyc1-01:~/mongo# mongod --dbpath /var/lib/mongodb
2018-11-12T10:13:15.235+0000 I CONTROL  [initandlisten] MongoDB starting : pid=2091 port=27017 dbpath=/var/lib/mongodb 64-bit host=ubuntu-s-4vcpu-8gb-nyc1-01
2018-11-12T10:13:15.235+0000 I CONTROL  [initandlisten] db version v3.2.21
2018-11-12T10:13:15.235+0000 I CONTROL  [initandlisten] git version: 1ab1010737145ba3761318508ff65ba74dfe8155
2018-11-12T10:13:15.235+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2018-11-12T10:13:15.235+0000 I CONTROL  [initandlisten] allocator: tcmalloc
2018-11-12T10:13:15.235+0000 I CONTROL  [initandlisten] modules: none
2018-11-12T10:13:15.235+0000 I CONTROL  [initandlisten] build environment:
2018-11-12T10:13:15.235+0000 I CONTROL  [initandlisten]     distmod: ubuntu1604
2018-11-12T10:13:15.235+0000 I CONTROL  [initandlisten]     distarch: x86_64
2018-11-12T10:13:15.235+0000 I CONTROL  [initandlisten]     target_arch: x86_64
2018-11-12T10:13:15.235+0000 I CONTROL  [initandlisten] options: { storage: { dbPath: "/var/lib/mongodb" } }
2018-11-12T10:13:15.255+0000 I -        [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-11-12T10:13:15.255+0000 W -        [initandlisten] Detected unclean shutdown - /var/lib/mongodb/mongod.lock is not empty.
2018-11-12T10:13:15.255+0000 W STORAGE  [initandlisten] Recovering data from the last clean checkpoint.
2018-11-12T10:13:15.255+0000 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=4G,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),verbose=(recovery_progress),
2018-11-12T10:13:15.310+0000 I STORAGE  [initandlisten] dropping unused ident: index-0-8381493109628483945
2018-11-12T10:13:15.312+0000 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2018-11-12T10:13:15.312+0000 I CONTROL  [initandlisten] 
2018-11-12T10:13:15.312+0000 I CONTROL  [initandlisten] 
2018-11-12T10:13:15.312+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2018-11-12T10:13:15.312+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2018-11-12T10:13:15.312+0000 I CONTROL  [initandlisten] 
2018-11-12T10:13:15.312+0000 I -        [initandlisten] Fatal assertion 28579 UnsupportedFormat: Unable to find metadata for table:index-0--3161084524998267994 Index: {name: _id_, ns: local.startup_log} - version too new for this mongod. See http://dochub.mongodb.org/core/3.4-index-downgrade for detailed instructions on how to handle this error.
2018-11-12T10:13:15.313+0000 I -        [initandlisten] 

***aborting after fassert() failure

1 Answer 1

mongod -vvvvvv -dbpath /var/lib/mongodb

and remove corrupted datafile.

rm f index-1234-123456789123456789.wt

and then repair using following command

mongod --repair --dbpath /var/lib/mongodb/ --storageEngine wiredTiger

Note: Have a backup of /var/lib/mongodb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.