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 2011-01-31 04:12:59

krackpot
Member
Registered: 2009-01-24
Posts: 44

Alt-F 0.1B6, Debian Squeeze, DNS-323

After working on getting squeeze on my DNS-323 all day today.

I finally made progress. Steps I've taken:
-Updated stock fw from 1.04 to 1.09
-Got new HDs and aligned to 4k
-Got Alt-F 0.1B6 running using the "reloaded" method
-Made a 1GB USB ext3
-Setup an Ubuntu 10.10 VM and debootstrapped (cdebootstrap didnt't work) a squeeze.tar transferred it to the USB
-# chroot /mnt/usb/squeeze /bin/bash
-# /debootstrap /debootstrap --second-stage
That installed the Base system of debian squeeze.
-Made a squeeze.sh that holds:

Code:

export CHROOT=/mnt/usb/squeeze
#
mount -o bind /dev $CHROOT/dev
mount -o bind /proc $CHROOT/proc
mount -o bind /sys $CHROOT/sys
mount -o bind /tmp $CHROOT/tmp
#
mount -t devpts none $CHROOT/dev/pts
#
cp /etc/resolv.conf $CHROOT/etc/resolv.conf
cp /etc/hosts $CHROOT/etc/hosts
#
export PS1="[\u@\h: \w] "
#
chroot $CHROOT $*

-# chmod +x squeeze.sh
So now whenever I want to get into the chroot, I just "sh squeeze.sh" and I'm in.


Question now is. What now? How do I get the squeeze install to auto load when Alt-F auto loads? Is there a way to have squeeze load all by itself and not need Alt-F to install? (I'm guessing squeeze is using the armel kernel from Alt-F to load?)

I'm kind of lost. I'm actually surprised I made it this far.


DNS-323 (B1) on Alt-F 0.1B7
2x2TB WD20EARS

Offline

 

#2 2011-01-31 14:59:58

oxygen
Member
Registered: 2008-03-01
Posts: 320
Website

Re: Alt-F 0.1B6, Debian Squeeze, DNS-323

Just install debian natively instead?

Offline

 

#3 2011-02-02 17:21:25

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Alt-F 0.1B6, Debian Squeeze, DNS-323

I have multiple dns-323s I've been experimenting with, so I install the chroot this way:

Get alt-f 1.06 running via the reloaded method

Add my experimental alt-f package feed http://ipkg.dhub.me/unstable

Update alt-f packages

Install the the debian-squeeze package

Offline

 

#4 2011-02-02 18:03:40

dhub
Member
Registered: 2011-01-01
Posts: 112

Re: Alt-F 0.1B6, Debian Squeeze, DNS-323

Oh a couple of things I missed in the last post:

If you want a full working debian environment currently including kernel support you will have to flash debian with the risk it entails. 

So far I don't think anyone has been able to get the debian kernel and initrd to load from the reloaded function due to size constraints.  I've been playing with it off and on but it's difficult to troubleshoot why things aren't working without a serial console.  I kind of suspect if people have a working serial console they probably just flash debian so don't have a whole lot of incentive to work on getting it to work via the reloaded method...  Classic catch 22

Oh, my package creates a script called "deb" for entering the chroot and for creating aliases to chroot commands for the alt-f environment so that package commands can be run from outside the chroot environment.  I.E. apt-get and aptitude work when run from the alt-f shell without entering the chroot.

To autoload things on boot in alt-f you'll need to build a start script in /etc/init.d.   In my debian chroot package I currently just set up the bind mounts and things needed for the chroot environment (and try to remove them if stop is called).  Oh, you will need to follow the directions on the alt-f wiki for modifying the /etc/init.d directory otherwise changes/addition will disappear on reboot.

It would be possible to just run the normal debian start scripts on boot but I personally don't do that due to the limited memory and cpu on the dns-323s.  I prefer to create wrapper scripts that run the start/stop scripts in the debian chroot since the services can then be started/stopped from the alt-f web interface.

This is the debian chroot start script my package installs:
#! /bin/sh

DESC="Initialize the debian chroot environment"
TYPE=sys
NAME=debian

. $(dirname $0)/common

# First find the debian chroot environment
CHROOT="unknown"
export CHROOT
for i in /chroot/debian /mnt/sda2/debian /mnt/sda4/debian /mnt/md0/debian /mnt/sdb2/debian /mnt/sdb4/debian
do
        if [ -e "$i" ]; then
                CHROOT="$i"
                export CHROOT
                break
        fi
done
if [ "$CHROOT" == "unknown" ]; then
        echo "Unable to find debian chroot directory"
        exit 1
fi

start_debian() {
        # Set up bind mounts
        mount | grep aufs | grep debian > /dev/null
        RC="$?"
        if [ "$RC" == "1" ]; then
                mount -o bind  /dev  $CHROOT/dev
                mount -o bind  /proc $CHROOT/proc
                mount -o bind  /sys  $CHROOT/sys
                mount -o bind  /tmp  $CHROOT/tmp
                mount -o bind  /usr/www $CHROOT/usr/www
                mount -t devpts none $CHROOT/dev/pts
                df |grep /mnt|egrep -v ^Filesystem\|^tmpfs\|^aufs\|/dev/loop\|debian|awk '{print $1,$6}'|while read tomount
                do
                        dev=`echo $tomount|awk '{print $1}'`
                        mountpoint=`echo $tomount|awk '{print $2}'`
                        mkdir -p "$CHROOT$mountpoint"
                        mount -o bind $mountpoint $CHROOT$mountpoint
                done
                sort /proc/mounts|uniq|egrep -v debian/sys\|^rootfs\|^/dev/loop0\|/mnt/sd[a-z][1-4]/\|/rootmnt > $CHROOT/etc/mtab
        fi

        # Set up networking config inside the chroot
        cp /etc/resolv.conf $CHROOT/etc/resolv.conf
        cp /etc/hosts $CHROOT/etc/hosts

        return 0
}

stop_debian() {
        # Undo our bind mounts
        umount $CHROOT/usr/www
        umount $CHROOT/dev/pts
        umount $CHROOT/dev               
        umount $CHROOT/proc               
        umount $CHROOT/sys
        umount $CHROOT/tmp
        df |grep /mnt|egrep -v ^Filesystem\|^tmpfs\|^aufs\|/dev/loop\|debian|awk '{print $1,$6}'|while read tomount
        do
                dev=`echo $tomount|awk '{print $1}'`
                mountpoint=`echo $tomount|awk '{print $2}'`
                umount $CHROOT$mountpoint
        done
        return 0
}

status_debian() {
        # First find the debian chroot environment
        CHROOT="unknown"
        export CHROOT
        for i in /chroot/debian /mnt/sda2/debian /mnt/sda4/debian /mnt/md0/debian /mnt/sdb2/debian /mnt/sdb4/debian
        do
                if [ -e "$i" ]; then
                        CHROOT="$i"
                        export CHROOT
                        break
                fi
        done

        if [ "$CHROOT" == "unknown" ]; then
                return 1
        fi

        # Set up bind mounts
        mount | grep aufs | grep debian > /dev/null
        RC="$?"
        return $RC
}

case "$1" in
        start)
                echo -n "Starting $NAME: "
                start_debian
                rc="$?"
                if [ "$rc" == "0" ]; then
                        echo "OK."
                else
                        echo "Debian startup failed."
                        exit 1
                fi
                ;;
        stop)
                echo -n "Stopping $NAME: "
                stop_debian
                rc="$?"
                if [ "$rc" == "0" ]; then
                        echo "OK."
                else
                        echo "Debian stop failed."
                        exit 1
                fi
                ;;
        status)
                echo -n "$NAME "
                status_debian
                rc="$?"
                if [ "$rc" == "0" ]; then
                        echo "running"
                else
                        echo "stopped"   
                        exit 1
                fi
                ;;                                                                                                                                                                                       
        restart) restart $NAME ;;
        *) usage $0 "start|stop|status|restart" ;;

Here is the deb script, it only switches to the debian environment:
#!/bin/sh
/sbin/rcdebian start > /dev/null
CHROOT="`getchrootdir`"
if [ "`basename $0`" == "deb" ]; then
        chroot "$CHROOT" /bin/bash
else
        chroot "$CHROOT" $0 $@
fi

Offline

 

#5 2011-04-17 09:16:16

krackpot
Member
Registered: 2009-01-24
Posts: 44

Re: Alt-F 0.1B6, Debian Squeeze, DNS-323

Thanks for the post. I only had time recently to try it out!

How do you start the script your package installs?


DNS-323 (B1) on Alt-F 0.1B7
2x2TB WD20EARS

Offline

 

#6 2011-04-17 21:45:59

krackpot
Member
Registered: 2009-01-24
Posts: 44

Re: Alt-F 0.1B6, Debian Squeeze, DNS-323

I found it in another person's post.

To start the chroot, just type "deb" without the quotes when in the command line.


DNS-323 (B1) on Alt-F 0.1B7
2x2TB WD20EARS

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB