From 7baa9d42086b7e58655895ed37b9571033226a63 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Wed, 18 Jul 2007 17:24:36 +0000 Subject: [PATCH] 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 --- scripts/vserver | 6 +++++- scripts/vserver.functions | 4 ++++ scripts/vserver.start | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) 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[@]}" -- \ -- 1.8.1.5