Re: Logging Init output?

2001-06-24 Thread will trillich
On Sat, Jun 23, 2001 at 12:06:27AM +0200, Joost Kooij wrote:
> On Fri, Jun 22, 2001 at 10:52:03PM +0200, Mart van de Wege wrote:
> > I was actually being ironic when I mentioned my 'scant' knowledge. At
> 
> That's okay, because there are many subscribers to debian-user and some
> of them appreciate an answer that does more than reply to strictly the
> question asked.  That way, just by reading posts by others, I learnt a
> lot myself and I enjoyed it.  When I post, people can correct me if I'm 
> wrong about something, which is good because people tend to be a lot more
> forgiving than computers.
> 
> > least I am happy to report that I know how init works, but I am still a
> > little wary of fooling with shell scripting of any sort. Funny thing is
> > that I *do* understand moderately complex Perl a lot better. Am I weird or
> > not?
> 
> Yes, definately.  Just go and bash ahead at those shell scripts.  What can 
> go really wrong here?  Just don't do it on your company's database server.
> Wait, did you mention "weird"? ;-)



okay, here's another thought--

# apt-get install bsdutils

# cd /etc/init.d
# mv rc rc.real
# touch rc
# chmod +x rc
# vi rc

and in the new rc, put something like

#!/bin/sh
script /etc/init.d/rc.startup.LOG < 
:
Tired of SLOW BROWSING THROUGH THE ONLINE APACHE MANUAL? Get
your own local copy and never worry about bandwidth again:
apt-get install apache-doc
Then browse /usr/share/doc/apache/manual.html, quick like a
bunny.

Also see http://newbieDoc.sourceForge.net/ ...



Re: Logging Init output?

2001-06-22 Thread Ross Boylan
It is annoying that not all the messages that go to the screen go
somewhere else.  As one possible reason for this, I'll just tell you
what happened when I tried to alter the scripts to write more stuff to
a file: it didn't work.

The problem is that early in the boot process the file system is
read-only (or at least some of the file system is).  Then the fact
that I got errors from illegal writes in turn caused more serious
problems.  At least that was my interpretation of what happened.  I
backed out the logging, and things went back to normal.



Re: Logging Init output?

2001-06-22 Thread Joost Kooij
On Fri, Jun 22, 2001 at 10:52:03PM +0200, Mart van de Wege wrote:
> I was actually being ironic when I mentioned my 'scant' knowledge. At

That's okay, because there are many subscribers to debian-user and some
of them appreciate an answer that does more than reply to strictly the
question asked.  That way, just by reading posts by others, I learnt a
lot myself and I enjoyed it.  When I post, people can correct me if I'm 
wrong about something, which is good because people tend to be a lot more
forgiving than computers.

> least I am happy to report that I know how init works, but I am still a
> little wary of fooling with shell scripting of any sort. Funny thing is
> that I *do* understand moderately complex Perl a lot better. Am I weird or
> not?

Yes, definately.  Just go and bash ahead at those shell scripts.  What can 
go really wrong here?  Just don't do it on your company's database server.
Wait, did you mention "weird"? ;-)

Don't be afraid to fool with the scripts in /etc/init.d.  It's a feature
of the os.  Notice that these files are all interpreted scripts, not a
single one is a precompiled binary.  If the init system were compiled
c code, then that would make booting a lot faster.  The one good reason
why they are shell scripts still, is exactly so that you can hack them.
Even when the system is otherwise totally broken.  As long as /bin/sh,
/bin/awk and some friends work, you can fix things (note you don't really
need an editor even).

I think I learnt a lot about shell scripting from precisely this, 
futzing with initscripts and maintainer scripts and some of my own
little creatures.  

Cheers,


Joost



Re: Logging Init output?

2001-06-22 Thread Mart van de Wege
On Fri, 22 Jun 2001 12:35:51 +0200
[EMAIL PROTECTED] (Joost Kooij) wrote:


Thanks Joost.
I was actually being ironic when I mentioned my 'scant' knowledge. At
least I am happy to report that I know how init works, but I am still a
little wary of fooling with shell scripting of any sort. Funny thing is
that I *do* understand moderately complex Perl a lot better. Am I weird or
not?
Thanks again,

Mart



Re: Logging Init output?

2001-06-22 Thread Joost Kooij
On Fri, Jun 22, 2001 at 10:28:59AM +0200, Mart van de Wege wrote:
> Thanks for the tip with shift-pageup. I do know about that but I keep
> forgetting it. I don't know if it goes back far enough for my purposes,
> but I'll give it a shot next time. For the record though, I wasn't talking
> about the kernel boot messages, which is what dmesg returns, but about the
> init messages, which to my scant knowledge aren't logged anywhere.

The output of sysvinit scripts is sent to standard output and any errors
that occur are naturally sent to standard error.  Maybe it would be a nice
feature indeed to have all these messages sent to syslog for the record.
You could submit a wishlist bug about that against sysvinit.

In your case, which is really about debugging some particular problem
in one of the init scripts, don't be afraid to hack a little on some of
these sysvinit scripts.  They are the files in /etc/init.d and they're
supposed to by modifyable by the local admin (that's why they're in
/etc and not in /usr/lib).  You can simply put in some extra "echo's"
and if you want the script to pause at some point, put in "read dummy"
and the shell will stop at that point to read input from standard input
(the console in this case) into the variable "dummy" (be careful that the
script you're hacking didn't accidentally already use that variable :-) ).

If you are unsure about your editing of these system files, just make
a backup with .orig appended onto the filename.

Now you should find the proceeding of things during boot time more clear.
If not, just hack a bit more :-)

If you happen to succeed in making the sysvinit boot system crap out
(this should be really hard to make happen though) due to bad code in
some of your edits:  You can aways boot your linux with "init=/bin/bash"
appended on the lilo prompt.  That way, regular /sbin/init will not
be started and the sysvinit scripts are skipped altogether.  In fact
if you boot with a different init, you may not even get to see login,
just a bare root prompt.  Which is why console access to a machine forms
a security risk, unless you carefull tune some things (like turning of
the default handler for ctrl-alt-del - in /etc/inittab iirc).

man init
man inittab
and maybe
man run-parts

Cheers,


Joost



Re: Logging Init output?

2001-06-22 Thread Mart van de Wege
On Thu, 21 Jun 2001 18:12:48 -0500
will trillich <[EMAIL PROTECTED]> wrote:

> On Thu, Jun 21, 2001 at 04:26:41PM -0600, Jimmy Richards wrote:
> > On Thu, Jun 21, 2001 at 11:36:58PM +0200, Mart van de Wege wrote:
> > > 
> > > I'll provide a little background first: this weekend, the loopback
> > > interface on my laptop stopped working. I checked all config files,
and
> > > they are ok, I can also bring up the loopback manually with
'ifconfig lo
> > > 127.0.0.1 up' after which it functions normally. I have seen however
an
> > > error message flashing by during boot, but it passes too fast for me
to
> > > see what it says.
> > > Thus my question: is it somehow possible to log the output of the
init
> > > scripts somehow, so that I can debug this problem (the error message
only
> > > started appearing after I lost loopback, so I'm guessing they are
> > > related).
> > 
> > You can try to catch it with a CTRL-S while booting. This will
> > 'suspend' any further processing of the boot process until you press
> > CTRL-Q to let it continue. It gives you a chance to read and examine
> > the boot messages at your leisure, but it can be hard to catch it
> > when it's on the last one or two boot processes though.
> 
> 1) ^S/^Q can work wonders (after the kernel enables it)
> 
> 2) shift-pageup/shift-pagedown to scroll console (and
>rxvt/xterm windows)
> 
> 3) man dmesg
> 
>The program helps users to print  out  their  bootup  mesĀ­
>sages.   Instead of copying the messages by hand, the user
>need only:
>   dmesg > boot.messages
>and mail the boot.messages file to whoever can debug their
>problem.
> 
Ok,

Thanks both of you. I'll answer your suggestions in this email.
Jimmy:
It is in fact one of the first init messages after the kernel boot
messages, and I have a lot of services on this laptop (I intend to use it
as an all-purpose mobile development workstation), so that is why it
flashes by so quick. Had it been the last message, I would have no
problem, as Debian does not clear the console after boot, so ctrl-alt-f1
would have solved it. I'll try freezing init on the next boot though (it
might be a while, I suspend this laptop instead of switching off).
Will:
Thanks for the tip with shift-pageup. I do know about that but I keep
forgetting it. I don't know if it goes back far enough for my purposes,
but I'll give it a shot next time. For the record though, I wasn't talking
about the kernel boot messages, which is what dmesg returns, but about the
init messages, which to my scant knowledge aren't logged anywhere.

Thanks

Mart



Re: Logging Init output?

2001-06-21 Thread will trillich
On Thu, Jun 21, 2001 at 04:26:41PM -0600, Jimmy Richards wrote:
> On Thu, Jun 21, 2001 at 11:36:58PM +0200, Mart van de Wege wrote:
> > 
> > I'll provide a little background first: this weekend, the loopback
> > interface on my laptop stopped working. I checked all config files, and
> > they are ok, I can also bring up the loopback manually with 'ifconfig lo
> > 127.0.0.1 up' after which it functions normally. I have seen however an
> > error message flashing by during boot, but it passes too fast for me to
> > see what it says.
> > Thus my question: is it somehow possible to log the output of the init
> > scripts somehow, so that I can debug this problem (the error message only
> > started appearing after I lost loopback, so I'm guessing they are
> > related).
> 
>   You can try to catch it with a CTRL-S while booting. This will
>   'suspend' any further processing of the boot process until you press
>   CTRL-Q to let it continue. It gives you a chance to read and examine
>   the boot messages at your leisure, but it can be hard to catch it
>   when it's on the last one or two boot processes though.

1) ^S/^Q can work wonders (after the kernel enables it)

2) shift-pageup/shift-pagedown to scroll console (and
   rxvt/xterm windows)

3) man dmesg

   The program helps users to print  out  their  bootup  mesĀ­
   sages.   Instead of copying the messages by hand, the user
   need only:
  dmesg > boot.messages
   and mail the boot.messages file to whoever can debug their
   problem.


-- 
DEBIAN NEWBIE TIP #6 from Will Trillich <[EMAIL PROTECTED]>
:
How do you keep text from SCROLLING BY TOO DAMN FAST? :)
Before pressing the ENTER key of a command that you know will
generate a lot of output, "pipe" it through your pager:
ls -lR | pager
locate tgz | pager
grep -r pattern /home | pager
You can also try - to scroll back. This works
both at the console and in rxvt/xterm windows.

Also see http://newbieDoc.sourceForge.net/ ...



Re: Logging Init output?

2001-06-21 Thread Jimmy Richards
On Thu, Jun 21, 2001 at 11:36:58PM +0200, Mart van de Wege wrote:
> Folks,
> 
> I'll provide a little background first: this weekend, the loopback
> interface on my laptop stopped working. I checked all config files, and
> they are ok, I can also bring up the loopback manually with 'ifconfig lo
> 127.0.0.1 up' after which it functions normally. I have seen however an
> error message flashing by during boot, but it passes too fast for me to
> see what it says.
> Thus my question: is it somehow possible to log the output of the init
> scripts somehow, so that I can debug this problem (the error message only
> started appearing after I lost loopback, so I'm guessing they are
> related).
> 
> Mart
> 

Hi Mart,

You can try to catch it with a CTRL-S while booting. This will
'suspend' any further processing of the boot process until you press
CTRL-Q to let it continue. It gives you a chance to read and examine
the boot messages at your leisure, but it can be hard to catch it
when it's on the last one or two boot processes though.

Cheers,

Jimmy Richards

> -- 
> To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


binhzjdP6i5m2.bin
Description: PGP Key 0x0062D7A7.


pgpSzBBPER3iI.pgp
Description: PGP signature


Logging Init output?

2001-06-21 Thread Mart van de Wege
Folks,

I'll provide a little background first: this weekend, the loopback
interface on my laptop stopped working. I checked all config files, and
they are ok, I can also bring up the loopback manually with 'ifconfig lo
127.0.0.1 up' after which it functions normally. I have seen however an
error message flashing by during boot, but it passes too fast for me to
see what it says.
Thus my question: is it somehow possible to log the output of the init
scripts somehow, so that I can debug this problem (the error message only
started appearing after I lost loopback, so I'm guessing they are
related).

Mart