Failed to start mongod.service: Unit mongod.service not found












29















For whatever reason, whenever I try to start MongoDB as a service (sudo service mongod start) I get the following error:



Failed to start mongod.service: Unit mongod.service not found.
I followed Installation Steps mention following link
mongo db installation failed



system> sudo systemctl start mongodb
Failed to start mongodb.service: Unknown unit: mongodb.service


And when I try sudo mongod:



MongoDB shell version: 3.2.13 connecting to: - 
2017-06-03T16:19:28.513+0530 W NETWORK [thread1]
Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-06-03T16:19:28.514+0530 E QUERY [thread1]
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:229:14 @(connect):1:6 exception: connect failed


And when I try mongod --repair:



2017-06-03T16:32:35.514+0530 I CONTROL [initandlisten] 
MongoDB starting : pid=17423 port=27017 dbpath=/data/db 64-bit host=sid-Ideapad-Z570 2017-06-03T16:32:35.514+0530 I
CONTROL [initandlisten] db version v3.2.13 [listen] target_arch: x86_64 2017-06-03T16:32:35.514+0530 I
CONTROL [initandlisten] options: {} 2017-06-03T16:32:35.540+0530 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating









share|improve this question

























  • What's the output of this command : ls /etc/systemd/system | grep mongo Output ?

    – Ali Razmdideh
    Jun 3 '17 at 10:35











  • out put is mongodb.service

    – Siddharth Jain
    Jun 3 '17 at 10:37











  • Do you have this file ? /usr/bin/mongod; if you have what the output of this command sudo mongod

    – Ali Razmdideh
    Jun 3 '17 at 10:41













  • MongoDB shell version: 3.2.13 connecting to: - 2017-06-03T16:19:28.513+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused 2017-06-03T16:19:28.514+0530 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:229:14 @(connect):1:6 exception: connect failed

    – Siddharth Jain
    Jun 3 '17 at 10:49






  • 1





    try mongod --repair then sudo mongod; it's may be helpful

    – Ali Razmdideh
    Jun 3 '17 at 10:53


















29















For whatever reason, whenever I try to start MongoDB as a service (sudo service mongod start) I get the following error:



Failed to start mongod.service: Unit mongod.service not found.
I followed Installation Steps mention following link
mongo db installation failed



system> sudo systemctl start mongodb
Failed to start mongodb.service: Unknown unit: mongodb.service


And when I try sudo mongod:



MongoDB shell version: 3.2.13 connecting to: - 
2017-06-03T16:19:28.513+0530 W NETWORK [thread1]
Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-06-03T16:19:28.514+0530 E QUERY [thread1]
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:229:14 @(connect):1:6 exception: connect failed


And when I try mongod --repair:



2017-06-03T16:32:35.514+0530 I CONTROL [initandlisten] 
MongoDB starting : pid=17423 port=27017 dbpath=/data/db 64-bit host=sid-Ideapad-Z570 2017-06-03T16:32:35.514+0530 I
CONTROL [initandlisten] db version v3.2.13 [listen] target_arch: x86_64 2017-06-03T16:32:35.514+0530 I
CONTROL [initandlisten] options: {} 2017-06-03T16:32:35.540+0530 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating









share|improve this question

























  • What's the output of this command : ls /etc/systemd/system | grep mongo Output ?

    – Ali Razmdideh
    Jun 3 '17 at 10:35











  • out put is mongodb.service

    – Siddharth Jain
    Jun 3 '17 at 10:37











  • Do you have this file ? /usr/bin/mongod; if you have what the output of this command sudo mongod

    – Ali Razmdideh
    Jun 3 '17 at 10:41













  • MongoDB shell version: 3.2.13 connecting to: - 2017-06-03T16:19:28.513+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused 2017-06-03T16:19:28.514+0530 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:229:14 @(connect):1:6 exception: connect failed

    – Siddharth Jain
    Jun 3 '17 at 10:49






  • 1





    try mongod --repair then sudo mongod; it's may be helpful

    – Ali Razmdideh
    Jun 3 '17 at 10:53
















29












29








29


17






For whatever reason, whenever I try to start MongoDB as a service (sudo service mongod start) I get the following error:



Failed to start mongod.service: Unit mongod.service not found.
I followed Installation Steps mention following link
mongo db installation failed



system> sudo systemctl start mongodb
Failed to start mongodb.service: Unknown unit: mongodb.service


And when I try sudo mongod:



MongoDB shell version: 3.2.13 connecting to: - 
2017-06-03T16:19:28.513+0530 W NETWORK [thread1]
Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-06-03T16:19:28.514+0530 E QUERY [thread1]
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:229:14 @(connect):1:6 exception: connect failed


And when I try mongod --repair:



2017-06-03T16:32:35.514+0530 I CONTROL [initandlisten] 
MongoDB starting : pid=17423 port=27017 dbpath=/data/db 64-bit host=sid-Ideapad-Z570 2017-06-03T16:32:35.514+0530 I
CONTROL [initandlisten] db version v3.2.13 [listen] target_arch: x86_64 2017-06-03T16:32:35.514+0530 I
CONTROL [initandlisten] options: {} 2017-06-03T16:32:35.540+0530 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating









share|improve this question
















For whatever reason, whenever I try to start MongoDB as a service (sudo service mongod start) I get the following error:



Failed to start mongod.service: Unit mongod.service not found.
I followed Installation Steps mention following link
mongo db installation failed



system> sudo systemctl start mongodb
Failed to start mongodb.service: Unknown unit: mongodb.service


And when I try sudo mongod:



MongoDB shell version: 3.2.13 connecting to: - 
2017-06-03T16:19:28.513+0530 W NETWORK [thread1]
Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-06-03T16:19:28.514+0530 E QUERY [thread1]
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:229:14 @(connect):1:6 exception: connect failed


And when I try mongod --repair:



2017-06-03T16:32:35.514+0530 I CONTROL [initandlisten] 
MongoDB starting : pid=17423 port=27017 dbpath=/data/db 64-bit host=sid-Ideapad-Z570 2017-06-03T16:32:35.514+0530 I
CONTROL [initandlisten] db version v3.2.13 [listen] target_arch: x86_64 2017-06-03T16:32:35.514+0530 I
CONTROL [initandlisten] options: {} 2017-06-03T16:32:35.540+0530 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating






16.04 mongodb






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 3 '17 at 12:53









Zanna

50.7k13136241




50.7k13136241










asked Jun 3 '17 at 10:32









Siddharth JainSiddharth Jain

148127




148127













  • What's the output of this command : ls /etc/systemd/system | grep mongo Output ?

    – Ali Razmdideh
    Jun 3 '17 at 10:35











  • out put is mongodb.service

    – Siddharth Jain
    Jun 3 '17 at 10:37











  • Do you have this file ? /usr/bin/mongod; if you have what the output of this command sudo mongod

    – Ali Razmdideh
    Jun 3 '17 at 10:41













  • MongoDB shell version: 3.2.13 connecting to: - 2017-06-03T16:19:28.513+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused 2017-06-03T16:19:28.514+0530 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:229:14 @(connect):1:6 exception: connect failed

    – Siddharth Jain
    Jun 3 '17 at 10:49






  • 1





    try mongod --repair then sudo mongod; it's may be helpful

    – Ali Razmdideh
    Jun 3 '17 at 10:53





















  • What's the output of this command : ls /etc/systemd/system | grep mongo Output ?

    – Ali Razmdideh
    Jun 3 '17 at 10:35











  • out put is mongodb.service

    – Siddharth Jain
    Jun 3 '17 at 10:37











  • Do you have this file ? /usr/bin/mongod; if you have what the output of this command sudo mongod

    – Ali Razmdideh
    Jun 3 '17 at 10:41













  • MongoDB shell version: 3.2.13 connecting to: - 2017-06-03T16:19:28.513+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused 2017-06-03T16:19:28.514+0530 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:229:14 @(connect):1:6 exception: connect failed

    – Siddharth Jain
    Jun 3 '17 at 10:49






  • 1





    try mongod --repair then sudo mongod; it's may be helpful

    – Ali Razmdideh
    Jun 3 '17 at 10:53



















What's the output of this command : ls /etc/systemd/system | grep mongo Output ?

– Ali Razmdideh
Jun 3 '17 at 10:35





What's the output of this command : ls /etc/systemd/system | grep mongo Output ?

– Ali Razmdideh
Jun 3 '17 at 10:35













out put is mongodb.service

– Siddharth Jain
Jun 3 '17 at 10:37





out put is mongodb.service

– Siddharth Jain
Jun 3 '17 at 10:37













Do you have this file ? /usr/bin/mongod; if you have what the output of this command sudo mongod

– Ali Razmdideh
Jun 3 '17 at 10:41







Do you have this file ? /usr/bin/mongod; if you have what the output of this command sudo mongod

– Ali Razmdideh
Jun 3 '17 at 10:41















MongoDB shell version: 3.2.13 connecting to: - 2017-06-03T16:19:28.513+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused 2017-06-03T16:19:28.514+0530 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:229:14 @(connect):1:6 exception: connect failed

– Siddharth Jain
Jun 3 '17 at 10:49





MongoDB shell version: 3.2.13 connecting to: - 2017-06-03T16:19:28.513+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused 2017-06-03T16:19:28.514+0530 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:229:14 @(connect):1:6 exception: connect failed

– Siddharth Jain
Jun 3 '17 at 10:49




1




1





try mongod --repair then sudo mongod; it's may be helpful

– Ali Razmdideh
Jun 3 '17 at 10:53







try mongod --repair then sudo mongod; it's may be helpful

– Ali Razmdideh
Jun 3 '17 at 10:53












5 Answers
5






active

oldest

votes


















44














I reinstalled mongod-org, since my data will still stay safe.



The problem was that my system couldn't find mongod.service when I ran sudo service mongod status.



Running this fixed it and restored the service:



sudo systemctl enable mongod


Then all I had to do was copy my correct config to /etc/mongod.conf and run



sudo service mongod restart





share|improve this answer



















  • 7





    I was trying to enable mongod, but it shows Failed to execute operation: No such file or directory

    – Mostafiz Rahman
    Oct 2 '17 at 19:25











  • Just noting that this works when you have installed mongodb community edition from the mongodb repos

    – yeeking
    Oct 5 '17 at 15:40



















10














This has worked for me.





  1. Uninstall your mongo completely from your system:



    sudo service mongod stop 
    sudo apt-get purge mongodb-org*
    sudo rm -r /var/log/mongodb
    sudo rm -r /var/lib/mongodb



  2. Now reinstall mongodb using following commands:



    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
    echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
    sudo apt-get update
    sudo apt-get install -y mongodb-org


    To install a specific release, you must specify each component package individually along with the version number, as in the following example:



    sudo apt-get install -y mongodb-org=3.6.0 mongodb-org-server=3.6.0 mongodb-org-shell=3.6.0 mongodb-org-mongos=3.6.0 mongodb-org-tools=3.6.0



  3. Now you can see mongod working but still the same issue is bothering you. The issue is that your system couldn't find mongod.service when you run sudo service mongod status.



    Running this fixed it and restored the service:



    sudo systemctl enable mongod



  4. Now you're all set to use mongo.



    sudo service mongod restart







share|improve this answer

































    3














    I too faced the exact problem mentioned by OP, even though I installed Mongodb using the official install tutorial (https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ ),



    NOTE: in step 2 of the tutorial (create a list file for Mongodb), it is important to click on the tab specific to the particular version of Ubuntu on your machine. By default it shows Ubuntu 14.04, which created the problems mentioned by OP (Failed to start mongod.service: Unit mongod.service not found)



    When I finally noticed that in step 2 I had to properly select Ubuntu 16.04 (for me), the install was successful and after this mongod ran without any issues.






    share|improve this answer
























    • Thanks, I didn't notice the version tabs either! Uninstalled as in docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/… then followed the install again with the appropriate version.

      – Pete Montgomery
      Oct 10 '18 at 15:27











    • Yes, thank you! I missed it too!

      – Andrew M. Andrews III
      Nov 26 '18 at 19:45



















    0














    I just removed mongo following the instructions here: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
    And then I installed again following the instructions in the given link. Everything worked smoothly!






    share|improve this answer



















    • 2





      In the link mentioned by you (docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu ), in step 2 (create a list file for Mongodb), it is important to click on the tab specific to the particular version of Ubuntu. By default it shows Ubuntu 14.04, which creates the problems mentioned by OP (Failed to start mongod.service: Unit mongod.service not found). I too faced this issue, only to finally notice that in step 2 I had to properly select Ubuntu 16.04 (for me). After this mongod ran without any issues.

      – Bharat Mallapur
      Sep 17 '18 at 16:47





















    0














    If it shows MongoNetworkError: failed to connect to server [127.0.0.1:27017]
    or exception: connect failed.... then Reinstallation will work
    uninstallation and installation commands are available on mongodb.com according to your system...






    share|improve this answer








    New contributor




    Saad Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.




















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      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%2faskubuntu.com%2fquestions%2f921753%2ffailed-to-start-mongod-service-unit-mongod-service-not-found%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      5 Answers
      5






      active

      oldest

      votes








      5 Answers
      5






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      44














      I reinstalled mongod-org, since my data will still stay safe.



      The problem was that my system couldn't find mongod.service when I ran sudo service mongod status.



      Running this fixed it and restored the service:



      sudo systemctl enable mongod


      Then all I had to do was copy my correct config to /etc/mongod.conf and run



      sudo service mongod restart





      share|improve this answer



















      • 7





        I was trying to enable mongod, but it shows Failed to execute operation: No such file or directory

        – Mostafiz Rahman
        Oct 2 '17 at 19:25











      • Just noting that this works when you have installed mongodb community edition from the mongodb repos

        – yeeking
        Oct 5 '17 at 15:40
















      44














      I reinstalled mongod-org, since my data will still stay safe.



      The problem was that my system couldn't find mongod.service when I ran sudo service mongod status.



      Running this fixed it and restored the service:



      sudo systemctl enable mongod


      Then all I had to do was copy my correct config to /etc/mongod.conf and run



      sudo service mongod restart





      share|improve this answer



















      • 7





        I was trying to enable mongod, but it shows Failed to execute operation: No such file or directory

        – Mostafiz Rahman
        Oct 2 '17 at 19:25











      • Just noting that this works when you have installed mongodb community edition from the mongodb repos

        – yeeking
        Oct 5 '17 at 15:40














      44












      44








      44







      I reinstalled mongod-org, since my data will still stay safe.



      The problem was that my system couldn't find mongod.service when I ran sudo service mongod status.



      Running this fixed it and restored the service:



      sudo systemctl enable mongod


      Then all I had to do was copy my correct config to /etc/mongod.conf and run



      sudo service mongod restart





      share|improve this answer













      I reinstalled mongod-org, since my data will still stay safe.



      The problem was that my system couldn't find mongod.service when I ran sudo service mongod status.



      Running this fixed it and restored the service:



      sudo systemctl enable mongod


      Then all I had to do was copy my correct config to /etc/mongod.conf and run



      sudo service mongod restart






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Jul 21 '17 at 13:22









      Shubham ChaudharyShubham Chaudhary

      663812




      663812








      • 7





        I was trying to enable mongod, but it shows Failed to execute operation: No such file or directory

        – Mostafiz Rahman
        Oct 2 '17 at 19:25











      • Just noting that this works when you have installed mongodb community edition from the mongodb repos

        – yeeking
        Oct 5 '17 at 15:40














      • 7





        I was trying to enable mongod, but it shows Failed to execute operation: No such file or directory

        – Mostafiz Rahman
        Oct 2 '17 at 19:25











      • Just noting that this works when you have installed mongodb community edition from the mongodb repos

        – yeeking
        Oct 5 '17 at 15:40








      7




      7





      I was trying to enable mongod, but it shows Failed to execute operation: No such file or directory

      – Mostafiz Rahman
      Oct 2 '17 at 19:25





      I was trying to enable mongod, but it shows Failed to execute operation: No such file or directory

      – Mostafiz Rahman
      Oct 2 '17 at 19:25













      Just noting that this works when you have installed mongodb community edition from the mongodb repos

      – yeeking
      Oct 5 '17 at 15:40





      Just noting that this works when you have installed mongodb community edition from the mongodb repos

      – yeeking
      Oct 5 '17 at 15:40













      10














      This has worked for me.





      1. Uninstall your mongo completely from your system:



        sudo service mongod stop 
        sudo apt-get purge mongodb-org*
        sudo rm -r /var/log/mongodb
        sudo rm -r /var/lib/mongodb



      2. Now reinstall mongodb using following commands:



        sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
        echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
        sudo apt-get update
        sudo apt-get install -y mongodb-org


        To install a specific release, you must specify each component package individually along with the version number, as in the following example:



        sudo apt-get install -y mongodb-org=3.6.0 mongodb-org-server=3.6.0 mongodb-org-shell=3.6.0 mongodb-org-mongos=3.6.0 mongodb-org-tools=3.6.0



      3. Now you can see mongod working but still the same issue is bothering you. The issue is that your system couldn't find mongod.service when you run sudo service mongod status.



        Running this fixed it and restored the service:



        sudo systemctl enable mongod



      4. Now you're all set to use mongo.



        sudo service mongod restart







      share|improve this answer






























        10














        This has worked for me.





        1. Uninstall your mongo completely from your system:



          sudo service mongod stop 
          sudo apt-get purge mongodb-org*
          sudo rm -r /var/log/mongodb
          sudo rm -r /var/lib/mongodb



        2. Now reinstall mongodb using following commands:



          sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
          echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
          sudo apt-get update
          sudo apt-get install -y mongodb-org


          To install a specific release, you must specify each component package individually along with the version number, as in the following example:



          sudo apt-get install -y mongodb-org=3.6.0 mongodb-org-server=3.6.0 mongodb-org-shell=3.6.0 mongodb-org-mongos=3.6.0 mongodb-org-tools=3.6.0



        3. Now you can see mongod working but still the same issue is bothering you. The issue is that your system couldn't find mongod.service when you run sudo service mongod status.



          Running this fixed it and restored the service:



          sudo systemctl enable mongod



        4. Now you're all set to use mongo.



          sudo service mongod restart







        share|improve this answer




























          10












          10








          10







          This has worked for me.





          1. Uninstall your mongo completely from your system:



            sudo service mongod stop 
            sudo apt-get purge mongodb-org*
            sudo rm -r /var/log/mongodb
            sudo rm -r /var/lib/mongodb



          2. Now reinstall mongodb using following commands:



            sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
            echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
            sudo apt-get update
            sudo apt-get install -y mongodb-org


            To install a specific release, you must specify each component package individually along with the version number, as in the following example:



            sudo apt-get install -y mongodb-org=3.6.0 mongodb-org-server=3.6.0 mongodb-org-shell=3.6.0 mongodb-org-mongos=3.6.0 mongodb-org-tools=3.6.0



          3. Now you can see mongod working but still the same issue is bothering you. The issue is that your system couldn't find mongod.service when you run sudo service mongod status.



            Running this fixed it and restored the service:



            sudo systemctl enable mongod



          4. Now you're all set to use mongo.



            sudo service mongod restart







          share|improve this answer















          This has worked for me.





          1. Uninstall your mongo completely from your system:



            sudo service mongod stop 
            sudo apt-get purge mongodb-org*
            sudo rm -r /var/log/mongodb
            sudo rm -r /var/lib/mongodb



          2. Now reinstall mongodb using following commands:



            sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
            echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
            sudo apt-get update
            sudo apt-get install -y mongodb-org


            To install a specific release, you must specify each component package individually along with the version number, as in the following example:



            sudo apt-get install -y mongodb-org=3.6.0 mongodb-org-server=3.6.0 mongodb-org-shell=3.6.0 mongodb-org-mongos=3.6.0 mongodb-org-tools=3.6.0



          3. Now you can see mongod working but still the same issue is bothering you. The issue is that your system couldn't find mongod.service when you run sudo service mongod status.



            Running this fixed it and restored the service:



            sudo systemctl enable mongod



          4. Now you're all set to use mongo.



            sudo service mongod restart








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 13 '18 at 7:23









          karel

          59.5k13129151




          59.5k13129151










          answered Jul 13 '18 at 7:19









          Akash JainAkash Jain

          10113




          10113























              3














              I too faced the exact problem mentioned by OP, even though I installed Mongodb using the official install tutorial (https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ ),



              NOTE: in step 2 of the tutorial (create a list file for Mongodb), it is important to click on the tab specific to the particular version of Ubuntu on your machine. By default it shows Ubuntu 14.04, which created the problems mentioned by OP (Failed to start mongod.service: Unit mongod.service not found)



              When I finally noticed that in step 2 I had to properly select Ubuntu 16.04 (for me), the install was successful and after this mongod ran without any issues.






              share|improve this answer
























              • Thanks, I didn't notice the version tabs either! Uninstalled as in docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/… then followed the install again with the appropriate version.

                – Pete Montgomery
                Oct 10 '18 at 15:27











              • Yes, thank you! I missed it too!

                – Andrew M. Andrews III
                Nov 26 '18 at 19:45
















              3














              I too faced the exact problem mentioned by OP, even though I installed Mongodb using the official install tutorial (https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ ),



              NOTE: in step 2 of the tutorial (create a list file for Mongodb), it is important to click on the tab specific to the particular version of Ubuntu on your machine. By default it shows Ubuntu 14.04, which created the problems mentioned by OP (Failed to start mongod.service: Unit mongod.service not found)



              When I finally noticed that in step 2 I had to properly select Ubuntu 16.04 (for me), the install was successful and after this mongod ran without any issues.






              share|improve this answer
























              • Thanks, I didn't notice the version tabs either! Uninstalled as in docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/… then followed the install again with the appropriate version.

                – Pete Montgomery
                Oct 10 '18 at 15:27











              • Yes, thank you! I missed it too!

                – Andrew M. Andrews III
                Nov 26 '18 at 19:45














              3












              3








              3







              I too faced the exact problem mentioned by OP, even though I installed Mongodb using the official install tutorial (https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ ),



              NOTE: in step 2 of the tutorial (create a list file for Mongodb), it is important to click on the tab specific to the particular version of Ubuntu on your machine. By default it shows Ubuntu 14.04, which created the problems mentioned by OP (Failed to start mongod.service: Unit mongod.service not found)



              When I finally noticed that in step 2 I had to properly select Ubuntu 16.04 (for me), the install was successful and after this mongod ran without any issues.






              share|improve this answer













              I too faced the exact problem mentioned by OP, even though I installed Mongodb using the official install tutorial (https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ ),



              NOTE: in step 2 of the tutorial (create a list file for Mongodb), it is important to click on the tab specific to the particular version of Ubuntu on your machine. By default it shows Ubuntu 14.04, which created the problems mentioned by OP (Failed to start mongod.service: Unit mongod.service not found)



              When I finally noticed that in step 2 I had to properly select Ubuntu 16.04 (for me), the install was successful and after this mongod ran without any issues.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Sep 17 '18 at 16:50









              Bharat MallapurBharat Mallapur

              1355




              1355













              • Thanks, I didn't notice the version tabs either! Uninstalled as in docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/… then followed the install again with the appropriate version.

                – Pete Montgomery
                Oct 10 '18 at 15:27











              • Yes, thank you! I missed it too!

                – Andrew M. Andrews III
                Nov 26 '18 at 19:45



















              • Thanks, I didn't notice the version tabs either! Uninstalled as in docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/… then followed the install again with the appropriate version.

                – Pete Montgomery
                Oct 10 '18 at 15:27











              • Yes, thank you! I missed it too!

                – Andrew M. Andrews III
                Nov 26 '18 at 19:45

















              Thanks, I didn't notice the version tabs either! Uninstalled as in docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/… then followed the install again with the appropriate version.

              – Pete Montgomery
              Oct 10 '18 at 15:27





              Thanks, I didn't notice the version tabs either! Uninstalled as in docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/… then followed the install again with the appropriate version.

              – Pete Montgomery
              Oct 10 '18 at 15:27













              Yes, thank you! I missed it too!

              – Andrew M. Andrews III
              Nov 26 '18 at 19:45





              Yes, thank you! I missed it too!

              – Andrew M. Andrews III
              Nov 26 '18 at 19:45











              0














              I just removed mongo following the instructions here: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
              And then I installed again following the instructions in the given link. Everything worked smoothly!






              share|improve this answer



















              • 2





                In the link mentioned by you (docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu ), in step 2 (create a list file for Mongodb), it is important to click on the tab specific to the particular version of Ubuntu. By default it shows Ubuntu 14.04, which creates the problems mentioned by OP (Failed to start mongod.service: Unit mongod.service not found). I too faced this issue, only to finally notice that in step 2 I had to properly select Ubuntu 16.04 (for me). After this mongod ran without any issues.

                – Bharat Mallapur
                Sep 17 '18 at 16:47


















              0














              I just removed mongo following the instructions here: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
              And then I installed again following the instructions in the given link. Everything worked smoothly!






              share|improve this answer



















              • 2





                In the link mentioned by you (docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu ), in step 2 (create a list file for Mongodb), it is important to click on the tab specific to the particular version of Ubuntu. By default it shows Ubuntu 14.04, which creates the problems mentioned by OP (Failed to start mongod.service: Unit mongod.service not found). I too faced this issue, only to finally notice that in step 2 I had to properly select Ubuntu 16.04 (for me). After this mongod ran without any issues.

                – Bharat Mallapur
                Sep 17 '18 at 16:47
















              0












              0








              0







              I just removed mongo following the instructions here: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
              And then I installed again following the instructions in the given link. Everything worked smoothly!






              share|improve this answer













              I just removed mongo following the instructions here: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
              And then I installed again following the instructions in the given link. Everything worked smoothly!







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Feb 1 '18 at 22:19









              David I. RockDavid I. Rock

              1




              1








              • 2





                In the link mentioned by you (docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu ), in step 2 (create a list file for Mongodb), it is important to click on the tab specific to the particular version of Ubuntu. By default it shows Ubuntu 14.04, which creates the problems mentioned by OP (Failed to start mongod.service: Unit mongod.service not found). I too faced this issue, only to finally notice that in step 2 I had to properly select Ubuntu 16.04 (for me). After this mongod ran without any issues.

                – Bharat Mallapur
                Sep 17 '18 at 16:47
















              • 2





                In the link mentioned by you (docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu ), in step 2 (create a list file for Mongodb), it is important to click on the tab specific to the particular version of Ubuntu. By default it shows Ubuntu 14.04, which creates the problems mentioned by OP (Failed to start mongod.service: Unit mongod.service not found). I too faced this issue, only to finally notice that in step 2 I had to properly select Ubuntu 16.04 (for me). After this mongod ran without any issues.

                – Bharat Mallapur
                Sep 17 '18 at 16:47










              2




              2





              In the link mentioned by you (docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu ), in step 2 (create a list file for Mongodb), it is important to click on the tab specific to the particular version of Ubuntu. By default it shows Ubuntu 14.04, which creates the problems mentioned by OP (Failed to start mongod.service: Unit mongod.service not found). I too faced this issue, only to finally notice that in step 2 I had to properly select Ubuntu 16.04 (for me). After this mongod ran without any issues.

              – Bharat Mallapur
              Sep 17 '18 at 16:47







              In the link mentioned by you (docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu ), in step 2 (create a list file for Mongodb), it is important to click on the tab specific to the particular version of Ubuntu. By default it shows Ubuntu 14.04, which creates the problems mentioned by OP (Failed to start mongod.service: Unit mongod.service not found). I too faced this issue, only to finally notice that in step 2 I had to properly select Ubuntu 16.04 (for me). After this mongod ran without any issues.

              – Bharat Mallapur
              Sep 17 '18 at 16:47













              0














              If it shows MongoNetworkError: failed to connect to server [127.0.0.1:27017]
              or exception: connect failed.... then Reinstallation will work
              uninstallation and installation commands are available on mongodb.com according to your system...






              share|improve this answer








              New contributor




              Saad Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.

























                0














                If it shows MongoNetworkError: failed to connect to server [127.0.0.1:27017]
                or exception: connect failed.... then Reinstallation will work
                uninstallation and installation commands are available on mongodb.com according to your system...






                share|improve this answer








                New contributor




                Saad Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.























                  0












                  0








                  0







                  If it shows MongoNetworkError: failed to connect to server [127.0.0.1:27017]
                  or exception: connect failed.... then Reinstallation will work
                  uninstallation and installation commands are available on mongodb.com according to your system...






                  share|improve this answer








                  New contributor




                  Saad Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.










                  If it shows MongoNetworkError: failed to connect to server [127.0.0.1:27017]
                  or exception: connect failed.... then Reinstallation will work
                  uninstallation and installation commands are available on mongodb.com according to your system...







                  share|improve this answer








                  New contributor




                  Saad Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer






                  New contributor




                  Saad Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 1 hour ago









                  Saad PatelSaad Patel

                  1




                  1




                  New contributor




                  Saad Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  Saad Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  Saad Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • 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%2faskubuntu.com%2fquestions%2f921753%2ffailed-to-start-mongod-service-unit-mongod-service-not-found%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

                      GameSpot

                      日野市

                      Tu-95轟炸機