6

I am having a weird problem with mongodb after installation it is ending with a message

invoke-rc.d: unknown initscript, /etc/init.d/mongodb not found.
dpkg: error processing mongodb-10gen (--configure):

What is wrong here I followed the steps given here: http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages

4

2 Answers 2

10

The issue is that you are trying to install a version packaged for Upstart init services, but Debian Squeeze still uses SysV init by default.

There is a note on this in the install docs: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian-or-ubuntu-linux/#installing-mongodb

If you are using Debian or Ubuntu that uses SysV style init process, use the following line:

deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen
Sign up to request clarification or add additional context in comments.

Comments

5

This means that you need to create mongodb start script in /etc/init.d/

Try this script

#!/bin/bash
#
# mongodb     Startup script for the mongodb server
#
# chkconfig: - 64 36
# description: MongoDB Database Server
#
# processname: mongodb
#

# Source function library
. /lib/lsb/init-functions 

if [ -f /etc/sysconfig/mongodb ]; then
    . /etc/sysconfig/mongodb
fi

prog="mongod"
mongod="/usr/local/mongodb/bin/mongod"
RETVAL=0

start() {
    echo -n $"Starting $prog: "
    daemon $mongod "--fork --logpath /var/log/mongodb.log --logappend 2>&1 >>/var/log/mongodb.log"
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
    return $RETVAL
}

stop() {
    echo -n $"Stopping $prog: "
    killproc $prog
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
    return $RETVAL
}

reload() {
    echo -n $"Reloading $prog: "
    killproc $prog -HUP
    RETVAL=$?
    echo
    return $RETVAL
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
        ;;
    condrestart)
        if [ -f /var/lock/subsys/$prog ]; then
            stop
            start
        fi
        ;;
    reload)
        reload
        ;;
    status)
        status $mongod
        RETVAL=$?
        ;;
    *)
        echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}"
        RETVAL=1
esac

exit $RETVAL

after type in terminal:

sudo chmod +x /etc/init.d/mongodb
sudo /etc/init.d/mongodb start
ps -A | grep mongod

5 Comments

Yes I have tried this, but I is not working. I store that file renaming to mongodb at /etc/init.d and then make it executable but it is not working.
you need to do some actions in terminal and give me output info
in /etc/init.d I got a line $lrwxrwxrwx 1 root root 21 May 24 12:08 mongodb ->/lib/init/upstart-job /etc/init.d/mongodb start \\ /etc/init.d/mongodb: line 10: /etc/rc.d/init.d/functions: No such file or directory this error
replace with line 10 to /lib/lsb/init-functions
daemon ... isn't required, --fork does that for you (at least as of 06/2014). Otherwise, thanks for the template script!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.