Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I had some troubles installing Mysql server on an ubuntu machine. after some searching I found the init script of Mysql (/etc/init.d/mysql) tries calling the "/etc/lsb-base-logging.sh" shell script, which in 4 of its lines checks for value of the variable "INITOUTPUT" and this variable is not defined.

I just commented those 4 lines and everything worked fine. I checked my laptop which is using Fedora 10, and I did not have the "lsb-base-logging.sh" script at all. does anybody know what specific task this script does in the system, and why it is using a variable which is not defined? and what that variable is actually for?

update I'm attaching the script in here. file: /etc/lsb-base-logging.sh

# Default init script logging functions suitable for Ubuntu.
# See /lib/lsb/init-functions for usage help.
# edited by Farzad Ghanei lines 84, 114, 136, 156 are commented to fix mysql server start

. /etc/default/rcS

log_use_usplash () {
    if [ "${loop:-n}" = y ]; then
        return 1
    fi
    type usplash_write >/dev/null 2>&1
}

log_to_console () {
    [ "${loop:-n}" != y ] || return 0
    [ "${QUIET:-no}" != yes ] || return 0

    # Only output to the console when we're given /dev/null
    stdin=`readlink /proc/self/fd/0`
    [ "${stdin#/dev/null}" != "$stdin" ] || return 0

    func=$1
    shift

    loop=y $func "$@" </dev/console >/dev/console 2>&1 || true
}

log_success_msg () {
    if log_use_usplash; then
        usplash_write "STATUS $*" || true
    fi

    log_to_console log_success_msg "$@"

    echo " * $@"
}

log_failure_msg () {
    if log_use_usplash; then
        usplash_write "STATUS $*" || true
    fi

    log_to_console log_failure_msg "$@"

    if log_use_fancy_output; then
        RED=`$TPUT setaf 1`
        NORMAL=`$TPUT op`
        echo " $RED*$NORMAL $@"
    else
        echo " * $@"
    fi
}

log_warning_msg () {
    if log_use_usplash; then
        usplash_write "STATUS $*" || true
    fi

    log_to_console log_warning_msg "$@"

    if log_use_fancy_output; then
        YELLOW=`$TPUT setaf 3`
        NORMAL=`$TPUT op`
        echo " $YELLOW*$NORMAL $@"
    else
        echo " * $@"
    fi
}

log_begin_msg () {
    log_daemon_msg "$1"
}

log_daemon_msg () {
    if [ -z "$1" ]; then
        return 1
    fi

    if log_use_usplash; then
        usplash_write "TEXT $*" || true
    fi

    log_to_console log_daemon_msg "$@"

#    if [ "$INITOUTPUT" = "yes" ]; then
        if log_use_fancy_output && $TPUT xenl >/dev/null 2>&1; then
            COLS=`$TPUT cols`
            if [ "$COLS" ] && [ "$COLS" -gt 6 ]; then
                COL=`$EXPR $COLS - 7`
            else
            COLS=80
                COL=73
            fi
            # We leave the cursor `hanging' about-to-wrap (see terminfo(5)
            # xenl, which is approximately right). That way if the script
            # prints anything then we will be on the next line and not
            # overwrite part of the message.

            # Previous versions of this code attempted to colour-code the
            # asterisk but this can't be done reliably because in practice
            # init scripts sometimes print messages even when they succeed
            # and we won't be able to reliably know where the colourful
            # asterisk ought to go.

            printf " * $*       "
            # Enough trailing spaces for ` [fail]' to fit in; if the message
            # is too long it wraps here rather than later, which is what we
            # want.
            $TPUT hpa `$EXPR $COLS - 1`
            printf ' '
        else
            echo " * $@"
            COL=
        fi
#    fi
}

log_progress_msg () {
    :
}

log_end_msg () {
    if [ -z "$1" ]; then
        return 1
    fi

    if log_use_usplash; then
        if [ "$1" -eq 0 ]; then
            usplash_write "SUCCESS OK" || true
        else
            usplash_write "FAILURE failed" || true
        fi
    fi

    log_to_console log_end_msg "$@"

#    if [ "$INITOUTPUT" = "yes" ]; then
        if [ "$COL" ] && [ -x "$TPUT" ]; then
            printf "\r"
            $TPUT hpa $COL
            if [ "$1" -eq 0 ]; then
                echo "[ OK ]"
            else
                printf '['
                $TPUT setaf 1 # red
                printf fail
                $TPUT op # normal
                echo ']'
            fi
        else
            if [ "$1" -eq 0 ]; then
                echo "   ...done."
            else
                echo "   ...fail!"
            fi
        fi
#    fi

    return $1
}

log_action_msg () {
    if log_use_usplash; then
        usplash_write "TEXT $*" || true
    fi

    log_to_console log_action_msg "$@"

    echo " * $@"
}

log_action_begin_msg () {
    log_daemon_msg "$@..."
}

log_action_cont_msg () {
    log_daemon_msg "$@..."
}

log_action_end_msg () {
    # In the future this may do something with $2 as well.
    log_end_msg "$1" || true
}
share|improve this question
    
I don't have any references to "INITOUTPUT" in my "/etc/lsb-base-logging.sh". Can you post some examples of how it's used? –  Dennis Williamson Dec 27 '09 at 9:36
    
sure. I attached the changed file in here. I had to comment 4 lines (2 if statements and 2 if closings) to resolve the issue. –  farzad Dec 27 '09 at 14:22
    
This seems to be a known problem on Ubuntu Netbook Remix. –  Dennis Williamson Dec 28 '09 at 12:52
add comment

1 Answer

up vote 0 down vote accepted

My /etc/lsb-base-logging.sh is identical to yours except for the lines related to the "INITOUTPUT" variable and the . /etc/default/rcS line near the beginning.

It seems that rather than comment out the lines, you should add INITOUTPUT=yes in your /etc/default/rcS file. The variable is intended to control whether some logging output is performed during system startup.

As far as the purpose of the script, there's this from /usr/share/doc/lsb-base/README.Debian.gz:

The Debian lsb-base package provides a series of logging functions to
permit simplified logging of init script actions.  These functions are
specific to Debian and (in some cases) other derived distributions.

What version of Ubuntu do you have?

share|improve this answer
    
the OS is HP Mi, a customized Ubuntu 8 that runs on HP Mini netbooks. I'm not a bash scripter but I think I found what you meant. thanks for the detailed descriptions. –  farzad Dec 28 '09 at 12:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.