Mongo can't start service












0















I have Ubuntu 16.04. And reinstall mongobd following tutorial on oficial mongo site - https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
As result i have:
mongo -version



MongoDB shell version v4.0.5
git version: 3739429dd92b92d1b0ab120911a23d50bf03c412
OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1604
distarch: x86_64
target_arch: x86_64


But I cant start mongodb((



sudo systemctl status mongodb
● mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-01-22 16:27:13 UTC; 10s ago
Process: 29736 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 29736 (code=exited, status=1/FAILURE)

Jan 22 16:27:13 mahumachinen systemd[1]: Started High-performance, schema-free document-oriented database.
Jan 22 16:27:13 mahumachinen systemd[1]: mongodb.service: Main process exited, code=exited, status=1/FAILURE
Jan 22 16:27:13 mahumachinen systemd[1]: mongodb.service: Unit entered failed state.
Jan 22 16:27:13 mahumachinen systemd[1]: mongodb.service: Failed with result 'exit-code'.


Please help!










share|improve this question


















  • 1





    One thing that stands out to me is that you are referring to mongodb.service, but if you followed the instructions you linked, the service is actually mongod.service. You might be able to figure out the cause of the service failure in /var/log/mongodb/mongod.log (unless you changed the logging path in /etc/mongod.conf).

    – Deltik
    Jan 22 at 16:51











  • Thank you, probably i made somewhere mistake, I made several instalations from different tuturials. now /var/log/mongodb/mongod.log is empty. although systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log

    – Viktor Kushnir
    Jan 22 at 17:21













  • $ sudo service mongod start Failed to start mongod.service: Unit mongod.service not found. $ sudo systemctl unmask mongodb $ sudo service mongod start

    – Viktor Kushnir
    Jan 22 at 17:27













  • sudo service mongod status ● mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2019-01-22 17:19:43 UTC; 6s ago

    – Viktor Kushnir
    Jan 22 at 17:28











  • sudo /usr/bin/mongod --quiet --config /etc/mongod.conf helps me. Thank you, but whats happens?

    – Viktor Kushnir
    Jan 22 at 17:51
















0















I have Ubuntu 16.04. And reinstall mongobd following tutorial on oficial mongo site - https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
As result i have:
mongo -version



MongoDB shell version v4.0.5
git version: 3739429dd92b92d1b0ab120911a23d50bf03c412
OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1604
distarch: x86_64
target_arch: x86_64


But I cant start mongodb((



sudo systemctl status mongodb
● mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-01-22 16:27:13 UTC; 10s ago
Process: 29736 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 29736 (code=exited, status=1/FAILURE)

Jan 22 16:27:13 mahumachinen systemd[1]: Started High-performance, schema-free document-oriented database.
Jan 22 16:27:13 mahumachinen systemd[1]: mongodb.service: Main process exited, code=exited, status=1/FAILURE
Jan 22 16:27:13 mahumachinen systemd[1]: mongodb.service: Unit entered failed state.
Jan 22 16:27:13 mahumachinen systemd[1]: mongodb.service: Failed with result 'exit-code'.


Please help!










share|improve this question


















  • 1





    One thing that stands out to me is that you are referring to mongodb.service, but if you followed the instructions you linked, the service is actually mongod.service. You might be able to figure out the cause of the service failure in /var/log/mongodb/mongod.log (unless you changed the logging path in /etc/mongod.conf).

    – Deltik
    Jan 22 at 16:51











  • Thank you, probably i made somewhere mistake, I made several instalations from different tuturials. now /var/log/mongodb/mongod.log is empty. although systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log

    – Viktor Kushnir
    Jan 22 at 17:21













  • $ sudo service mongod start Failed to start mongod.service: Unit mongod.service not found. $ sudo systemctl unmask mongodb $ sudo service mongod start

    – Viktor Kushnir
    Jan 22 at 17:27













  • sudo service mongod status ● mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2019-01-22 17:19:43 UTC; 6s ago

    – Viktor Kushnir
    Jan 22 at 17:28











  • sudo /usr/bin/mongod --quiet --config /etc/mongod.conf helps me. Thank you, but whats happens?

    – Viktor Kushnir
    Jan 22 at 17:51














0












0








0








I have Ubuntu 16.04. And reinstall mongobd following tutorial on oficial mongo site - https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
As result i have:
mongo -version



MongoDB shell version v4.0.5
git version: 3739429dd92b92d1b0ab120911a23d50bf03c412
OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1604
distarch: x86_64
target_arch: x86_64


But I cant start mongodb((



sudo systemctl status mongodb
● mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-01-22 16:27:13 UTC; 10s ago
Process: 29736 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 29736 (code=exited, status=1/FAILURE)

Jan 22 16:27:13 mahumachinen systemd[1]: Started High-performance, schema-free document-oriented database.
Jan 22 16:27:13 mahumachinen systemd[1]: mongodb.service: Main process exited, code=exited, status=1/FAILURE
Jan 22 16:27:13 mahumachinen systemd[1]: mongodb.service: Unit entered failed state.
Jan 22 16:27:13 mahumachinen systemd[1]: mongodb.service: Failed with result 'exit-code'.


Please help!










share|improve this question














I have Ubuntu 16.04. And reinstall mongobd following tutorial on oficial mongo site - https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
As result i have:
mongo -version



MongoDB shell version v4.0.5
git version: 3739429dd92b92d1b0ab120911a23d50bf03c412
OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1604
distarch: x86_64
target_arch: x86_64


But I cant start mongodb((



sudo systemctl status mongodb
● mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-01-22 16:27:13 UTC; 10s ago
Process: 29736 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 29736 (code=exited, status=1/FAILURE)

Jan 22 16:27:13 mahumachinen systemd[1]: Started High-performance, schema-free document-oriented database.
Jan 22 16:27:13 mahumachinen systemd[1]: mongodb.service: Main process exited, code=exited, status=1/FAILURE
Jan 22 16:27:13 mahumachinen systemd[1]: mongodb.service: Unit entered failed state.
Jan 22 16:27:13 mahumachinen systemd[1]: mongodb.service: Failed with result 'exit-code'.


Please help!







ubuntu mongodb






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 22 at 16:33









Viktor KushnirViktor Kushnir

32




32








  • 1





    One thing that stands out to me is that you are referring to mongodb.service, but if you followed the instructions you linked, the service is actually mongod.service. You might be able to figure out the cause of the service failure in /var/log/mongodb/mongod.log (unless you changed the logging path in /etc/mongod.conf).

    – Deltik
    Jan 22 at 16:51











  • Thank you, probably i made somewhere mistake, I made several instalations from different tuturials. now /var/log/mongodb/mongod.log is empty. although systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log

    – Viktor Kushnir
    Jan 22 at 17:21













  • $ sudo service mongod start Failed to start mongod.service: Unit mongod.service not found. $ sudo systemctl unmask mongodb $ sudo service mongod start

    – Viktor Kushnir
    Jan 22 at 17:27













  • sudo service mongod status ● mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2019-01-22 17:19:43 UTC; 6s ago

    – Viktor Kushnir
    Jan 22 at 17:28











  • sudo /usr/bin/mongod --quiet --config /etc/mongod.conf helps me. Thank you, but whats happens?

    – Viktor Kushnir
    Jan 22 at 17:51














  • 1





    One thing that stands out to me is that you are referring to mongodb.service, but if you followed the instructions you linked, the service is actually mongod.service. You might be able to figure out the cause of the service failure in /var/log/mongodb/mongod.log (unless you changed the logging path in /etc/mongod.conf).

    – Deltik
    Jan 22 at 16:51











  • Thank you, probably i made somewhere mistake, I made several instalations from different tuturials. now /var/log/mongodb/mongod.log is empty. although systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log

    – Viktor Kushnir
    Jan 22 at 17:21













  • $ sudo service mongod start Failed to start mongod.service: Unit mongod.service not found. $ sudo systemctl unmask mongodb $ sudo service mongod start

    – Viktor Kushnir
    Jan 22 at 17:27













  • sudo service mongod status ● mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2019-01-22 17:19:43 UTC; 6s ago

    – Viktor Kushnir
    Jan 22 at 17:28











  • sudo /usr/bin/mongod --quiet --config /etc/mongod.conf helps me. Thank you, but whats happens?

    – Viktor Kushnir
    Jan 22 at 17:51








1




1





One thing that stands out to me is that you are referring to mongodb.service, but if you followed the instructions you linked, the service is actually mongod.service. You might be able to figure out the cause of the service failure in /var/log/mongodb/mongod.log (unless you changed the logging path in /etc/mongod.conf).

– Deltik
Jan 22 at 16:51





One thing that stands out to me is that you are referring to mongodb.service, but if you followed the instructions you linked, the service is actually mongod.service. You might be able to figure out the cause of the service failure in /var/log/mongodb/mongod.log (unless you changed the logging path in /etc/mongod.conf).

– Deltik
Jan 22 at 16:51













Thank you, probably i made somewhere mistake, I made several instalations from different tuturials. now /var/log/mongodb/mongod.log is empty. although systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log

– Viktor Kushnir
Jan 22 at 17:21







Thank you, probably i made somewhere mistake, I made several instalations from different tuturials. now /var/log/mongodb/mongod.log is empty. although systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log

– Viktor Kushnir
Jan 22 at 17:21















$ sudo service mongod start Failed to start mongod.service: Unit mongod.service not found. $ sudo systemctl unmask mongodb $ sudo service mongod start

– Viktor Kushnir
Jan 22 at 17:27







$ sudo service mongod start Failed to start mongod.service: Unit mongod.service not found. $ sudo systemctl unmask mongodb $ sudo service mongod start

– Viktor Kushnir
Jan 22 at 17:27















sudo service mongod status ● mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2019-01-22 17:19:43 UTC; 6s ago

– Viktor Kushnir
Jan 22 at 17:28





sudo service mongod status ● mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2019-01-22 17:19:43 UTC; 6s ago

– Viktor Kushnir
Jan 22 at 17:28













sudo /usr/bin/mongod --quiet --config /etc/mongod.conf helps me. Thank you, but whats happens?

– Viktor Kushnir
Jan 22 at 17:51





sudo /usr/bin/mongod --quiet --config /etc/mongod.conf helps me. Thank you, but whats happens?

– Viktor Kushnir
Jan 22 at 17:51










1 Answer
1






active

oldest

votes


















0














I was able to reproduce your issue by setting the wrong ownership on the folder /var/log/mongodb:



root@demo:~# ls -lh /var/log/mongodb/
total 512
-rw-r--r-- 1 root root 0 Jan 22 17:57 mongod.log
root@demo:~# systemctl restart mongod
root@demo:~# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-01-22 17:57:13 UTC; 2s ago
Docs: https://docs.mongodb.org/manual
Process: 795 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 795 (code=exited, status=1/FAILURE)

Jan 22 17:57:13 demo systemd[1]: Started MongoDB Database Server.
Jan 22 17:57:13 demo systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
Jan 22 17:57:13 demo systemd[1]: mongod.service: Unit entered failed state.
Jan 22 17:57:13 demo systemd[1]: mongod.service: Failed with result 'exit-code'.


Try correcting the ownership of the MongoDB logging and data directories:



root@demo:~# chown -Rc mongodb. /var/log/mongodb
changed ownership of '/var/log/mongodb/mongod.log' from root:root to mongodb:nogroup
changed ownership of '/var/log/mongodb' from root:root to mongodb:nogroup
root@demo:~# chown -Rc mongodb. /var/lib/mongodb
root@demo:~# systemctl restart mongod
root@demo:~# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2019-01-22 17:58:30 UTC; 1s ago
Docs: https://docs.mongodb.org/manual
Main PID: 802 (mongod)
CGroup: /system.slice/mongod.service
└─802 /usr/bin/mongod --config /etc/mongod.conf

Jan 22 17:58:30 demo systemd[1]: Started MongoDB Database Server.


If this doesn't work, try reinstalling MongoDB, deleting all existing data:



sudo apt purge mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
sudo rm -rfv /etc/mongod.conf /var/log/mongodb /var/lib/mongodb
sudo find /tmp -type s -iname '*mongodb*' -delete
sudo apt install mongodb-org





share|improve this answer


























  • Tried correcting the ownership of the MongoDB logging and data directories, but it did not help, reinstalled, but also did not help.

    – Viktor Kushnir
    Jan 22 at 18:43











  • Now again Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2019-01-22 18:45:00 UTC; 7s ago Docs: docs.mongodb.org/manual Process: 31469 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100) Main PID: 31469 (code=exited, status=100)

    – Viktor Kushnir
    Jan 22 at 18:46











  • @ViktorKushnir: What's the log file showing now?

    – Deltik
    Jan 22 at 19:16











  • log file is empty now

    – Viktor Kushnir
    Jan 22 at 19:21











  • After reinstall: $ sudo systemctl start mongod Failed to start mongod.service: Unit mongod.service not found.

    – Viktor Kushnir
    Jan 22 at 19:22











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1397079%2fmongo-cant-start-service%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














I was able to reproduce your issue by setting the wrong ownership on the folder /var/log/mongodb:



root@demo:~# ls -lh /var/log/mongodb/
total 512
-rw-r--r-- 1 root root 0 Jan 22 17:57 mongod.log
root@demo:~# systemctl restart mongod
root@demo:~# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-01-22 17:57:13 UTC; 2s ago
Docs: https://docs.mongodb.org/manual
Process: 795 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 795 (code=exited, status=1/FAILURE)

Jan 22 17:57:13 demo systemd[1]: Started MongoDB Database Server.
Jan 22 17:57:13 demo systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
Jan 22 17:57:13 demo systemd[1]: mongod.service: Unit entered failed state.
Jan 22 17:57:13 demo systemd[1]: mongod.service: Failed with result 'exit-code'.


Try correcting the ownership of the MongoDB logging and data directories:



root@demo:~# chown -Rc mongodb. /var/log/mongodb
changed ownership of '/var/log/mongodb/mongod.log' from root:root to mongodb:nogroup
changed ownership of '/var/log/mongodb' from root:root to mongodb:nogroup
root@demo:~# chown -Rc mongodb. /var/lib/mongodb
root@demo:~# systemctl restart mongod
root@demo:~# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2019-01-22 17:58:30 UTC; 1s ago
Docs: https://docs.mongodb.org/manual
Main PID: 802 (mongod)
CGroup: /system.slice/mongod.service
└─802 /usr/bin/mongod --config /etc/mongod.conf

Jan 22 17:58:30 demo systemd[1]: Started MongoDB Database Server.


If this doesn't work, try reinstalling MongoDB, deleting all existing data:



sudo apt purge mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
sudo rm -rfv /etc/mongod.conf /var/log/mongodb /var/lib/mongodb
sudo find /tmp -type s -iname '*mongodb*' -delete
sudo apt install mongodb-org





share|improve this answer


























  • Tried correcting the ownership of the MongoDB logging and data directories, but it did not help, reinstalled, but also did not help.

    – Viktor Kushnir
    Jan 22 at 18:43











  • Now again Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2019-01-22 18:45:00 UTC; 7s ago Docs: docs.mongodb.org/manual Process: 31469 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100) Main PID: 31469 (code=exited, status=100)

    – Viktor Kushnir
    Jan 22 at 18:46











  • @ViktorKushnir: What's the log file showing now?

    – Deltik
    Jan 22 at 19:16











  • log file is empty now

    – Viktor Kushnir
    Jan 22 at 19:21











  • After reinstall: $ sudo systemctl start mongod Failed to start mongod.service: Unit mongod.service not found.

    – Viktor Kushnir
    Jan 22 at 19:22
















0














I was able to reproduce your issue by setting the wrong ownership on the folder /var/log/mongodb:



root@demo:~# ls -lh /var/log/mongodb/
total 512
-rw-r--r-- 1 root root 0 Jan 22 17:57 mongod.log
root@demo:~# systemctl restart mongod
root@demo:~# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-01-22 17:57:13 UTC; 2s ago
Docs: https://docs.mongodb.org/manual
Process: 795 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 795 (code=exited, status=1/FAILURE)

Jan 22 17:57:13 demo systemd[1]: Started MongoDB Database Server.
Jan 22 17:57:13 demo systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
Jan 22 17:57:13 demo systemd[1]: mongod.service: Unit entered failed state.
Jan 22 17:57:13 demo systemd[1]: mongod.service: Failed with result 'exit-code'.


Try correcting the ownership of the MongoDB logging and data directories:



root@demo:~# chown -Rc mongodb. /var/log/mongodb
changed ownership of '/var/log/mongodb/mongod.log' from root:root to mongodb:nogroup
changed ownership of '/var/log/mongodb' from root:root to mongodb:nogroup
root@demo:~# chown -Rc mongodb. /var/lib/mongodb
root@demo:~# systemctl restart mongod
root@demo:~# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2019-01-22 17:58:30 UTC; 1s ago
Docs: https://docs.mongodb.org/manual
Main PID: 802 (mongod)
CGroup: /system.slice/mongod.service
└─802 /usr/bin/mongod --config /etc/mongod.conf

Jan 22 17:58:30 demo systemd[1]: Started MongoDB Database Server.


If this doesn't work, try reinstalling MongoDB, deleting all existing data:



sudo apt purge mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
sudo rm -rfv /etc/mongod.conf /var/log/mongodb /var/lib/mongodb
sudo find /tmp -type s -iname '*mongodb*' -delete
sudo apt install mongodb-org





share|improve this answer


























  • Tried correcting the ownership of the MongoDB logging and data directories, but it did not help, reinstalled, but also did not help.

    – Viktor Kushnir
    Jan 22 at 18:43











  • Now again Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2019-01-22 18:45:00 UTC; 7s ago Docs: docs.mongodb.org/manual Process: 31469 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100) Main PID: 31469 (code=exited, status=100)

    – Viktor Kushnir
    Jan 22 at 18:46











  • @ViktorKushnir: What's the log file showing now?

    – Deltik
    Jan 22 at 19:16











  • log file is empty now

    – Viktor Kushnir
    Jan 22 at 19:21











  • After reinstall: $ sudo systemctl start mongod Failed to start mongod.service: Unit mongod.service not found.

    – Viktor Kushnir
    Jan 22 at 19:22














0












0








0







I was able to reproduce your issue by setting the wrong ownership on the folder /var/log/mongodb:



root@demo:~# ls -lh /var/log/mongodb/
total 512
-rw-r--r-- 1 root root 0 Jan 22 17:57 mongod.log
root@demo:~# systemctl restart mongod
root@demo:~# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-01-22 17:57:13 UTC; 2s ago
Docs: https://docs.mongodb.org/manual
Process: 795 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 795 (code=exited, status=1/FAILURE)

Jan 22 17:57:13 demo systemd[1]: Started MongoDB Database Server.
Jan 22 17:57:13 demo systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
Jan 22 17:57:13 demo systemd[1]: mongod.service: Unit entered failed state.
Jan 22 17:57:13 demo systemd[1]: mongod.service: Failed with result 'exit-code'.


Try correcting the ownership of the MongoDB logging and data directories:



root@demo:~# chown -Rc mongodb. /var/log/mongodb
changed ownership of '/var/log/mongodb/mongod.log' from root:root to mongodb:nogroup
changed ownership of '/var/log/mongodb' from root:root to mongodb:nogroup
root@demo:~# chown -Rc mongodb. /var/lib/mongodb
root@demo:~# systemctl restart mongod
root@demo:~# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2019-01-22 17:58:30 UTC; 1s ago
Docs: https://docs.mongodb.org/manual
Main PID: 802 (mongod)
CGroup: /system.slice/mongod.service
└─802 /usr/bin/mongod --config /etc/mongod.conf

Jan 22 17:58:30 demo systemd[1]: Started MongoDB Database Server.


If this doesn't work, try reinstalling MongoDB, deleting all existing data:



sudo apt purge mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
sudo rm -rfv /etc/mongod.conf /var/log/mongodb /var/lib/mongodb
sudo find /tmp -type s -iname '*mongodb*' -delete
sudo apt install mongodb-org





share|improve this answer















I was able to reproduce your issue by setting the wrong ownership on the folder /var/log/mongodb:



root@demo:~# ls -lh /var/log/mongodb/
total 512
-rw-r--r-- 1 root root 0 Jan 22 17:57 mongod.log
root@demo:~# systemctl restart mongod
root@demo:~# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2019-01-22 17:57:13 UTC; 2s ago
Docs: https://docs.mongodb.org/manual
Process: 795 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
Main PID: 795 (code=exited, status=1/FAILURE)

Jan 22 17:57:13 demo systemd[1]: Started MongoDB Database Server.
Jan 22 17:57:13 demo systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
Jan 22 17:57:13 demo systemd[1]: mongod.service: Unit entered failed state.
Jan 22 17:57:13 demo systemd[1]: mongod.service: Failed with result 'exit-code'.


Try correcting the ownership of the MongoDB logging and data directories:



root@demo:~# chown -Rc mongodb. /var/log/mongodb
changed ownership of '/var/log/mongodb/mongod.log' from root:root to mongodb:nogroup
changed ownership of '/var/log/mongodb' from root:root to mongodb:nogroup
root@demo:~# chown -Rc mongodb. /var/lib/mongodb
root@demo:~# systemctl restart mongod
root@demo:~# systemctl status mongod
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: active (running) since Tue 2019-01-22 17:58:30 UTC; 1s ago
Docs: https://docs.mongodb.org/manual
Main PID: 802 (mongod)
CGroup: /system.slice/mongod.service
└─802 /usr/bin/mongod --config /etc/mongod.conf

Jan 22 17:58:30 demo systemd[1]: Started MongoDB Database Server.


If this doesn't work, try reinstalling MongoDB, deleting all existing data:



sudo apt purge mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools
sudo rm -rfv /etc/mongod.conf /var/log/mongodb /var/lib/mongodb
sudo find /tmp -type s -iname '*mongodb*' -delete
sudo apt install mongodb-org






share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 23 at 16:49

























answered Jan 22 at 18:05









DeltikDeltik

13.1k144887




13.1k144887













  • Tried correcting the ownership of the MongoDB logging and data directories, but it did not help, reinstalled, but also did not help.

    – Viktor Kushnir
    Jan 22 at 18:43











  • Now again Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2019-01-22 18:45:00 UTC; 7s ago Docs: docs.mongodb.org/manual Process: 31469 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100) Main PID: 31469 (code=exited, status=100)

    – Viktor Kushnir
    Jan 22 at 18:46











  • @ViktorKushnir: What's the log file showing now?

    – Deltik
    Jan 22 at 19:16











  • log file is empty now

    – Viktor Kushnir
    Jan 22 at 19:21











  • After reinstall: $ sudo systemctl start mongod Failed to start mongod.service: Unit mongod.service not found.

    – Viktor Kushnir
    Jan 22 at 19:22



















  • Tried correcting the ownership of the MongoDB logging and data directories, but it did not help, reinstalled, but also did not help.

    – Viktor Kushnir
    Jan 22 at 18:43











  • Now again Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2019-01-22 18:45:00 UTC; 7s ago Docs: docs.mongodb.org/manual Process: 31469 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100) Main PID: 31469 (code=exited, status=100)

    – Viktor Kushnir
    Jan 22 at 18:46











  • @ViktorKushnir: What's the log file showing now?

    – Deltik
    Jan 22 at 19:16











  • log file is empty now

    – Viktor Kushnir
    Jan 22 at 19:21











  • After reinstall: $ sudo systemctl start mongod Failed to start mongod.service: Unit mongod.service not found.

    – Viktor Kushnir
    Jan 22 at 19:22

















Tried correcting the ownership of the MongoDB logging and data directories, but it did not help, reinstalled, but also did not help.

– Viktor Kushnir
Jan 22 at 18:43





Tried correcting the ownership of the MongoDB logging and data directories, but it did not help, reinstalled, but also did not help.

– Viktor Kushnir
Jan 22 at 18:43













Now again Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2019-01-22 18:45:00 UTC; 7s ago Docs: docs.mongodb.org/manual Process: 31469 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100) Main PID: 31469 (code=exited, status=100)

– Viktor Kushnir
Jan 22 at 18:46





Now again Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2019-01-22 18:45:00 UTC; 7s ago Docs: docs.mongodb.org/manual Process: 31469 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100) Main PID: 31469 (code=exited, status=100)

– Viktor Kushnir
Jan 22 at 18:46













@ViktorKushnir: What's the log file showing now?

– Deltik
Jan 22 at 19:16





@ViktorKushnir: What's the log file showing now?

– Deltik
Jan 22 at 19:16













log file is empty now

– Viktor Kushnir
Jan 22 at 19:21





log file is empty now

– Viktor Kushnir
Jan 22 at 19:21













After reinstall: $ sudo systemctl start mongod Failed to start mongod.service: Unit mongod.service not found.

– Viktor Kushnir
Jan 22 at 19:22





After reinstall: $ sudo systemctl start mongod Failed to start mongod.service: Unit mongod.service not found.

– Viktor Kushnir
Jan 22 at 19:22


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1397079%2fmongo-cant-start-service%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Aardman Animations

Are they similar matrix

“minimization” problem in Euclidean space related to orthonormal basis