Carl Johnson on 21 Jan 2014 10:09:16 -0800

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] debugging an init script

Thanks everyone for all the help and ways to debug. As it turns out, the part of the script (vbox /usr/lib/virtualbox/vboxwebsrv --background -F /var/log/vboxweb.log) was failing because the vbox user that the command was being run as, didn't have permission to write a lock file in /var/lock/subsys. I figured this out by manually running that command as root (/usr/lib/virtualbox/vboxwebsrv --background -F /var/log/vboxweb.log), and it worked fine. All I had to do was fix the perms. of /var/lock/subsys and, everything was fine.

On Wed, Jan 15, 2014 at 7:33 PM, Carl Johnson <> wrote:
Quick update here....

# prevent inheriting this setting to VBoxSVC
        start_daemon $VBOXWEB_USER $binary $PARAMS > /dev/null 2>&1
        # ugly: wait until the final process has forked
        sleep .1

this points to the problem. the script waits for  "vbox /usr/lib/virtualbox/vboxwebsrv --background -F /var/log/vboxweb.log"
to fork into the background, but it never does. as soon as the following command "sleep .1" completes, the entire script quits with [FAILED].

I guess i'm off to a bug report over @ virtualbox. I'm open to any workarounds/hacks/mods from anyone to band-aid this 'till it's fixed.

On Wed, Jan 15, 2014 at 4:02 PM, JP Vossen <> wrote:
On 01/15/2014 11:49 AM, Andrew Libby wrote:

Hi Carl,

You can probably do something like

/bin/bash -x /etc/init.d/servicescriptname {start|stop}

+1 for that, though all the ideas have been good.

You may also want to play with $PS4 which is the prompt for the -x debug output.

Possibly overkill example (and this looks like negative line numbers when not in a function):
        export PS4+xtrace $BASH_SOURCE::$FUNCNAME-$LINENO:= '

NOTE that the first character is duplicated to indicate nesting level, so make sure it's something that makes sense, like "+".

Lots more here:

JP Vossen, CISSP            |:::======|
My Account, My Opinions     |=========|
"Microsoft Tax" = the additional hardware & yearly fees for the add-on
software required to protect Windows from its own poorly designed and
implemented self, while the overhead incidentally flattens Moore's Law.
Philadelphia Linux Users Group         --
Announcements -
General Discussion  --

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --