# bootlogging showconsole vs. bootlogd

## marcelser

Hi,

I found out that there are two programs which do a logging of the console output during the bootprocess one is "app-admin/showconsole" which uses /sbin/blogd and and places a shell script /lib/rcscripts/addons/blogger.sh, the output of the boot process should result in /var/log/boot.msg

on the other hand there is bootlogd which is part of the baselayout and seems to do the same job producing a /var/log/boot file.

Problem is: Neither of them can be started easily. The blogger.sh file in /lib/rcscripts/addons for example looks for a ${RC_BOOTLOG} == yes variable and for the moment I haven't found out where I have to set this variable (wild guess: Do I have to patch the .config for the kernel??)

The booglogd on the other hand has no start file in /etc/init.d/. Can someone maybe provide a init file so the logger would be started as soon as possible (at best just after loading the kernel).

I would be really great if some gurus could provide infos on how to start one of these console loggers.

Thanks a lot

----------

## nielchiano

just a "me-too" post... (and a bump)

----------

## nielchiano

found this (haven't tried it yet): http://users.tkk.fi/~jvroutak/r50/config/etc/init.d/stop-bootlogd

----------

## mwiertz

Hi,

just a kind of me-too post...

I came across the showconsole app today and I'm still wondering how to get it running... if someone please could help?

----------

## nielchiano

I've been doing some research on it.

Bootlogd seems like the thing that will make it into gentoo. Program looks nice, but doesn't have an init script.

I'm on vacation now, so I'll be at the beach rather than writing init-scripts; but when I get back to update my server I might write one myself... stay tuned...

PS: MIGHT, don't flame me because I didn't. (you can, however, remind me...)

----------

## marcelser

Hi Nielchiano,

 *nielchiano wrote:*   

> I've been doing some research on it.
> 
> Bootlogd seems like the thing that will make it into gentoo. Program looks nice, but doesn't have an init script.
> 
> I'm on vacation now, so I'll be at the beach rather than writing init-scripts; but when I get back to update my server I might write one myself... stay tuned...
> ...

 

There's no need to write something for bootlogd because it happens that bootlogd is not making it into gentoo. If you upgrade to baselayout 1.11.13 and you look into /sbin/rc you will see bootlog start, bootlog sync and bootlog quit commands and you will notice that in /sbin/functions.sh the bootlogger.sh addon which controls blogd is imported. All that's missing is the needed RC variable in /etc/conf.d/rc.

So to get blogd working all you have to do is:

1.) emerge showconsole

2.) add RC_BOOTLOG="yes" to /etc/conf.d/rc

of course you need to upgrade to baselayout 1.11.13 before doing this steps.

Then all boot messages are logged to /var/log/boot.msg until runlevel 3 is reached. Also blogd has the big advantage that it strips ANSI color codes making boot.msg real easily readable where as bootlogd logs everything which makes the produced boot log file is nearly unreadable.

If you wish full bootlogging past runlevel 3 until local is started you have to do a bit of tweaking yourself like this:

add this init script /etc/init.d/blogd

```
#!/sbin/runscript

depend () {

        need net

        need mysql

}

start() {

        ebegin "Flushing bootlogd"

          source /sbin/functions.sh

          blogd_start

        eend $?

}
```

and add it to runlevel boot.

edit /etc/conf.d/local.start and add the following:

```
# sync & stop blogd

killall -QUIT blogd
```

This stops the bootlog processes that were started by the blogd init script after the boot process is completed and appends also messages past runlevel 3 to /var/log/boot.msg.

So, now bootlogging works prefectly for me, but if you have any improvments for my scripts I'm interested in everything.

----------

## John R. Graham

Marc,

It may be that your setup is different than mine as I get some strange errors after verifying that I was using baselayout 1.11.13, (successfully) emerging showconsole, and adding the RC_BOOTLOG="yes" to "/etc/conf.d/rc":

First, during boot when the filesystem is remounted read-only for the filestem check, I get a failure:

```
 * Remounting root filesystem read-only ...

mount: / is busy                                                                [!!]

 * Skipping root filesystem check (fstab's passno == 0) ...                     [ok]

```

Second, later on in the boot, when (I presume) an attempt is made to stop blogd after it has done its job, I get another error message that appears (??) to indicate that blogd may never have run.  Showing context on both sides:

```

 * Setting system clock to hardware clock [UTC] ...                             [ok]

blogd: no process killed

 * Configuring kernel parameters ...                                            [ok]

```

Finally, although I do get a "var/log/boot.msg" file, it is invariably only one byte long.  I suspect that this is because of the

```
echo > /var/log/boot.msg

```

 in the "/lib/rcscripts/addons/bootlogger.sh" script, which is probably supposed to force blogd to flush its data first before the echo logically is allowed to complete.  What I'm guessing is that, for some reason, blogd is not actually being started.

Incidentally, I didn't complete the second part of your recommendation (the part involving logging after runlevel 3) merely because I was trying to take it one step at a time.

Does all this suggest anything to you?

- John

----------

## marcelser

Hi John,

 *john_r_graham wrote:*   

> 
> 
> It may be that your setup is different than mine as I get some strange errors after verifying that I was using baselayout 1.11.13, (successfully) emerging showconsole, and adding the RC_BOOTLOG="yes" to "/etc/conf.d/rc":
> 
> First, during boot when the filesystem is remounted read-only for the filestem check, I get a failure:
> ...

 

As I've managed to get blogd working before baselayout 1.11.13 and have played around quite a lot, I don't think that the first error "mount: / is busy" is because of blogd beeing started. Did you check if this error occurs also before you emerged showconsole? Maybe this is because of baselayout 1.11.13 which incorporated some changes or of some config files you changed when trying to get 1.11.13 running? The second message: "blogd: no process killed" shows that blogd could not be started (and therefore it can't be synced or stopped) but at least it shows that your RC_BOOTLOG variable is beeing read. Because without RC_BOOTLOG="yes" beeing set correct the bootlogger.sh script does not do anything.

First thing to try is to set RC_BOOTLOG="no" and check if the mount error still occurs. If it does, it has nothing to do with blogd. It would also be interesting see more boot messages. Could you maybe post all messages boot messages which show up until runlevel 3? if you would be sure that no part of blogd is beeing executed not even bootlogger.sh then of course you could unmerge showconsole.

Actually the /sbin/rc script which is responsible mainly to start the needed runlevels first starts the sysvinit level and after the proc & dev filesystems are mounted it starts blogd. At the point where the filesystem becomes r/w it writes the collected boot messages which it holds in memory to the /var/log/boot.msg file and when the sysvinit level is completed it stops blogd.

With the additional scripts I provided you can re-start blogd and continue bootlogging to boot.msg and stop it when local.start is executed which is the last thing which is started in the boot process, but this additional stuff as you said is not really necessary.

----------

## naga

I get those same messges (blogd: no process killed ) but  my guess is that they are because one of the first lines say something like this "blogd: console="/dev/vc1" stdin="/dev/vc1" must be different". Now the question is where do one change this and to what?

----------

## marcelser

 *naga wrote:*   

> I get those same messges (blogd: no process killed ) but  my guess is that they are because one of the first lines say something like this "blogd: console="/dev/vc1" stdin="/dev/vc1" must be different". Now the question is where do one change this and to what?

 

this message normally appears when you're not in boot mode and you try to start blogd in your bash because blogd tries to capture the actual terminal and open a new one, it the input and output terminal it tries to read and write are the same (which means that opening a new output console failed) it reports that by this message. So, if this message appears during your boot process it seems that blogd could not open a new output console for whatever reason.

Could you please report your kernel version, if udev of fsdev and if you have enable to save the /dev tarballs in /etc/conf.d/rc or not. The last thing which would be interesting is which baselayout you have and if you have a serial console.

Maybe then we can sort out why blogd could not open a new console, however I'm not a programmer.

----------

## cbolin

marcelser,

Thanks for the post but when I use your script and instructions the content of boot.msg is exactly the same as after I've just emerged showconsole.  Am I missing something?  I've verified I made the correct changes you describe...

If this did work I would argue it should go into the showconsole ebuild as it then does what almost everyone would expect.

Thanks again.

----------

## naga

 *marcelser wrote:*   

> Could you please report your kernel version, if udev of fsdev and if you have enable to save the /dev tarballs in /etc/conf.d/rc or not. The last thing which would be interesting is which baselayout you have and if you have a serial console.
> 
> 

 

app-admin/showconsole-1.07

sys-apps/baselayout-1.12.0_pre6 - no serial console

sys-kernel/gentoo-sources-2.6.12-r9 - with udev and RC_DEVICE_TARBALL="yes"

Sorry to say that I've removed this setup, but it may help someone sometime, I hope  :Smile: 

----------

## marcelser

As I've said in this thread before: You need at least baselayout 1.11.13, in 1.11.12_pre6 the necessary commands to load, sync & quit blogd in /sbin/rc and /sbin/functions.sh are not available, they were implemented in 1.11.13. 

If you want to make blogd work with a pre 1.11.13 version you'd have to modify /sbin/rc and /sbin/functions.sh, I've done that before but believe me it was not easy and I only managed to get it working with trial & error, until I found the right places where to load and start, sync & quit blogd.

Best regards,

Marc

----------

## naga

I'm I missing something or... baselayout-1.12.0_pre7 is a greater version then baselayout 1.11.13.

----------

## swimmer

Hmm - I'm getting the same error: *Quote:*   

> blogd: console=/dev/tty1, stdin=/dev/tty1, must differ, boot logging disabled

 

sys-apps/baselayout -> 1.11.13-r1

app-admin/showconsole -> 1.07

sys-kernel/gentoo-sources -> 2.6.12-r9 with udev and RC_DEVICE_TARBALL="yes" 

I'm not sure whether I have serial console but I do not think so  :Wink: 

So who can give me an hint what's going on?

Greetz

swimmer

----------

## marcelser

Of course you people are right, that the things like the RC_BOOTLOG="yes" things and an /etc/init.d/blogd script should go into the "showconsole" package, but I'm not the maintainer of the thing, also I don't know where the problem lies. I have setup blogd on 3 different gentoo machines (2 of my own) and one of my brother and it works perfectly an all 3 machines although they are of different age and I used different stages to install (two are stage 3 installs and one is a stage 1 but with newer gcc), I also use udev with RC_DEVICE_TARBALL="yes" and I don't know why blogd does not start on your machines. So, I'm sorry but I can't help you any further.

----------

## wolfbite_aus

Why is mysql needed?

add this init script /etc/init.d/blogd

```
#!/sbin/runscript

depend () {

        need net

        need mysql

}

start() {

        ebegin "Flushing bootlogd"

          source /sbin/functions.sh

          blogd_start

        eend $?

}
```

and add it to runlevel boot.

edit /etc/conf.d/local.start and add the following:

```
# sync & stop blogd

killall -QUIT blogd
```

This stops the bootlog processes that were started by the blogd init script after the boot process is completed and appends also messages past runlevel 3 to /var/log/boot.msg.

So, now bootlogging works prefectly for me, but if you have any improvments for my scripts I'm interested in everything.[/quote]

----------

## wolfbite_aus

Finally got showconsole AND bootchart working

seems to be something to do with initramfs (but dont know why)

genkernel --menuconfig all  (wont work)

make menuconfig (works)

title kernel-genkernel-x86-2.6.13-gentoo-r1 BOOTCHART working  :Smile: 

        root (hd1,0)

        kernel /kernel-genkernel-x86-2.6.13-gentoo-r1 ro init=/sbin/bootchartd video=vesafb:1024x768-32@85

        initrd /config-2.6.13-gentoo-r1

this even works

genkernel --menuconfig all

then

make && make modules && make modules_install && make install

it works!!! thats all i care about

ps (not sure but check and make sure TMPFS is also on)

----------

## wolfbite_aus

MUST have the dir too

/var/log/bootchart

----------

## MALON3

hi 

That howto works fine for me , thanks to the author  :Smile: 

But now i have problems with my /var partition...

At boot time when the bootlogd initscript is executed i got following message:

```

bootlogd: no message logging because /var file system is not accesible

```

Permissons and mount options:

```

drwxr-xr-x  14 root root  4096  4. Dez 12:51 var

/dev/hda5 on /var type ext3 (rw,nosuid,nodev,noatime)

```

And it was logged only the bootrunlevel...

any ideas?

greetz

----------

## wolfbite_aus

been awhile since I played with that  :Smile: 

gave it a miss because it wasnt catching everything

and because showconsole doesnt look like its being maintained.

(you would think it would be easy to catch output to the screen, but doesnt seem so)

rough guess the TMPFS is enabled in the kernel?

Did keep using the bootchart (good for testing startups and initng)

Might try it all again once I solve my raid+kernel problem

----------

