From: Daniel Hokka Zakrisson Date: Wed, 18 Jul 2007 17:24:36 +0000 (+0000) Subject: Add --strace and --debug-sysv options to further debug problems with starting a guest. X-Git-Tag: release-0.30.214~39 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7baa9d42086b7e58655895ed37b9571033226a63;p=util-vserver.git Add --strace and --debug-sysv options to further debug problems with starting a guest. git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2566 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/scripts/vserver b/scripts/vserver index 8813560..da3fbe2 100755 --- a/scripts/vserver +++ b/scripts/vserver @@ -119,7 +119,7 @@ function msg() set +e OPTIONS_ORIG=( "$@" ) -tmp=$(getopt -o +sv --long nonamespace,--nonamespace,--insecure,defaulttty,help,debug,version,sync,verbose,silent -n "$0" -- "$@") || exit 1 +tmp=$(getopt -o +sv --long nonamespace,--nonamespace,--insecure,defaulttty,help,debug,strace,debug-sysv,version,sync,verbose,silent -n "$0" -- "$@") || exit 1 eval set -- "$tmp" OPTION_FORCE_SYNC= @@ -129,6 +129,8 @@ OPTION_DEBUG= OPTION_NONAMESPACE= OPTION_INSECURE= OPTION_DEFAULTTTY= +OPTION_STRACE= +OPTION_DEBUG_SYSV= while true; do case "$1" in @@ -141,6 +143,8 @@ while true; do (----nonamespace)OPTION_NONAMESPACE=$1;; (--defaulttty) OPTION_DEFAULTTTY=$1;; (----insecure) OPTION_INSECURE=1;; + (--strace) OPTION_STRACE=1;; + (--debug-sysv*) OPTION_DEBUG_SYSV=$1;; (--) shift; break;; (*) echo $"vserver: internal error; arg=='$1'" >&2; exit 1;; esac diff --git a/scripts/vserver.functions b/scripts/vserver.functions index c42e617..5bfda35 100644 --- a/scripts/vserver.functions +++ b/scripts/vserver.functions @@ -279,6 +279,10 @@ function _generateInitOptions done INITCMD_PREPARE=( $_FAKE_RUNLEVEL "$RUNLEVEL_START" /var/run/utmp ) OPTS_ENV=( "${OPTS_ENV[@]}" PREVLEVEL=N RUNLEVEL="$RUNLEVEL_START" ) + if test -n "$OPTION_DEBUG_SYSV"; then + INITCMD_START=( /bin/bash -x "${INITCMD_START[@]}" ) + INITCMD_STOP=( /bin/bash -x "${INITCMD_STOP[@]}" ) + fi ;; (xplain) diff --git a/scripts/vserver.start b/scripts/vserver.start index c602d4e..1ade946 100644 --- a/scripts/vserver.start +++ b/scripts/vserver.start @@ -133,6 +133,7 @@ if $_VSERVER_INFO - FEATURE migrate; then $_CHBIND "${CHBIND_OPTS[@]}" -- \ $_EXEC_ULIMIT "$VSERVER_DIR"/ulimits \ $_VCONTEXT --create "${OPTS_VCONTEXT_CREATE[@]}" -- \ + ${OPTION_STRACE:+$_STRACE -fF -o /tmp/vserver-start.$$} \ ${USE_VNAMESPACE:+$_VNAMESPACE --set -- } \ $_VLIMIT --dir "$VSERVER_DIR"/rlimits --missingok -- \ $_VSCHED --xid self --force "${OPTS_VSCHED[@]}" -- \