I figured it out after some more digging.  The /etc/init.d script had a Python flag -S which narrows down the paths where Python will search for modules.  The path with pyaml was excluded and could not be found.  So, I removed the -S flag.

And then, I almost forgot to run the command to make it start up with the reboot and so I will put it here for anyone who might find this post helpful

update-rc.d chapman-galaxy defaults


On Mon, Jun 17, 2013 at 9:24 AM, Lee Katz <lskatz@gmail.com> wrote:
Thanks Ross!  Unfortunately I still have the same error.  Although I can directly run galaxy via the command run.sh, the system service fails with the error I showed before.  In other words this works as the galaxy user:
./run.sh --restart

This does not work when I run it as root (or when root runs it as the machine starts up):
service chapman-galaxy start

This is the init file which I slightly modified from the contrib directory (which now resides under /etc/init.d/).  There must be some fundamental reason why running it as root does not work that I don't understand.  I actually don't think it's this init script that is the problem because a vanilla install of Galaxy works fine using "system galaxy start" and when it is under init.d.

#!/bin/bash

# Author: James Casbon, 2009
# Modified by Lee Katz 2013 for this specific system

### BEGIN INIT INFO
# Provides:             chapman-galaxy
# Required-Start:       $network $local_fs $mysql
# Required-Stop:
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Chapman-Galaxy
### END INIT INFO

. /lib/lsb/init-functions

USER="galaxy"
GROUP="galaxy"
DIR="/home/galaxy/bin/chapman-dist"
PYTHON="/usr/bin/python"
OPTS="-ES ./scripts/paster.py serve --log-file $DIR/galaxy.log universe_wsgi.ini"
PIDFILE="/var/run/galaxy-chapman.pid"

case "${1:-''}" in
  'start')
     log_daemon_msg "Starting Chapman-Galaxy"
     if start-stop-daemon --chuid $USER --group $GROUP --start --make-pidfile \
         --pidfile $PIDFILE --background --chdir $DIR --exec $PYTHON -- $OPTS; then
       log_end_msg 0
     else
       log_end_msg 1
     fi
        ;;
  'stop')
     log_daemon_msg "Stopping Chapman-Galaxy"
     if start-stop-daemon --stop --pidfile $PIDFILE; then
       log_end_msg 0
     else
       log_end_msg 1
     fi
        ;;
  'restart')
     # restart commands here
     $0 stop
     $0 start

        ;;
  'status')
     if [ -f "$PIDFILE" ]; then
       pid=`cat $PIDFILE`;
       log_daemon_msg "Chapman-galaxy pid is $pid"
     else
       log_daemon_msg "Chapman-galaxy does not have a pid"
     fi
        ;;
  *)      # no parameter specified
    echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
    exit 1
  ;;
esac





On Sat, Jun 15, 2013 at 12:38 AM, Ross <ross.lazarus@gmail.com> wrote:
My mistake - try 
(sudo) pip install pyaml 
That's what the pip yaml repo is called...



On Sat, Jun 15, 2013 at 11:38 AM, Ross <ross.lazarus@gmail.com> wrote:
Hi, Lee - the last line of that error dump might be worth thinking about. 
It seems clear enough. Your python interpreter seems unable to import a module called yaml

Perhaps you need to (eg) do 
pip install yaml
in the virtualenv (or sudo ... for the system one if not using a virtualenv) you're running your Galaxies with?
I hope this helps.


On Fri, Jun 14, 2013 at 11:52 PM, Lee Katz <lskatz@gmail.com> wrote:
Hi, I am running into an error that I bet has a simple solution. I would appreciate any help.  Thanks.

I am running Brad Chapman's LIMS extension locally on Ubuntu 12.  I also installed it as a service under /etc/init.d/chapman-galaxy using contrib/galaxy.debian-init .  It works when I run it directly (./run.sh --reload)

When I run a version of Galaxy without nglims as a service, there is no error.
When I run a version of Galaxy with nglims, not as a service (run.sh), there is no error.
However, when I run the same version of Galaxy with nglims as a service, there is an error.  I don't understand well enough what the difference is when I run it as a service to diagnose this problem.  The lines leading to the error from the log file is below.  Something to do with yaml not being loaded, but I know I installed python-yaml through aptitude.

galaxy.web.framework.base DEBUG 2013-06-14 09:46:26,873 Enabling 'requests' controller, class: Requests
galaxy.webapps.galaxy.controllers library_common galaxy.webapps.galaxy.controllers.library_common
galaxy.web.framework.base DEBUG 2013-06-14 09:46:26,874 Enabling 'library_common' controller, class: LibraryCommon
galaxy.webapps.galaxy.controllers nglims galaxy.webapps.galaxy.controllers.nglims
Traceback (most recent call last):
  File "./scripts/paster.py", line 34, in <module>
    command.run()
  File "/home/galaxy/bin/chapman-dist/eggs/PasteScript-1.7.3-py2.7.egg/paste/script/command.py", line 84, in run
    invoke(command, command_name, options, args[1:])
  File "/home/galaxy/bin/chapman-dist/eggs/PasteScript-1.7.3-py2.7.egg/paste/script/command.py", line 123, in invoke
    exit_code = runner.run(args)
  File "/home/galaxy/bin/chapman-dist/eggs/PasteScript-1.7.3-py2.7.egg/paste/script/command.py", line 218, in run
    result = self.command()
  File "/home/galaxy/bin/chapman-dist/eggs/PasteScript-1.7.3-py2.7.egg/paste/script/serve.py", line 276, in command
    relative_to=base, global_conf=vars)
  File "/home/galaxy/bin/chapman-dist/eggs/PasteScript-1.7.3-py2.7.egg/paste/script/serve.py", line 313, in loadapp
    **kw)
  File "/home/galaxy/bin/chapman-dist/eggs/PasteDeploy-1.3.3-py2.7.egg/paste/deploy/loadwsgi.py", line 204, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/home/galaxy/bin/chapman-dist/eggs/PasteDeploy-1.3.3-py2.7.egg/paste/deploy/loadwsgi.py", line 225, in loadobj
    return context.create()
  File "/home/galaxy/bin/chapman-dist/eggs/PasteDeploy-1.3.3-py2.7.egg/paste/deploy/loadwsgi.py", line 625, in create
    return self.object_type.invoke(self)
  File "/home/galaxy/bin/chapman-dist/eggs/PasteDeploy-1.3.3-py2.7.egg/paste/deploy/loadwsgi.py", line 188, in invoke
    filtered = context.next_context.create()
  File "/home/galaxy/bin/chapman-dist/eggs/PasteDeploy-1.3.3-py2.7.egg/paste/deploy/loadwsgi.py", line 625, in create
    return self.object_type.invoke(self)
  File "/home/galaxy/bin/chapman-dist/eggs/PasteDeploy-1.3.3-py2.7.egg/paste/deploy/loadwsgi.py", line 110, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/home/galaxy/bin/chapman-dist/eggs/PasteDeploy-1.3.3-py2.7.egg/paste/deploy/util/fixtypeerror.py", line 57, in fix_call
    val = callable(*args, **kw)
  File "/home/galaxy/bin/chapman-dist/lib/galaxy/webapps/galaxy/buildapp.py", line 44, in app_factory
    webapp.add_ui_controllers( 'galaxy.webapps.galaxy.controllers', app )
  File "/home/galaxy/bin/chapman-dist/lib/galaxy/web/framework/__init__.py", line 274, in add_ui_controllers
    module = import_module( module_name )
  File "/home/galaxy/bin/chapman-dist/lib/galaxy/util/backports/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/galaxy/bin/chapman-dist/lib/galaxy/webapps/galaxy/controllers/nglims.py", line 24, in <module>
    import yaml
ImportError: No module named yaml






--
Lee Katz, Ph.D.



--
Lee Katz, Ph.D.