Tiny Core Linux

Tiny Core Base => TCB Talk => Topic started by: floppy on April 15, 2012, 09:55:08 AM

Title: Any DEBUG boot option available in CoreLinux?
Post by: floppy on April 15, 2012, 09:55:08 AM
I am experiencing different install on different HW.
In case of frozen mouse, keyboard, screen.. it is a bit difficult to have a look at the log files (Xorg.0.log, dmesg).
So, is there any method to store different log files onto a directory on an USB stick for example?
Example by using a theoretical boot code "debug=/mnt/sda1" (which could become active/available by loading an extension debug.tcz on boot):
every 0,1 s different files would be written on the /mnt/sda1 devices with root access (dmesg, Xorg.0.log.. list to be defined). with that method, we could see what was the last event befor it froze or before the PC was shut off (after it freeze).
Is there a similar method in TinyCore?

(this question came up since I see that  thread http://forum.tinycorelinux.net/index.php/topic,11530.msg60876.html#msg60876
Title: Re: Any DEBUG boot option available in CoreLinux?
Post by: AbNoRMiS on April 15, 2012, 12:43:52 PM
dear floppy
you can place script opt_save_varlogs.sh with the following code to /opt
Code: [Select]
#!/bin/sh

while true; do
    dmesg > /var/log/dmesg
    cp -rf /var/log /etc/sysconfig/tcedir
    sync
    sleep 5
done
and add it run to bootlocal.sh
Code: [Select]
echo "/opt/opt_save_varlogs.sh &" >> /opt/bootlocal.shfolder /var/log will saved every 5 sec to your usb stick in tce dir

also can add syslog bootcode to get system messages
Title: Re: Any DEBUG boot option available in CoreLinux?
Post by: AbNoRMiS on April 15, 2012, 02:15:28 PM
also in tinycore have bootcode rsyslog which yet undocumented for some reason
Code: [Select]
rsyslog="OPTIONS"where OPTIONS are syslogd options (see in tc-config)
Quote
tc@box:~$ syslogd --help
BusyBox v1.19.4 (2012-03-09 02:27:21 UTC) multi-call binary.

Usage: syslogd [OPTIONS]

System logging utility
(this version of syslogd ignores /etc/syslog.conf)

   -n      Run in foreground
   -O FILE      Log to FILE (default:/var/log/messages)
   -l N      Log only messages more urgent than prio N (1-8)
   -S      Smaller output
   -s SIZE      Max size (KB) before rotation (default:200KB, 0=off)
   -b N      N rotated logs to keep (default:1, max=99, 0=purge)
   -R HOST[:PORT]   Log to IP or hostname on PORT (default PORT=514/UDP)
   -L      Log locally and via network (default is network only if -R)
   -D      Drop duplicates
   -C[size_kb]   Log to shared mem buffer (use logread to read it)
Title: Re: Any DEBUG boot option available in CoreLinux?
Post by: AbNoRMiS on April 16, 2012, 08:05:29 AM
i modified script opt_save_varlogs.sh for using with bootcode syslog[=folder]
where folder defines place on the boot device for /var/log storing

place script opt_save_varlogs.sh with the following code to /opt
Quote
#!/bin/sh
. /etc/init.d/tc-functions
checkroot
LOGDIR=`getbootparam syslog 2>/dev/null` || exit 1
DEVICE=`readlink /etc/sysconfig/tcedir | cut -f3 -d/`
[ "$DEVICE" == "tce" ] && ( [ -f /etc/sysconfig/cde ] && DEVICE=`cat /etc/sysconfig/cde | cut -f3 -d/` || exit 1 )
if [ -z "$(getbootparam rsyslog 2>/dev/null)" ]; then
    /sbin/syslogd && echo "${GREEN}syslog started.${NORMAL}"
    /sbin/klogd && echo "${GREEN}klog started.${NORMAL}"
fi
while true; do
    dmesg > /var/log/dmesg
    mkdir -p /mnt/$DEVICE/$LOGDIR/log
    cp -rf /var/log /mnt/$DEVICE/$LOGDIR
    sync
    sleep 5
done
and add it run to bootlocal.sh
Code: [Select]
echo "nohup /opt/opt_save_varlogs.sh >/dev/null &" >> /opt/bootlocal.shnow folder /var/log will be saved to specified folder on your boot usb stick every 5 sec

p.s.
script will works in core 4.2+
Title: Re: Any DEBUG boot option available in CoreLinux?
Post by: floppy on April 17, 2012, 01:12:12 PM
VERY good.
As an extension? .. (sorry.. much easier for transporting it from version to version..)
Title: Re: Any DEBUG boot option available in CoreLinux?
Post by: AbNoRMiS on April 17, 2012, 02:03:36 PM
sorry floppy, i not quite understood
are you want have extension with this script?
Title: Re: Any DEBUG boot option available in CoreLinux?
Post by: AbNoRMiS on April 17, 2012, 08:52:09 PM
by the way
to bind running this script with syslog bootcode
was beautiful but perhaps not most successful solution
through this syslog starts only after extensions loading
and therefore loses extensions loading log
correctly would be if script will launched
by other bootcode log={folder}
Quote
#!/bin/sh
. /etc/init.d/tc-functions
checkroot
LOG=`getbootparam log 2>/dev/null` || exit 1
DEV=`readlink /etc/sysconfig/tcedir | cut -f3 -d/` || DEV=`cat /opt/.tce_dir | cut -f3 -d/`
[ "$DEV" == "tce" ] && ( [ -f /etc/sysconfig/cde ] && DEV=`cat /etc/sysconfig/cde | cut -f3 -d/` || exit 1 )
while true; do
    dmesg > /var/log/dmesg
    mkdir -p /mnt/$DEV/$LOG/log
    cp -rf /var/log /mnt/$DEV/$LOG
    sync
    sleep 5
done
can compare logs saved by this and previous script
Title: Re: Any DEBUG boot option available in CoreLinux?
Post by: floppy on April 18, 2012, 02:45:47 PM
sorry floppy, i not quite understood
are you want have extension with this script?
I mean:
- create a debuglog.tcz
- by installing that tcz onboot and using the bootcode log=<fiolder>
Title: Re: Any DEBUG boot option available in CoreLinux?
Post by: AbNoRMiS on April 19, 2012, 11:51:13 AM
submit to repo extension
that contains a script with 10 lines
somehow not respectably :D
attach extensions to the forum
also prohibited as i understand

i attached script tc-log.sh
that creates extension tc-log.tcz
and adds it to on-boot list

the principle of using the same:
bootcode log={folder}
folder creates/exist on the boot device
/var/log will saved every 5 sec
Title: Re: Any DEBUG boot option available in CoreLinux?
Post by: Rich on April 19, 2012, 12:27:43 PM
Hi AbNoRMiS
Quote
attach extensions to the forum also prohibited as i understand
That is correct.
Title: Re: Any DEBUG boot option available in CoreLinux?
Post by: vinnie on April 19, 2012, 07:39:48 PM
From now on you will be known as "the exploits master"   ;D
Title: Re: Any DEBUG boot option available in CoreLinux?
Post by: AbNoRMiS on April 20, 2012, 09:13:18 AM
mbr exploiter
don't make me laugh
because i can squirt
:D