Upstart: Job failed to start

redress picture redress · May 3, 2015 · Viewed 18.3k times · Source

EDIT

status marybaked yields

marybaked stop/waiting

Here is the output of /var/log/syslog :

May 3 16:24:39 marybakedpdx kernel: [ 3464.189563] init: Failed to spawn marybakedpdx main process: unable to find setuid user

May 3 16:24:44 marybakedpdx kernel: [ 3469.342062] init: Failed to spawn marybaked main process: unable to find setuid user


When I run start marybaked I get:

start: Job failed to start

When I run start <anything else> I get:

start: Unknown job:

There is no marybaked.log log in my /var/logs/upstart directory...What's going on here? How can upstart recognize that marybaked is a job and fails to start it, but doesnt create an error log for it?

Here is my /etc/init/marybaked.conf file:

# upstart service file at /etc/init/marybakedpdx.conf
    description "Meteor.js (NodeJS) application"
    author "Daniel Speichert <[email protected]>"

    # When to start the service
    start on started mongodb and runlevel [2345]

    # When to stop the service
    stop on shutdown

    # Automatically restart process if crashed
    respawn
    respawn limit 10 5

    # we don't use buil-in log because we use a script below
    # console log

    # drop root proviliges and switch to mymetorapp user
    setuid marybakedpdx
    setgid marybakedpdx

    script
        export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        export NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
        # set to home directory of the user Meteor will be running as
        export PWD=/home/marybakedpdx
        export HOME=/home/marybakedpdx
        # leave as 127.0.0.1 for security
        export BIND_IP=127.0.0.1
        # the port nginx is proxying requests to
        export PORT=8080
        # this allows Meteor to figure out correct IP address of visitors
        export HTTP_FORWARDED_COUNT=1
        # MongoDB connection string using marybakedpdx as database name
        export MONGO_URL=mongodb://localhost:27017/marybakedpdx
        # The domain name as configured previously as server_name in nginx
        export ROOT_URL=http://marybakedpdx.com
        # optional JSON config - the contents of file specified by passing "--settings" parameter to meteor command in development mode
        export METEOR_SETTINGS='{ "somesetting": "someval", "public": { "othersetting": "anothervalue" } }'
        # this is optional: http://docs.meteor.com/#email
        # commented out will default to no email being sent
        # you must register with MailGun to have a username and password there
        # export MAIL_URL=smtp://[email protected]:[email protected]
        # alternatively install "apt-get install default-mta" and uncomment:
        # export MAIL_URL=smtp://localhost
        exec node /home/marybakedpdx/bundle/main.js >> /home/marybakedpdx/marybakedpdx.log
    end script

Answer

Martin Konecny picture Martin Konecny · May 3, 2015

Your upstart file looks ok, what's most likely happening is something within your script block is failing. It should be detailed in the syslog.

Try looking into /var/log/syslog

For further debugging, you should also try to touch files at various points, to further narrow down the issue. For example:

touch /tmp/marybake0
exec node /home/marybakedpdx/bundle/main.js >> /home/marybakedpdx/marybakedpdx.log

touch will create the file if it doesn't exist.

EDIT:

Judging from your updated post, the user marybakedpdx doesn't exist. Try running the following:

adduser marybakedpdx
addgroup marybakedpdx