DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2014-05-02 21:24:47

profm2
Member
Registered: 2008-11-14
Posts: 18

Fscking problem

Hey all,

The other day I happened to notice that one of my two DNS-323 had an issue.  After deleting all of the files off one of the drives, it claimed I still had ~180G left on the drive.  Ran 'dmesg' and verified that I must have had a power bump, and uncleanly shut down.

Went out to http://www.inreto.de/dns323/fsck/ ... downloaded and followed the instructions given ... and no dice.  The reload.sh script fails.  So, I went and added in some logging to figure out where it was dying.

Code:

#!/ffp/bin/bash
export PATH=/ffp/sbin:/ffp/bin:$PATH

# parameters
machtype=1542
kernel=$(readlink -f zImage)
initrd=$(readlink -f initramfs.gz)
logfile="/ffp/fsck/file.log"

if [ -r "$1" ]; then
    kernel=$(readlink -f "$1")
fi

# network config
dev=egiga0
ipaddr=$(ifconfig $dev | awk '/inet addr/ {print substr($2,6)}')
netmask=$(ifconfig $dev | awk '/inet add/ {print substr($4,6)}')
broadcast=$(ifconfig $dev | awk '/inet addr/ {print substr($3,7)}')
gateway=$(route -n | awk '$1 == "0.0.0.0" {print $2}')

# kernel command line
# it's eth0 in 2.6.25, egiga0 in 2.6.12
if echo $kernel | grep -q '2\.6\.12'; then
    cmdline="console=ttyS0,115200 ip=$ipaddr::$gateway:$netmask:$(hostname):egiga0:none"
    machtype=526
else
    cmdline="console=ttyS0,115200 ip=$ipaddr::$gateway:$netmask:$(hostname):eth0:none"
fi

echo "kernel:   $kernel"
echo "kernel:    $kernel" > $logfile
echo "cmdline:  $cmdline"
echo "cmdline:  $cmdline" >> $logfile
echo "machtype: $machtype"
echo "machtype: $machtype" >> $logfile

# helper functions

die()
{
echo "die: $@" >> $logfile

    cat >&2 <<EOF
ERROR: $@
EOF
    exit 1
}

reverse_list()
{
    _list=
    while [ $# -gt 0 ]; do
        _list="$1 $_list"
        shift
    done
    echo $_list
echo "reverse_list: $_list" >> $logfile
}

# checks
KV=$(uname -r)
ko=$(readlink -f reloaded-$KV.ko)
test -r reloaded-$KV.ko || die "reloaded-$KV.ko: No compatible 'reloaded' module found for this kernel."
test -r $kernel        || die "$kernel: Kernel not found"
test -r $initrd        || die "$initrd: initramfs not found"
echo "past checks - all files found" >> $logfile
echo "ko: $ko" >> $logfile
echo "initrd: $initrd" >> $logfile

# move to ramdisk and detach
cd /tmp
echo "before exec" >> $logfile
exec >/dev/console 2>&1 </dev/null
echo "after exec" >> $logfile

trap 'echo HUP' HUP

echo "past - move to ramdisk and detach" >> $logfile

# stop ffp 
if [ -d /ffp/start ]; then
    files=$(reverse_list $(rcorder /ffp/start/*.sh))
    for f in $files; do
        if [ -x "$f" ]; then
                echo "$f stop"
echo "$f - stopping" >> $logfile
            $f stop
        fi
    done
fi

# clean up the rest
set -x
echo "about to:  killall5 -TERM" >> $logfile
killall5 -TERM
sleep 2
echo "about to:  killall5 -KILL" >> $logfile
killall5 -KILL
sleep 1

# remount filesystems read-only
sync
echo "sync'ed memory" >> $logfile
for f in /mnt/HD_*; do
    mount -o remount -r $f
done
mount -o remount -r -a
mount

echo "remounted filesystems read-only" >> $logfile

# start new kernel
sync
echo "sync'ed memory" >> $logfile
sleep 1
echo "starting new kernel" >> $logfile
echo "ko: $ko" >> $logfile
echo "machtype: $machtype" >> $logfile
echo "kernel: $kernel" >> $logfile
echo "initrd: $initrd" >> $logfile
echo "cmdline: '$cmdline'" >> $logfile
insmod $ko machtype=$machtype kernel=$kernel initrd=$initrd cmdline="$cmdline"
die "Failed!"

After running the reload script, I had this for a log file ...

Code:

kernel:    /mnt/HD_a2/ffp/fsck/zImage-2.6.25.1
cmdline:  console=ttyS0,115200 ip=192.168.5.101::192.168.5.1:255.255.255.0:Movies:eth0:none
machtype: 1542
past checks - all files found
ko: /mnt/HD_a2/ffp/fsck/reloaded-2.6.12.6-arm1.ko
initrd: /mnt/HD_a2/ffp/fsck/fsck-initramfs.gz
before exec
after exec
past - move to ramdisk and detach
reverse_list: /ffp/start/fp_master.sh /ffp/start/inetd.sh /ffp/start/lighttpd.sh /ffp/start/kickwebs.sh /ffp/start/mysqld.sh /ffp/start/rsyncd.sh /ffp/start/sshd.sh /ffp/start/telnetd.sh /ffp/start/LOGIN.sh /ffp/start/nfsd.sh /ffp/start/portmap.sh /ffp/start/SERVERS.sh 
/ffp/start/sshd.sh - stopping
/ffp/start/telnetd.sh - stopping
/ffp/start/nfsd.sh - stopping
about to:  killall5 -TERM
about to:  killall5 -KILL
sync'ed memory
remounted filesystems read-only
sync'ed memory
starting new kernel
ko: /mnt/HD_a2/ffp/fsck/reloaded-2.6.12.6-arm1.ko
machtype: 1542
kernel: /mnt/HD_a2/ffp/fsck/zImage-2.6.25.1
initrd: /mnt/HD_a2/ffp/fsck/fsck-initramfs.gz
cmdline: 'console=ttyS0,115200 ip=192.168.5.101::192.168.5.1:255.255.255.0:Movies:eth0:none'
die: Failed!

So ... I'm at a complete loss as to why insmod is failing.

The firmware is 1.10, running FFP 0.7 .... AND, the same death happens on BOTH DNS-323's.  I checked my second DNS-323's 'dmesg' and it had ALSO shutdown uncleanly.

Any thoughts?

Offline

 

#2 2014-05-03 14:27:59

Mijzelf
Member / Developer
Registered: 2008-07-05
Posts: 709

Re: Fscking problem

profm2 wrote:

I checked my second DNS-323's 'dmesg' and it had ALSO shutdown uncleanly.

Have a look here.

About your fsck problem, redirect the output of insmod (both stdout and stderr) to your logfile, and also dump your dmesg after the reload attempt. It might tell you why it fails.

Offline

 

#3 2014-05-04 02:05:50

profm2
Member
Registered: 2008-11-14
Posts: 18

Re: Fscking problem

Ahhh ... hmmm.

Code:

insmod: error inserting '/mnt/HD_a2/ffp/fsck/reloaded-2.6.12.6-arm1.ko': -1 Unknown symbol in module

Ok, increased the logging of reload.sh ... and got this at the tail end of the 'dmesg' dump:

Code:

...
EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
EXT3 FS on sdb4, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
reloaded: Unknown parameter `ip'

LOL ... Ok, so it appears that the space in the $cmdline is causing an issue and making insmod think that the IP=... is another parameter of the command.

Last edited by profm2 (2014-05-04 02:42:59)

Offline

 

#4 2014-05-04 02:57:21

profm2
Member
Registered: 2008-11-14
Posts: 18

Re: Fscking problem

Ok ... FINALLY got it working.  The script below is with my logging in, but the insmod line is what was causing everything to fail.  Change the "$cmdline" to \"$cmdline\" ... and it should work.

Code:

#!/ffp/bin/bash
export PATH=/ffp/sbin:/ffp/bin:$PATH

# parameters
machtype=1542
kernel=$(readlink -f zImage)
initrd=$(readlink -f initramfs.gz)
logfile="/ffp/fsck/file.log"
logfile2="/ffp/fsck/file2.log"
bootlog="/ffp/fsck/boot.log"

if [ -r "$1" ]; then
    kernel=$(readlink -f "$1")
fi

# network config
dev=egiga0
ipaddr=$(ifconfig $dev | awk '/inet addr/ {print substr($2,6)}')
netmask=$(ifconfig $dev | awk '/inet add/ {print substr($4,6)}')
broadcast=$(ifconfig $dev | awk '/inet addr/ {print substr($3,7)}')
gateway=$(route -n | awk '$1 == "0.0.0.0" {print $2}')

# kernel command line
# it's eth0 in 2.6.25, egiga0 in 2.6.12
if echo $kernel | grep -q '2\.6\.12'; then
    cmdline="console=ttyS0,115200 ip=$ipaddr::$gateway:$netmask:$(hostname):egiga0:none"
    machtype=526
else
    cmdline="console=ttyS0,115200 ip=$ipaddr::$gateway:$netmask:$(hostname):eth0:none"
fi

echo "kernel:   $kernel"
echo "kernel:    $kernel" > $logfile
echo "cmdline:  $cmdline"
echo "cmdline:  $cmdline" >> $logfile
echo "machtype: $machtype"
echo "machtype: $machtype" >> $logfile

# helper functions

die()
{
echo "die: $@" >> $logfile
echo "dumping dmesg before exiting" >> $logfile
dmesg > $bootlog

    cat >&2 <<EOF
ERROR: $@
EOF
    exit 1
}

reverse_list()
{
    _list=
    while [ $# -gt 0 ]; do
        _list="$1 $_list"
        shift
    done
    echo $_list
echo "reverse_list: $_list" >> $logfile
}

# checks
KV=$(uname -r)
ko=$(readlink -f reloaded-$KV.ko)
test -r reloaded-$KV.ko || die "reloaded-$KV.ko: No compatible 'reloaded' module found for this kernel."
test -r $kernel        || die "$kernel: Kernel not found"
test -r $initrd        || die "$initrd: initramfs not found"
echo "past checks - all files found" >> $logfile
echo "ko: $ko" >> $logfile
echo "initrd: $initrd" >> $logfile

# move to ramdisk and detach
cd /tmp
echo "before exec" >> $logfile
exec >/dev/console 2>&1 </dev/null
echo "after exec" >> $logfile

trap 'echo HUP' HUP

echo "past - move to ramdisk and detach" >> $logfile

# stop ffp 
if [ -d /ffp/start ]; then
    files=$(reverse_list $(rcorder /ffp/start/*.sh))
    for f in $files; do
        if [ -x "$f" ]; then
                echo "$f stop"
echo "$f - stopping" >> $logfile
            $f stop
        fi
    done
fi

# clean up the rest
set -x
echo "about to:  killall5 -TERM" >> $logfile
killall5 -TERM
sleep 2
echo "about to:  killall5 -KILL" >> $logfile
killall5 -KILL
sleep 1

# remount filesystems read-only
sync
echo "sync'ed memory before remounting" >> $logfile
for f in /mnt/HD_*; do
    echo "remounting - $f" >> $logfile
    mount -o remount -r $f
done
echo "remounting all filesystems from /etc/fstab" >> $logfile
mount -o remount -r -a
mount

echo "remounted filesystems read-only" >> $logfile

# start new kernel
sync
echo "sync'ed memory before starting kernel" >> $logfile
sleep 1
echo "starting new kernel" >> $logfile
echo "ko: $ko" >> $logfile
echo "machtype: $machtype" >> $logfile
echo "kernel: $kernel" >> $logfile
echo "initrd: $initrd" >> $logfile
echo "cmdline: '$cmdline'" >> $logfile
insmod $ko machtype=$machtype kernel=$kernel initrd=$initrd cmdline=\"$cmdline\" > $logfile2 2>&1
die "Failed!"

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB