Talk:Llink:synology: Difference between revisions

From Lundman Wiki
No edit summary
No edit summary
Line 52: Line 52:


=== Autostart ===
=== Autostart ===
I'm not sure where to start and what to do in order to get llink autostart on boot. After poking aroung  d I decided to post some rc-files that might make some sense for someone who knows *nix better than me.
I'm not sure where to start and what to do in order to get llink autostart on boot. After poking around I decided to post some rc-files that might make some sense for someone who knows *nix better than me.


Heres the /etc/rc
/ [[User:Dc11ab|dc11ab]] 21:37, 5 January 2008 (JST)
 
Heres the '''/etc/rc'''
<pre>
<pre>
CubeStation> cat rc
CubeStation> cat rc
Line 551: Line 553:
</pre>
</pre>


And the rc.local (which shows the SSODS/Slimserver)
And the '''/etc/rc.local''' (which shows the SSODS/Slimserver)


<pre>
<pre>
Line 558: Line 560:
</pre>
</pre>


And the /volume1/SSODS/etc/intit.d/rc.ssoods looks like this:
And the '''/volume1/SSODS/etc/intit.d/rc.ssoods''' looks like this:


<pre>
<pre>

Revision as of 12:37, 5 January 2008

Installation pre-requisites

When I ran llink on my CS-406 I did have some optware installed already; the bootstrap and toolchain from NSLU2-linux,org and the SSODS3 packages (which include the ELDK). Perhaps it influenced the successful installation? Maybe more things are needed apart from the telnet/SSH-patch currently listed?
/ dc11ab 00:09, 5 January 2008 (JST)

Slimserver/SqueezeCenter hickup's

On a Synology NAS with SSODS Slimserver installation there are unhandled http header requests from cookies seen in the llink log: I have not idea if this something worth looking into or not.

[request] is listening
[request] New request from 192.168.1.2:64543
[request] >> 'GET / HTTP/1.1'
[request] clearnode
keepalive
[request] GET for '/' ('')
[request] >> 'Host: 192.168.1.5:8888'
[request] >> 'User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.8.1.11) Gecko/20071128 Camino/1.5.4'
[request] >> 'Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'
[request] >> 'Accept-Language: en-US,en;q=0.9,sv;q=0.9,ja;q=0.8,fr;q=0.8,de;q=0.7,es;q=0.6,it;q=0.6,nl;q=0.5,nb;q=0.4,da;q=0.4,fi;q=0.3,pt;q=0.3,zh-Hans;q=0.2,zh-Hant;q=0.1,ko;q=0.1'
[request] Unhandled HTTP header 'Accept-Language:' with 'en-US,en;q=0.9,sv;q=0.9,ja;q=0.8,fr;q=0.8,de;q=0.7,es;q=0.6,it;q=0.6,nl;q=0.5,nb;q=0.4,da;q=0.4,fi;q=0.3,pt;q=0.3,zh-Hans;q=0.2,zh-Hant;q=0.1,ko;q=0.1'
[request] >> 'Accept-Encoding: gzip,deflate'
[request] Unhandled HTTP header 'Accept-Encoding:' with 'gzip,deflate'
[request] >> 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7'
[request] Unhandled HTTP header 'Accept-Charset:' with 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
[request] >> 'Keep-Alive: 300'
[request] Unhandled HTTP header 'Keep-Alive:' with '300'
[request] >> 'Connection: keep-alive'
[request] connection type: 1
[request] >> 'Cookie: SqueezeCenter-player=00%3A04%3A20%3A06%3Af8%3Ae5; SqueezeCenter-expandPlayerControl=true; SqueezeCenter-expanded-MY_MUSIC=0; SqueezeCenter-expanded-RADIO=0; SqueezeCenter-expanded-MUSIC_SERVICES=0; SqueezeCenter-expanded-FAVORITES=0; SqueezeCenter-expanded-PLUGINS=0'
[request] Unhandled HTTP header 'Cookie:' with 'SqueezeCenter-player=00%3A04%3A20%3A06%3Af8%3Ae5; SqueezeCenter-expandPlayerControl=true; SqueezeCenter-expanded-MY_MUSIC=0; SqueezeCenter-expanded-RADIO=0; SqueezeCenter-expanded-MUSIC_SERVICES=0; SqueezeCenter-expanded-FAVORITES=0; SqueezeCenter-expanded-PLUGINS=0'
[request] >> ''
[request] actioning request for /
[request] disabling socket input for duration of process
[request] tmpname '/tmp/.llink.G69xU6'
[request] tmpfile closed
[request] reopening tmpfile
[request] actioning request for /
[request] disabling socket input for duration of process
[request] sending file
[request] sending reply code 200:OK

Found the following ports used by the SqueezeCenter7

  • 3483 UDP/TCP (used by Squeezbox player for streaming traffic??))
  • 9000 TCP (Server web interface)
  • 9090 TCP (CLI)

I guess the ports have nothing to do with it., but I'm stuck at this,.
/ dc11ab 00:11, 5 January 2008 (JST)

Autostart

I'm not sure where to start and what to do in order to get llink autostart on boot. After poking around I decided to post some rc-files that might make some sense for someone who knows *nix better than me.

/ dc11ab 21:37, 5 January 2008 (JST)

Heres the /etc/rc

CubeStation> cat rc
#!/bin/sh
# Copyright (c) 2000-2006 Synology Inc. All rights reserved.

HOME=/
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/bin:/usr/syno/sbin:/usr/local/bin:/usr/local/sbin
export HOME PATH

BOOT_SEQ_FILE="/tmp/boot_seq.tmp"
#SEQ_BOOT_NONE=0    no use here
SEQ_START_ETCRC=1
SEQ_CHECK_FS=2
SEQ_START_SERVICE=3
#SEQ_BOOT_DONE=4 is echo by /usr/syno/etc/rc.d/S99Zbootok.sh

###################################################
echo "STEP=$SEQ_START_ETCRC" > ${BOOT_SEQ_FILE}
echo "Starting /etc/rc ..."
###################################################

LinuxVersion=`/bin/uname -r | /usr/bin/cut -c1-3`
SYNOLoadModule()
{
        for MODULE in ${KERNEL_MODULES}
        do
                MODULE_PATH=/lib/modules/${MODULE}
                if [ -f ${MODULE_PATH} ]; then
                        echo "Load ${MODULE}... "
                        insmod ${MODULE_PATH}
                fi
        done
}

SupportRAID=`/bin/get_key_value /etc.defaults/synoinfo.conf supportraid`
ResRAID=$?
if [ $ResRAID -ne 1 ]; then
    SupportRAID="no"
fi

FStab="fstab"

mount -o remount,rw /
echo "Mounting proc filesystem..."
mount -n -t proc /proc /proc
grep /dev/root /proc/mounts > /etc/mtab
rm -rf /var/tmp
ln -s /tmp /var/tmp
mount -t tmpfs /tmp /tmp

[ -f /initrd/tmp/usbinfoall ] && cp -f /initrd/tmp/usbinfoall /tmp/usbinfoall
[ -d /initrd ] && [ ! -f /.nofree ] && /bin/umount /initrd && /sbin/freeramdisk /dev/ram0

dmesg > /var/run/dmesg.boot

# see if need repartitioning
/etc/newdisk.sh

# turn swap on
if [ "$SupportRAID" = "yes" ]; then
    SwapDevice="/dev/md1"
else
    SwapDevice="/dev/hda2"
fi

swapon $SwapDevice
RetSWAPON=$?
if [ "$RetSWAPON" -ne 0 ]; then
        if [ -d /initrd ]; then
                echo "RetSWAPON=$RetSWAPON, doing mkswap..."
               mkswap ${SwapDevice}
                RetMKSWAP=$?
                if [ "$RetMKSWAP" -ne 0 ]; then
                        echo "RetMKSWAP=$RetMKSWAP, doing mkswap..."
                else
                        swapon $SwapDevice
                fi
        fi
fi

# remount root as readonly
mount -ro /

#ConfList="/etc/defaults/rc.conf /etc/rc.conf"
ConfList="/etc/sysconfig/network"
for ThisConfig in $ConfList;
do
        if [ -r "$ThisConfig" ]; then
                . $ThisConfig
        fi
done

if [ -n "${GATEWAY}" -a "${NETWORKING}" = "yes" ]; then
        defaultrouter=$GATEWAY
fi

# Set the host name
#
if [ -z "${HOSTNAME}" ]; then
        HOSTNAME="${hostname:-diskstation}"
fi
hostname ${HOSTNAME}
echo -n "Hostname "
hostname

grep ${HOSTNAME} /etc/hosts
if [ "$?" != "0" ]; then
        echo "0.0.0.0   ${HOSTNAME}" >> /etc/hosts
fi

CWD=`pwd`
cd /etc/sysconfig/network-scripts

network_interfaces=`ls ifcfg* | cut -d'-' -f 2`
echo -n "Network interfaces: "
for thisif in $network_interfaces;
do
        echo -n "$thisif "
        ThisIfConf="/etc/sysconfig/network-scripts/ifcfg-${thisif}"
        BOOTPROTO=`grep -s ^BOOTPROTO ${ThisIfConf} | cut -d'=' -f 2`
        if [ "${BOOTPROTO}" = "static" -o "${thisif}" = "lo" ]; then
                IPADDR=`grep -s ^IPADDR ${ThisIfConf} | cut -d'=' -f 2`
                NETMASK=`grep -s ^NETMASK ${ThisIfConf} | cut -d'=' -f 2`
                thisvalue="inet ${IPADDR} netmask ${NETMASK}"
                eval \ifconfig_${thisif}='$thisvalue'
        else
                eval \ifconfig_${thisif}='dhcp'
        fi
done
echo 
cd $CWD

ThisMachine=`uname -m`
if [ "x${LinuxVersion}" != "x2.6" ]; then
        KERNEL_MODULES="appletalk.o fat.o netlink_dev.o reiserfs.o vfat.o ntfs.o scsi_mod.o sd_mod.o sg.o usbcore.o quota_v2.o slhc.o ppp_generic.o ppp_async.o nfsd.o"
        if [ "${ThisMachine}" = "ppc" ]; then
                KERNEL_MODULES="${KERNEL_MODULES} soundcore.o snd-page-alloc.o snd.o snd-seq-device.o snd-rawmidi.o snd-usb-lib.o snd-hwdep.o snd-timer.o snd-pcm.o snd-usb-audio.o snd-mixer-oss.o snd-pcm-oss.o"
        fi
else
        KERNEL_MODULES="llc.ko psnap.ko appletalk.ko fat.ko vfat.ko ntfs.ko sg.ko usbcore.ko quota_v2.ko soundcore.ko snd-page-alloc.ko snd.ko snd-rawmidi.ko snd-usb-lib.ko snd-hwdep.ko snd-timer.ko snd-pcm.ko snd-usb-audio.ko snd-mixer-oss.ko snd-pcm-oss.ko slhc.ko ppp_generic.ko crc-ccitt.ko ppp_async.ko exportfs.ko nfsd.ko"
fi

SYNOLoadModule

if [ "x${LinuxVersion}" != "x2.6" ]; then
        echo "Mounting usbdevfs..."
        mount -t usbdevfs /proc/bus/usb /proc/bus/usb
else
        echo "Mounting sysfs..."
        mount -t sysfs /sys /sys
        echo "Mounting usbfs..."
        mount -t usbfs /proc/bus/usb /proc/bus/usb
fi

case "${ThisMachine}" in
armv5b)
        #ModuleList="csr ixp425_eth eepro100"
        ModuleList="ixp400 ixp425_eth"
        for ThisModule in $ModuleList;
        do
                insmod /lib/modules/${ThisModule}.o
        done
        ;;
ppc)
        if [ "x${LinuxVersion}" != "x2.6" ]; then
                insmod /lib/modules/sk98lin.o
        else
                if [ -f /lib/modules/sk98lin.ko ]; then
                        insmod /lib/modules/sk98lin.ko
                elif [ -f /lib/modules/skge.ko ]; then
                        insmod /lib/modules/skge.ko
                fi
        fi
        ;;
esac

case "${ThisMachine}" in
*86)
        echo "Skip loading synobios"
        ;;
*)
        RunSynoBios=`/bin/get_key_value /etc/synoinfo.conf synobios`
        if [ "no" != "$RunSynoBios" ]; then
                echo "Load synobios...."
                if [ "x${LinuxVersion}" != "x2.6" ]; then
                        insmod /lib/modules/synobios.o
                else
                        insmod /lib/modules/synobios.ko
                fi
                cd /dev
                /bin/mknod synobios c 201 0
                cd $CWD
        fi
        ;;
esac

for PidDir in /var/run /etc/dhcpc;
do
        rm -rf ${PidDir}/*.pid
done

## remove samba's tdb of usbprinter.tdb in each reboot to clean out of control job ##
## see DS20 #1340
if [ -e "/var/run/printing/usbprinter.tdb" ]; then
        rm -rf /var/run/printing/usbprinter.tdb
fi

#if [ -r /etc/rc.network ]; then
if [ -r /etc/rc.network -a "${NETWORKING}" = "yes" ]; then
        . /etc/rc.network
        start_network
fi

case "${ThisMachine}" in
armv5b)
        # Third party software support
        if [ -d "/writeable/usr/local" ]; then
                ln -sf /writeable/usr/local /usr/local
        fi

        for ThisDir in /usr/local/armv5b-linux;
        do
                if [ -e "$ThisDir/lib" ]; then
                        rm -rf $ThisDir/lib 
                fi
                mkdir -p $ThisDir
                ln -sf /lib $ThisDir/lib
        done
        ARMTZDir="/usr/local/armv5b-linux/etc"
        ARMTZ="${ARMTZDir}/localtime"
        if [ ! -d "$ARMTZDir" ]; then
                rm -rf $ARMTZDir
                mkdir -p $ARMTZDir
        fi
        rm -rf $ARMTZ
        ln -sf /etc/localtime $ARMTZ
        ;;
*)        
        # Third party software support
        if [ -d "/writeable/usr/local" ]; then
                ln -sf /writeable/usr/local /usr/local
        fi
        ;;
esac

if [ -r "/etc.defaults/sysctl.conf" ]; then
        /sbin/sysctl -p /etc.defaults/sysctl.conf
fi

syslogd_enable="YES"
syslogd_flags="-S"
case ${syslogd_enable} in
[Yy][Ee][Ss])
        # Transitional symlink (for the next couple of years :) until all
        # binaries have had a chance to move towards /var/run/log.
        if [ ! -L /dev/log ]; then
                # might complain for r/o root f/s
                ln -sf /var/run/log /dev/log
        fi

        rm -f /var/run/log
        echo "Starting syslogd..."
        ${syslogd_program:-/sbin/syslogd} ${syslogd_flags}
        /sbin/klogd
        ;;
esac

for CFGEN in /usr/syno/cfgen/*;
do
        if [ -x "$CFGEN" ]; then
                $CFGEN
        fi
done

###################################################
echo "STEP=$SEQ_CHECK_FS" > ${BOOT_SEQ_FILE}
echo "Checking and Mounting filesystem(s) ..."
###################################################

# initial findhostd first to report quota check progress, see DS20 bug #
/usr/syno/etc/rc.d/S98findhostd.sh start

UsrVolumeList=`grep /volume /etc/${FStab} |awk '{printf("%s:%s \n", $1, $2)}'`

rm -f /tmp/hdhealth
for ThisList in $UsrVolumeList;
do
        ThisDevice=`echo $ThisList | cut -d':' -f 1 `
        ThisVolume=`echo $ThisList | cut -d':' -f 2 `
        DevName=`echo $ThisDevice | cut -c6-`
        mkdir -p $ThisVolume

        FS=`/usr/syno/bin/synogetfstype ${ThisDevice}` 
        ResGetFS=$?
        if [ $ResGetFS -eq 1 ]; then
                echo "synogetfstype read file system magic failed on $ThisDevice:$ThisVolume. errno=$ResGetFS"
                echo "Trying ext3"
                FS=ext3
        fi

        FSCK="/sbin/fsck.${FS} -pq"


        DoMount=1

        IsClean=`${FSCK} $ThisDevice | grep "is cleanly umounted"`
        if [ -n "$IsClean"  ]; then
                echo "$ThisDevice. Clean. "
                IsClean=1
        else
                IsClean=0
        fi

        echo "Mounting $ThisDevice on $ThisVolume."
        mount -n -t ${FS} $ThisDevice $ThisVolume
        ResMount=$?
        if [ $ResMount -ge 1 ]; then
                echo "Mount failed on $ThisDevice:$ThisVolume. errno=$ResMount"

                if [ "${FS}" = "ext3" ]; then
                        for SB in 1 131072 393216 655360 917504 1179648 3276800 3538944
                        do
                                echo "Mounting $ThisDevice on $ThisVolume.(read only, sb=${SB})"
                                grep -v "${DevName}mount" /tmp/hdhealth > /tmp/hdhealth.tmp
                                mount -t ${FS} -o ro,sb=${SB} $ThisDevice $ThisVolume
                                ResMount=$?
                                if [ $ResMount -ge 1 ]; then
                                        echo "Mount read only failed on $ThisDevice:$ThisVolume. errno=$ResMount"
                                        echo "${DevName}mount=\"fail\"" >> /tmp/hdhealth.tmp
                                        mv -f /tmp/hdhealth.tmp /tmp/hdhealth
                                else
                                        echo "${DevName}mount=\"ro\"" >> /tmp/hdhealth.tmp
                                        mv -f /tmp/hdhealth.tmp /tmp/hdhealth
                                        MOUNT_OPT=",ro"
                                        break
                                fi
                        done
                else
                        echo "Mounting $ThisDevice on $ThisVolume.(read only)"
                        mount -t ${FS} -o ro $ThisDevice $ThisVolume
                        ResMount=$?
                        if [ $ResMount -ge 1 ]; then
                                echo "Mount read only failed on $ThisDevice:$ThisVolume. errno=$ResMount"
                                echo "${DevName}mount=\"fail\"" >> /tmp/hdhealth
                        else
                                echo "${DevName}mount=\"ro\"" >> /tmp/hdhealth
                        fi
                fi
        else
                rm -rf $ThisVolume/@tmp
                mkdir $ThisVolume/@tmp
                chmod 777 $ThisVolume/@tmp
        fi
        mount -o remount,usrquota,grpquota${MOUNT_OPT} $ThisVolume
        ResMount=$?
        if [ $ResMount -ge 1 ]; then
                echo "ReMount failed on $ThisDevice:$ThisVolume. errno=$ResMount"
        fi

        if [ -f "$ThisVolume/aquota.user" -a -f "$ThisVolume/aquota.group" ]; then
                DoQuotaCheck=0
        else
                DoQuotaCheck=1
        fi

        if [ $IsClean -eq 0 ]; then
                DoQuotaCheck=1
        fi

        if [ -f ${ThisVolume}/.needquotacheck ]; then
                /usr/syno/bin/synologset1 sys warn 0x11100001
                DoQuotaCheck=1
        fi

        if [ $DoQuotaCheck -eq 1 ]; then
                echo "Quotacheck on $ThisVolume."
                /sbin/quotacheck -g -u -F vfsv0 $ThisVolume

                mount -o remount,usrquota,grpquota${MOUNT_OPT} $ThisVolume
                rm -f ${ThisVolume}/.needquotacheck
        fi

        echo "Quotaon on $ThisVolume."
        /sbin/quotaon -F vfsv0 $ThisVolume 
done

#set time zone information to kernel
/usr/syno/bin/synokerneltz

/sbin/sysctl -w kernel.core_pattern=/volume1/@%e.core

if [ "x${LinuxVersion}" != "x2.6" ]; then
        /sbin/sysctl -w kernel.suid_dumpable=2
else
        /sbin/sysctl -w fs.suid_dumpable=2
fi
ulimit -c unlimited

if [ "x${LinuxVersion}" == "x2.6" ]; then
    /sbin/sysctl -w vm.min_free_kbytes=4096
fi

Configured=`/bin/get_key_value /etc/synoinfo.conf configured`
if [ "$Configured" = "no" -a "$SupportRAID" = "no"  ];then
    CheckList="/volume1 /volume1/public"
    for EachItem in $CheckList;
    do
        if [ ! -d "$EachItem" ]; then
                /bin/mkdir -p $EachItem
        fi
        /bin/chmod 777 $EachItem
    done
fi

/usr/syno/bin/synologset1 sys info 0x11100002

###################################################
echo "STEP=$SEQ_START_SERVICE" > ${BOOT_SEQ_FILE}
echo "Starting scemd ..."
###################################################

/usr/syno/bin/scemd
Ret=$?
if [ $Ret -ne 0 ]; then
        echo "Failed to start scemd, reboot and get into steel plan or network install mode."
        touch "/.noroot"
        reboot
fi

 
if [ -r /etc/rc.network -a "${NETWORKING}" = "yes" ]; then
        # Start PPPoE if enabled
        start_pppoe
fi

if [ ! -d /initrd ]; then
#       echo "Starting inetd in flash_rd..."
#       /usr/sbin/inetd
        echo "Starting findhostd in flash_rd..."
        /usr/syno/bin/findhostd
fi

# For bug 1248, probe USB device after scemd
# usb-uhci.o is for VIA, usb-ohci.o is for NEC
# KERNEL_MODULES="ehci-hcd.o usb-uhci.o usb-storage.o printer.o"
if [ "x${LinuxVersion}" != "x2.6" ]; then
KERNEL_MODULES="ehci-hcd.o usb-ohci.o usb-uhci.o usb-storage.o printer.o hid.o"
else
KERNEL_MODULES="ehci-hcd.ko ohci-hcd.ko uhci-hcd.ko usb-storage.ko usblp.ko usbhid.ko"
fi
SYNOLoadModule

if [ -r /etc/rc.local ]; then
        echo -n 'Starting local daemons:'
        sh /etc/rc.local
        echo '.'
fi

echo -n 'Local package initialization:'
if [ -z "${local_startup}" ]; then
        local_startup="/etc/rc.d /usr/syno/etc/rc.d /usr/local/etc/rc.d"
fi

startupd=`get_key_value /etc.defaults/synoinfo.conf supportstartupd`
if [ "$startupd" = "yes" ]; then
        echo 'startup daemons'
        if [ -d /volume1/startup ]; then
                for startsh in /volume1/startup/S* ; do
                        if [ -f $startsh ]; then
                                echo "start $startsh"
                                $startsh
                        fi
                done
        fi
fi

echo '.'

echo ''

echo "done."

date

if [ ! -d /initrd ]; then
        if [ -f /.nodisk ]; then
                /usr/sbin/burning_test > /dev/null 2>&1 &
        fi
fi

ManuTild=/usr/syno/sbin/manutild
$ManuTild

exit 0

And the /etc/rc.local (which shows the SSODS/Slimserver)

CubeStation> cat rc.local
/volume1/SSODS/etc/init.d/rc.ssods # SSODS3 (keep the tag)

And the /volume1/SSODS/etc/intit.d/rc.ssoods looks like this:

CubeStation> cat /volume1/SSODS/etc/init.d/rc.ssods
#!/volume1/SSODS/bin/bash
#
# $Id: rc.ssods,v 1.4 2007/10/03 22:27:17 flip Exp flip $
#
# this script runs the scripts ${SSODSDIR}/etc/init.d/{S,K}??*
# in (alpha)numerical order
#
# Copyright (c) 2006, 2007 Philippe Kehl <flipflip at gmx dot net>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by the
# Free Software Foundation.
#
# See the documentation for details and copying conditions.
#

# get site config
source /volume1/SSODS/etc/ssods/ssods.conf || exit 1
PATH=${SSODSDIR}/sbin:${PATH}
export PATH

RCSSODS=yes

# start or stop?
case "$1" in

    stop)
        cmd=stop
        key=K
        ;;
    start|*)
        cmd=start
        key=S
        ;;
esac

for S in ${SSODSDIR}/etc/init.d/${key}*; do

    # ignore broken symlinks
    [ ! -f ${S} ] && continue

    echo "*** ${S} ${cmd} ***"
    # source (!) script
    source $S ${cmd}

done

# eof