What's new

[HOW-TO] install Debian Squeeze

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

ryzhov_al

Very Senior Member
Here is How to install full blown Debian Stable distro via chroot to router without any firmware modifications. You may run any chosen Debian services without running whole Debian, this is a minimal possible overhead of such "virtualization". You may take a look at my script to see details… or may not, because I've already done it all for you in one archive. All you need is to unpack my archive to some folder on USB drive, it takes ~170MB:

Code:
cd <folder>
wget http://files.ryzhov-al.ru/Routers/chroot-debian/debian-stable-prepared.tgz
tar -xvzf ./debian-stable-prepared.tgz
rm ./debian-stable-prepared.tgz

Before dive into Debian please do:
Code:
mount -o bind /dev/ <folder>/debian/dev/
mount -o bind /proc/ <folder>/debian/proc/
mount -o bind /sys/ <folder>/debian/sys/

How to enter to Debian distro?
Please, type:
Code:
chroot <folder>/debian /bin/bash

How to leave Debian?
Just type:
Code:
exit

So, how to use it?
It's depends of your needs. This is a full Debian distro with it's ~30000 packages. For example, you may install transmission. Enter Debian and type:
Code:
apt-get install transmission-daemon
Yes, transmission is installed and running. And this is only running process from Debian chroot'ed environment, as you see, no other unnecessary Debian services is running.

Feel free to experiment with Debian as you wish. As long as it's "chroot'ed", no harm you may do to firmware or USB files outside of this "sandbox". If you'll break this toy-Debian, you can always unpack fresh copy from my archive and start play again.

PS I've wrote a S99debian script to start\stop chroot'ed services with router boot. It's unslung-style, so place it to /opt/etc/init.d and Entware/Optware will use it as the other services. Don't forget to edit path to you Debian inside of script.
 
Last edited:
It's working fine, thank you, but how should be the script to start automatically on every router reboot?
I tried with services-start script:
Code:
#!/bin/sh
sleep 5
mount -o bind /dev /mnt/sda1/debian/dev
mount -o bind /proc /mnt/sda1/debian/proc
mount -o bind /sys /mnt/sda1/debian/sys
Debian is initializing but services in init.d directory like transmission-daemon not
 
It's working fine, thank you, but how should be the script to start automatically on every router reboot?
I tried with services-start script:
Code:
#!/bin/sh
sleep 5
mount -o bind /dev /mnt/sda1/debian/dev
mount -o bind /proc /mnt/sda1/debian/proc
mount -o bind /sys /mnt/sda1/debian/sys
Debian is initializing but services in init.d directory like transmission-daemon not
Yes, you're half a step from success:
Code:
#!/bin/sh

mount -o bind /dev /mnt/sda1/debian/dev
mount -o bind /proc /mnt/sda1/debian/proc
mount -o bind /sys /mnt/sda1/debian/sys
chroot /mnt/sda1/debian /etc/init.d/transmission-daemon start
chroot /mnt/sda1/debian /etc/init.d/<something else> start

The shutdown code is in reverse order:
Code:
#!/bin/sh

chroot /mnt/sda1/debian /etc/init.d/transmission-daemon stop
chroot /mnt/sda1/debian /etc/init.d/<something else> stop
mount -o bind /dev /mnt/sda1/debian/dev
mount -o bind /proc /mnt/sda1/debian/proc
mount -o bind /sys /mnt/sda1/debian/sys

I use similar script for chroot'ed services on my WD My Book Live NAS.

Look's a have to write start\stop script for chroot'ed services in rc.unslung style.
…Done! Script is in the first post.
 
Last edited:
Yes, a script in rc.unslung style will be much better, I modified your entware script and it's works but we have to add "S" and a number in front of start scripts, like transmission-daemon --> S95transmission-daemon
#!/bin/sh

# Start/stop all init scripts in /etc/init.d including symlinks
# starting them in numerical order and
# stopping them in reverse numerical order

#logger "Started $0${*:+ $*}."

ACTION=$1
CALLER=$2

if [ $# -lt 1 ]; then
printf "Usage: $0 {start|stop|restart|reconfigure|check|kill}\n" >&2
exit 1
fi

[ $ACTION = stop -o $ACTION = restart -o $ACTION = kill ] && ORDER="-r"

for i in $(/usr/bin/find /etc/init.d/ -perm '-u+x' -name 'S*' | sort $ORDER ) ;
do
case "$i" in
S* | *.sh )
# Source shell script for speed.
trap "" INT QUIT TSTP EXIT
#set $1
#echo "trying $i" >> /tmp/rc.log
. $i $ACTION $CALLER
;;
*)
# No sh extension, so fork subprocess.
$i $ACTION $CALLER
;;
esac
done
 
Do you know why wget is not working in debian? I get a continuous loop, tried with multiple files from multiple sites
root@RT-AC66U:/# cd /var/tmp
root@RT-AC66U:/var/tmp# wget http://wl500g-common.googlecode.com/files/debian-stable-prepared.tgz
--2013-03-27 14:25:43-- http://wl500g-common.googlecode.com/files/debian-stable-prepared.tgz
Resolving wl500g-common.googlecode.com (wl500g-common.googlecode.com)... 2a00:1450:400c:c05::52, 173.194.67.82
Connecting to wl500g-common.googlecode.com (wl500g-common.googlecode.com)|2a00:1450:400c:c05::52|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 61702087 (59M) [application/x-gzip]
Saving to: 'debian-stable-prepared.tgz'

0% [ ] 0 --.-K/s in 0s

2013-03-27 14:25:43 (0.00 B/s) - Read error at byte 0/61702087 (Invalid argument). Retrying.

--2013-03-27 14:25:44-- (try: 2) http://wl500g-common.googlecode.com/files/debian-stable-prepared.tgz
Connecting to wl500g-common.googlecode.com (wl500g-common.googlecode.com)|2a00:1450:400c:c05::52|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 61702087 (59M) [application/x-gzip]
Saving to: 'debian-stable-prepared.tgz'

0% [ ] 0 --.-K/s in 0s

2013-03-27 14:25:44 (0.00 B/s) - Read error at byte 0/61702087 (Invalid argument). Retrying.

--2013-03-27 14:25:46-- (try: 3) http://wl500g-common.googlecode.com/files/debian-stable-prepared.tgz
Connecting to wl500g-common.googlecode.com (wl500g-common.googlecode.com)|2a00:1450:400c:c05::52|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 61702087 (59M) [application/x-gzip]
Saving to: 'debian-stable-prepared.tgz'

0% [ ] 0 --.-K/s in 0s

2013-03-27 14:25:46 (0.00 B/s) - Read error at byte 0/61702087 (Invalid argument). Retrying.
 
Do you know why wget is not working in debian?
Full wget is too "smart" I think, you may replace it with busybox applet:
Code:
apt-get remove wget
apt-get install busybox
ln -s /bin/busybox /usr/bin/wget
 
Last edited:
I get the same loop, works for you?
Yes. From scratch:
Code:
tar -xvzf ./debian-stable-prepared.tgz
chroot ./debian /bin/bash
apt-get install busybox
ln -s /bin/busybox /usr/bin/wget
wget http://ya.ru
Connecting to ya.ru (77.88.21.3:80)
index.html           100% |*******************************|  5279  --:--:-- ETA
 
I get the same loop, works for you?

Your wget seems to be connecting over IPv6. Could be the reason of your problems.
 
Your wget seems to be connecting over IPv6. Could be the reason of your problems.
I disabled ipv6 and is the same, now I will start from scratch...

OK, after a fresh install works fine even with ipv6 enabled.
 
Last edited:
Not only Debian services may be started in chroot sandbox, but any other Linux distro with MIPSEL target. Ubuntu, OpenWRT and dozen of other.

OK, after a fresh install works fine even with ipv6 enabled.
Please, keep in mind this chroot'ed Debian has no /etc/services, /etc/protocols and some other system files, has no it's own environment variables, so I think this is not last issue with that.

Your wget seems to be connecting over IPv6. Could be the reason of your problems.
Glad you remind me about similar problem. This is our old issue: some broadband provider's DNS servers resolves names to IPv6 first, and users complains about non working wget unless IPv6 isn't configured. We implemented simple config where IPv4 or IPv6 proirity may be set.
 
Hello @ryzhov_al, I'm trying to install gcc on my RT-AC66U with Debian but I get some errors, because kernel is to old libc6 needs at least 2.6.26
root@RT-AC66U:/var/tmp# apt-get install gcc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
binutils cpp cpp-4.4 gcc-4.4 libc-dev-bin libc6-dev libgmp3c2 libgomp1
libmpfr4 linux-libc-dev manpages manpages-dev
Suggested packages:
binutils-doc cpp-doc gcc-4.4-locales gcc-multilib make autoconf automake1.9
libtool flex bison gdb gcc-doc gcc-4.4-multilib libmudflap0-4.4-dev
gcc-4.4-doc libgcc1-dbg libgomp1-dbg libmudflap0-dbg libcloog-ppl0 libppl-c2
libppl7 glibc-doc man-browser
The following NEW packages will be installed:
binutils cpp cpp-4.4 gcc gcc-4.4 libc-dev-bin libc6-dev libgmp3c2 libgomp1
libmpfr4 linux-libc-dev manpages manpages-dev
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 823 kB/14.3 MB of archives.
After this operation, 45.2 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 ftp://ftp.us.debian.org/debian/ stable/main linux-libc-dev mipsel 2.6.32-48 [823 kB]
Err ftp://ftp.us.debian.org/debian/ stable/main linux-libc-dev mipsel 2.6.32-48
Unable to fetch file, server said 'Failed to open file. ' [IP: 2610:148:1f10:3::89 21]
Failed to fetch ftp://ftp.us.debian.org/debian/pool/main/l/linux-2.6/linux-libc-dev_2.6.32-48_mipsel.deb Unable to fetch file, server said 'Failed to open file. ' [IP: 2610:148:1f10:3::89 21]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
root@RT-AC66U:/var/tmp# apt-get update
Get:1 ftp://ftp.us.debian.org stable Release.gpg [1672 B]
Get:2 ftp://ftp.us.debian.org/debian/ stable/main Translation-en
Ign ftp://ftp.us.debian.org/debian/ stable/main Translation-en
Get:3 ftp://ftp.us.debian.org stable Release [168 kB]
Get:4 ftp://ftp.us.debian.org stable/main mipsel Packages [7445 kB]
Fetched 7615 kB in 34s (225 kB/s)
Reading package lists... Done
root@RT-AC66U:/var/tmp# apt-get install libc6
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
glibc-doc locales
The following packages will be upgraded:
libc6
1 upgraded, 0 newly installed, 0 to remove and 74 not upgraded.
Need to get 0 B/4130 kB of archives.
After this operation, 829 kB disk space will be freed.
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 6645 files and directories currently installed.)
Preparing to replace libc6 2.11.3-4 (using .../libc6_2.13-38_mipsel.deb) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 75.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Checking for services that may need to be restarted...
Checking init scripts...
WARNING: this version of the GNU libc requires kernel version
2.6.26 or later. Please upgrade your kernel before installing
glibc.

The installation of a 2.6 kernel _could_ ask you to install a new libc
first, this is NOT a bug, and should *NOT* be reported. In that case,
please add lenny sources to your /etc/apt/sources.list and run:
apt-get install -t lenny linux-image-2.6
Then reboot into this new kernel, and proceed with your upgrade
dpkg: error processing /var/cache/apt/archives/libc6_2.13-38_mipsel.deb (--unpack):
subprocess new pre-installation script returned error exit status 1
configured to not write apport reports
Errors were encountered while processing:
/var/cache/apt/archives/libc6_2.13-38_mipsel.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@RT-AC66U:/var/tmp#
 
It wasn't ipv6 but some files are missing from address like linux-libc-dev_2.6.32-48_mipsel.deb ftp://ftp.us.debian.org/debian/pool/main/l/linux-2.6/linux-libc-dev_2.6.32-48_mipsel.deb
I solved by searching packages with google and installed manualy
If I run apt-get update the files are there but will require kernel v2.6.26 and the router have 2.6.22

Another issue with wget, if I try with ubuntu it's ok
thx@ubuntu:~/Downloads$ wget -c -O minidlna.conf https://googledrive.com/host/0BwGVHEf-dgBKUWlEeFIxN3pSVFE
--2014-01-06 14:17:58-- https://googledrive.com/host/0BwGVHEf-dgBKUWlEeFIxN3pSVFE
Resolving googledrive.com (googledrive.com)... 173.194.39.170, 173.194.39.172, 173.194.39.171, ...
Connecting to googledrive.com (googledrive.com)|173.194.39.170|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3385 (3.3K) [text/plain]
Saving to: `minidlna.conf'

100%[======================================>] 3,385 --.-K/s in 0.001s

2014-01-06 14:17:59 (5.16 MB/s) - `minidlna.conf' saved [3385/3385]

thx@ubuntu:~/Downloads$
but from entware or debian-entware I get error:
root@RT-AC66U:/var/tmp# wget -c -O minidlna.conf https://googledrive.com/host/0BwGVHEf-dgBKUWlEeFIxN3pSVFE wget: not an http or ftp url: https://googledrive.com/host/0BwGVHEf-dgBKUWlEeFIxN3pSVFE
root@RT-AC66U:/var/tmp#
 
@ryzhov_al it is possible to setup debian on RT-AC56U or RT-AC68U without entware?
Thanks

I like to know this too.
There is a arm based chroot debian but without entware its not much use I think.
Although from the commands I see in the tutorial it would only take a couple of binaries to be compiled for the ac68u and the ac56u. Or are all those already in the merlin build?

Sent from my GT-I9505 using Tapatalk
 
Last edited:
Isn't better to run this under dd-wrt with kernel 3 as these packages are build for that kernel? Instead of the NSA friendly kernel Asus uses. ;)

I'll give it a test this weekend.

Definitely a good alternative to entware.

Sent from my GT-I9505 using Tapatalk
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top