From: "L. C. Robinson" <lcr@draken.localnet>
To: blinux-list@redhat.com
Subject: Re: segmentation fault?? and fsck problems.
Date: Thu, 11 Jun 1998 00:31:26 -0600 (MDT) [thread overview]
Message-ID: <Pine.LNX.3.95.980610180759.30808A-200000@draken.localnet> (raw)
In-Reply-To: <357ef2eb.ccs@ccs.covici.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 3344 bytes --]
On Wed, 10 Jun 1998, John Covici wrote:
> I didn't want to redirect the whole sysinit process because I had
> already put in those echo statements and didn't want to confuse things
> further. Also, I want the screens to remain the same in case
> something else goes wrong where I need sighted assistance.
You probably just need to do:
fsck [options] > /dev/ttyS0
or something similar. I tried doing:
exec > /dev/tty6 2> /dev/tty6 < /dev/tty6
fsck -fV /dev/hdc2
and it worked in interactive mode (hdc2 is a small experimental
partition I use).
fsck -fV /dev/hdc2 > /dev/tty6 2> /dev/tty6 < /dev/tty6
worked similarly.
If that doesn't work, there are other sneaky ways to save the
output in a buffer or coprocess for later logging or reading.
BTW, I have no difficulty remounting this partition read only,
unless there is a file open on it.
> >The drop to single user shell (sulogin) could be disabled, or you
> >could just type ^D when that happens, to continue on, as the
> >prompt directs (I guess you would have to do this without seeing
> >the prompt?). But this won't happen if you make sure to use
> >the -a option to fsck, and if it does happen, it may just
> >mean you tried to redirect the interactive output, in which
> >case you have effectively made fsck inoperative (bad).
>
> But what I really would like to do, if I get that shell I would like
> to run screader or whatever I am using and find out what is happening.
I just checked the sulogin man page, and you are in luck!! You
can add a tty device argument to sulogin, to redirect to your speech
device, or whatever, and you can even add a timeout, and control
what shell is used.
> >> I have modified the bootup scripts so that there are extra echo
> >> statements redirected to the synthesizer so I have some idea of
> >> what is happening.
> >
> >But the echo statements only tell you whether the daemons tried
> >to start, not whether they succeeded. My modifications to the
> >"functions" script change all that.
>
> Well, some of them do test return codes, but I'd like to see your mods
> and maybe get some ideas from them.
I will attach my functions script. Be sure to read the commentary:
it tells you to add some lines to another script or two.
> >> By closing down all the loggers, lpd, cron and a couple of
> >> other processes, I think I can do a safe fsck in read/write
> >> mode -- at least I tried it a couple of times and got no
> >> errors.
> >
> >Sounds pretty risky to me. If you can't remount it read only, it
> >means you missed some process still writing to the filesystem.
>
> But maybe its only screader which has something open in read/write
> mode and isn't doing any actual writing.
I doubt it, but fuser can tell you for sure. There are better ways,
though. If you do this, eventually you will overlook something
during a check, and damage your filesystem. Then there is the
problem of getting all the daemons properly restarted. That's
what single user mode is for (but it may be broken, as I
mentioned -- ie, you would need to customize it).
--
L. C. Robinson
reply to infynity@cyberhighway.net (a family account)
People buy MicroShaft for compatibility, but get incompatibility and
instability instead: then they get to buy upgrades to fix it, and get
still more problems. This is award winning "innovation".
[-- Attachment #2: /etc/RC.D/init.d/functions --]
[-- Type: TEXT/PLAIN, Size: 5046 bytes --]
#! /bin/sh
#
# functions This file contains functions to be used by most or all
# shell scripts in the /etc/init.d directory.
#
# Version: @(#) /etc/init.d/functions 1.01 26-Oct-1993
#
# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
# Hacked by: Greg Galloway and Marc Ewing
#
# First set up a default search path.
export PATH="/sbin:/usr/sbin:/bin:/usr/bin"
# Customize for local use:
: set ${LOG_TTY:=/dev/tty12} to where you want messages sent -- should match syslog.conf
SKIP_AWK=true
# VERBOSE_BOOTUP=true # uncomment to make bootup stuff echo to screen
DAEMON_LOG=/var/log/init_daemons # set local3.info to go here in /etc/syslog.conf
: ${DAEMON_LOG:-/var/log/messages} default set here if not set already
# Put the following at the end of /etc/RC.D/rc
# ${VERBOSE_BOOTUP:-echo "Quiet bootup: see $DAEMON_LOG for deamon startup messages."}
FAILED_DAEMON_MSG="\nWARNING: some daemon(s) failed to start: see the log file!!\n"
# Use ONLY for machines with no monitor (serial terminal control)
# SERIAL_CONSOLE=/dev/ttyS0
# set -x
MyTTY=`/usr/bin/tty`
case "$MyTTY" in
/dev/tty?|/dev/conso*|/dev/tty)
# exec < $NEWTTY > $NEWTTY 2> $NEWTTY
unset SERIAL_CONSOLE
;;
not*) : ;;
/dev/ttyS?) SERIAL_CONSOLE=/dev/ttyS0 ;;
esac
set +x
# I note that 'logger' and 'basename' are in /usr/bin, and may not be available
# on a small root only filesystem...
# basename can be replaced with a (limited) shell function:
basename(){ builtin echo "${1##*/}" ; }
# A function to start a program.
daemon() {
# Test syntax.
if [ $# = 0 ]; then
echo "Usage: daemon {program}"
return 1
fi
# Save basename.
base=`basename $1`
# See if it's already running.
[ "`pidofproc $base`" != "" ] && return
# And start it up (with error logging):
[ "${VERBOSE_BOOTUP}" ] || builtin echo -n .
run_prog "$@"
}
run_prog(){
base=`basename $1`
"$@" ||
if [ "`pidofproc $base`" = "" ] ; then
shift
VERBOSE_BOOTUP=error Logger "${ST_MSG:=Start of} $base $* *** FAILED ****"
touch /tmp/FAILED_DAEMON_MARKER
return 1
fi
shift
Logger "${ST_MSG:=Started} $base $*"
}
echo(){
# Converts messages of the form: echo -n "Starting XXX: " for the Logger function
# or alternately: echo -n "Shutting down XXX services: "
if [ "$#" = 0 -a "$ECHO" ]; then
# for the terminating echo in converted statements
# Do only if logger ran (ST_MSG is reset):
[ "$ST_MSG" = ' ' ] && builtin echo
unset ST_MSG ECHO LOG_MSG
#elif [ "X${1}" = X-n -a \( "X${2#Shutting}" != "X$2" -o "X${2#Starting}" != "X$2" \) ]
elif [ "X${1}" = X-n ] ; then
case "$2" in
Shutting*|Starting*|Stopping*)
ST_MSG="$2" ECHO="builtin echo" # save it for "Logger" function
;;
# For normal echo statements:
*) builtin echo "$@" ;;
esac
else
# For normal echo statements:
if [ "$SERIAL_CONSOLE" ] ; then
builtin echo "$@" > $SERIAL_CONSOLE
else
builtin echo "$@"
fi
fi
}
Logger(){
declare LOGGER_TAG="-t daemon"
if [ "$ECHO" -a "${VERBOSE_BOOTUP}" ]; then
# For old message compatibility:
builtin echo -n "$@"
# unset LOG_MSG
logger -p local3.info $LOGGER_TAG "${LOG_MSG}$*"
[ "$ST_MSG" = ' ' ] || LOG_MSG="$ST_MSG "
ST_MSG=' '
else
# builtin echo actual mesg is: $*
logger -p local3.info $LOGGER_TAG ${VERBOSE_BOOTUP:+-s} "$*"
unset ST_MSG
fi
no_syslog_echo "$*"
}
no_syslog_echo(){
# logging doesn't work until syslogd is running, so we do it "manually"
[ -f /var/lock/subsys/syslog ] && return 0
builtin echo "syslog off: $*" >> /var/log/init_daemons
builtin echo "syslog off: $*" >> ${LOG_TTY:=/dev/tty12}
return 1
}
# A function to stop a program.
killproc() {
# Test syntax.
if [ $# = 0 ]; then
echo "Usage: killproc {program}"
return 1
fi
# Save basename.
base=`basename $1`
# Find pid.
pid=`pidofproc $base`
# Kill it.
if [ "$pid" != "" ] ; then
if kill -9 $pid
then
Logger "${ST_MSG:=Killed} $base"
else
Logger "Kill of $base *** FAILED ****"
fi
fi
# Remove pid file if any.
rm -f /var/run/$base.pid
}
# A function to find the pid of a program.
pidofproc() {
# Test syntax.
if [ $# = 0 ] ; then
echo "Usage: pidofproc {program}"
return 1
fi
# First try "pidof"
type pidof > /dev/null 2>&1 && {
pid=`pidof $1`
if [ "$pid" != "" ] ; then
builtin echo $pid
return 0
fi
}
# Next try "/var/run/*.pid" files
type head > /dev/null 2>&1 &&
if [ -f /var/run/$1.pid ] ; then
pid=`head -1 /var/run/$1.pid`
if [ "$pid" != "" ] ; then
builtin echo $pid
return 0
fi
fi
# To speed things up:
[ "$SKIP_AWK" ] && return
type awk > /dev/null 2>&1 || return
type ps > /dev/null 2>&1 || return
# Finally try to extract it from ps
ps auxw | awk 'BEGIN { prog=ARGV[1]; ARGC=1 }
{ if ((prog == $11) || (("(" prog ")") == $11) ||
((prog ":") == $11)) { print $2 } }' $1
}
next prev parent reply other threads:[~ UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <357e4331.ccs@ccs.covici.com>
` L. C. Robinson
` Luke Davis
[not found] ` <+Fvf10r1Jg6U089yn@ccs.covici.com>
` John Covici
[not found] ` <h3uf10r1J8vU089yn@ccs.covici.com>
` John Covici
` L. C. Robinson [this message]
[not found] <357f91ed.ccs@ccs.covici.com>
` L. C. Robinson
[not found] ` <5MZg10r1JgCU089yn@ccs.covici.com>
` John Covici
` L. C. Robinson
segmentation fault?? John Covici
` segmentation fault?? and fsck problems L. C. Robinson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.3.95.980610180759.30808A-200000@draken.localnet \
--to=lcr@draken.localnet \
--cc=blinux-list@redhat.com \
--cc=infynity@cyberhighway.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).