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 2009-05-07 02:15:58

kennega
Member
Registered: 2009-05-07
Posts: 10

Debian squeeze chroot on DNS-321 HOWTO

I couldn't quite get edge to work properly, but I got squeeze working just fine. Using the 323 instructions for configuring a chroot were a good roadmap. If anyone's interested in getting Debian squeeze going on the DNS-321, here's how to do it:

Install FFP.
Using a Debian Linux install (I used a Ubuntu 9.04 VM), perform the following:

Code:

# apt-get install cdebootstrap smbfs
# mount -t cifs //nas01/Volume_1 /mnt -o username=admin

In the above, nas01 is the hostname (or IP) of your DNS-321.

Code:

# cdebootstrap -aarmel squeeze squeeze ftp://ftp.debian.org/debian
# tar cf squeeze.tar squeeze
# cp squeeze.tar /mnt

Reboot the DNS-321, and then open a telnet session into it.

Code:

# cd /mnt/HD_a2
# tar xf squeeze.tar
# chroot /mnt/HD_a2/squeeze /bin/bash

At this point, you're now chrooted into the squeeze distribution you just loaded. Any commands from this point forward will be inside the chroot. To set things up proper, continue on.

Code:

# cd /var/cache/bootstrap
# dpkg --force-all -i libc6*deb
# dpkg --force-all -i dpkg*deb
# dpkg -iGREB .

The dpkg commands are going to bomb out on certain packages. Keep running the -i GREB. command a couple of times, and any packages that seem stuck, run the --force-all -i flags on the individual packages. Your final dpkg -i GREB. command should indicate no errors.

Below, fill in a valid nameserver for your network:

Code:

# echo "nameserver 192.168.210.1" > /etc/resolv.conf
# echo "deb http://ftp1.ca.debian.org/debian squeeze main contrib non-free" > /etc/apt/sources.list
# apt-get update
# apt-get install debian-archive-keyring
# apt-get update
# apt-get dist-upgrade
# passwd root

At this point, your chroot environment is ready to roll. You can create a custom linuxrc to automatically chroot and start services that you install after the DNS-321 boots. If you don't want to bother rebooting, you can run the following to create devices:

Code:

# mknod /dev/null c 1 3
# mknod /dev/random c 1 8
# mknod /dev/ptmx c 2 5
# mount proc /proc -t proc
# mount devpts /dev/pts -t devpts

A fun_plug script similar to http://dns323.kood.org/howto:chroot_debian:fun_plug will handle mounting special devices for you on reboot.

If there are any questions or issues with this let me know and I'll be happy to answer any questions I can. I looked in the archives but didn't see any instructions like this for chroot'ing the DNS-321 so... my apologies if everyone knew this already. Thanks!

Offline

 

#2 2009-05-07 07:09:49

Bobby
Member
Registered: 2009-04-05
Posts: 42

Re: Debian squeeze chroot on DNS-321 HOWTO

I own a 321 myself and I was curious about this myself too, if it was possible to debian chroot into the box, thank you for assuring me its possible. However, I was wondering if everything works fine under debian and also I would like to know if I were to do that, would I need to format and lose data on the process?

Offline

 

#3 2009-05-07 10:31:37

talkingRock
Member
Registered: 2009-03-26
Posts: 100

Re: Debian squeeze chroot on DNS-321 HOWTO

That looks simpler than the "howto".

Do you know if the same basic procedure will work for getting Debian "lenny", the current stable released version, up and running on the 321 and/or 323?

Do you have debian up for fun, or are there things that you can't do with ffp or optware that you want to do with debian?

Offline

 

#4 2009-05-07 16:50:57

kennega
Member
Registered: 2009-05-07
Posts: 10

Re: Debian squeeze chroot on DNS-321 HOWTO

Bobby - you wouldn't need to format. The logic behind this is the same as the chroot instructions for the DNS-323 running sarge or etch, or even ffp. It utilizes a fun_plug script which the embedded version of Linux is running, and creating an rc script simply eases service startup if you chroot into another environment.

talkingRock - I haven't tried a build with lenny yet - I will give that a whirl tonight or this weekend and I can report back. But the process would be the same, yes. For now I just have Debian running for fun, until I decide what I want to have (and am able to have) the unit do without murdering the performance. You would use a chroot Debian if you wanted to run packages that are outside of the contributed packages for ffp. I'd say for 95% of people, the stuff in ffp is everything you'd need for tooling around with the DNS-321. With the Debian chroot environment, you can always run the latest available packages available from Debian, which may have a feature or something you want/need. Utilizing apt-get, you will also have the ability to update packages automatically... a big reason for this would be security updates.

Hope this helps.

Offline

 

#5 2009-05-17 01:35:19

Bobby
Member
Registered: 2009-04-05
Posts: 42

Re: Debian squeeze chroot on DNS-321 HOWTO

Damn, when I tried to do the step by step guide just now I got stuck in the

Code:

chroot /mnt/HD_a2/squeeze /bin/bash

http://ws.ryou.ws/images/2009-05-16_1732.png

Any ideas on what I can do about it? Seems like I can't chroot just yet.

EDIT: YOU NEED AT LEAST THE FIRMWARE VERSION 1.01 TO BE ABLE TO CHROOT

Last edited by Bobby (2009-08-26 19:38:43)

Offline

 

#6 2009-05-17 02:09:34

kennega
Member
Registered: 2009-05-07
Posts: 10

Re: Debian squeeze chroot on DNS-321 HOWTO

What firmware version are you running?

Offline

 

#7 2009-05-17 02:53:31

Bobby
Member
Registered: 2009-04-05
Posts: 42

Re: Debian squeeze chroot on DNS-321 HOWTO

I haven't updated it since I bought the device, should I? That'd be the version 1.00

Last edited by Bobby (2009-05-17 02:59:41)

Offline

 

#8 2009-05-17 03:43:03

kennega
Member
Registered: 2009-05-07
Posts: 10

Re: Debian squeeze chroot on DNS-321 HOWTO

Yeah, I would imagine that's why you're getting that message. Try a firmware update to 1.01 - it has a ton of enhancements anyways... eg. jumbo frame support. Try that and report back.

Offline

 

#9 2009-05-17 04:28:24

Bobby
Member
Registered: 2009-04-05
Posts: 42

Re: Debian squeeze chroot on DNS-321 HOWTO

After installing the 1.01 firmware I was able to chroot with squeeze, but when I was done doing the "iGREB ." command there is one file that won't install no matter what (base-files_5.0.0_armel.deb).

Code:

I have no name!@NetworkStorage:/var/cache/bootstrap# dpkg --force-all -i base-files_5.0.0_armel.deb
(Reading database ... 8098 files and directories currently installed.)
Preparing to replace base-files 5.0.0 (using base-files_5.0.0_armel.deb) ...
Unpacking replacement base-files ...
Setting up base-files (5.0.0) ...
mkdir: cannot create directory `/var/mail': File exists
dpkg: error processing base-files (--install):
 subprocess post-installation script returned error exit status 1
Processing triggers for man-db ...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_US"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
/usr/bin/mandb: can't set the locale; make sure $LC_* and $LANG are correct
Errors were encountered while processing:
 base-files
I have no name!@NetworkStorage:/var/cache/bootstrap#

EDIT: YOU CAN FIX THIS BY

Code:

rm -fr var/mail/

AND THEN

Code:

dpkg -iGREB .

TO INSTALL BASE-FILES AGAIN

Also, is there something odd with apt-get update? (I wonder if it has to do with base-files not being able to get installed)

Code:

I have no name!@NetworkStorage:/var/cache/bootstrap# apt-get update
Err http://ftp1.ca.debian.org squeeze Release.gpg
  Could not resolve 'ftp1.ca.debian.org'
Reading package lists... Done
W: Failed to fetch http://ftp1.ca.debian.org/debian/dists/squeeze/Release.gpg  Could not resolve 'ftp1.ca.debian.org'

W: Some index files failed to download, they have been ignored, or old ones used instead.
W: You may want to run apt-get update to correct these problems
I have no name!@NetworkStorage:/var/cache/bootstrap#

EDIT: THE PROBLEM HERE WAS THAT THE NAMESERVER WAS INVALID, I MADE A MISTAKE

Last edited by Bobby (2009-08-26 19:44:44)

Offline

 

#10 2009-05-17 05:22:58

kennega
Member
Registered: 2009-05-07
Posts: 10

Re: Debian squeeze chroot on DNS-321 HOWTO

Do you have a nameserver in /etc/resolv.conf set up within your chroot jail?

For the dpkg error you might want to try a dpkg -r on that fileset... and then re-try a dpkg -i on it.

Offline

 

#11 2009-05-17 05:36:38

Bobby
Member
Registered: 2009-04-05
Posts: 42

Re: Debian squeeze chroot on DNS-321 HOWTO

Yeah, I do have it.

Code:

echo "NETWORKSTORAGE 192.168.0.19" > /etc/resolv.conf

That's okay, right?

This happens when I issue dpkg -r base-files

http://ws.ryou.ws/images/2009-05-16_2134.png

This happens when I issue dpkg --force-all -r base-files

http://ws.ryou.ws/images/2009-05-16_2135.png

And then when I try to install it back again

http://ws.ryou.ws/images/2009-05-16_2140.png

Last edited by Bobby (2009-05-17 05:41:28)

Offline

 

#12 2009-05-17 05:42:41

kennega
Member
Registered: 2009-05-07
Posts: 10

Re: Debian squeeze chroot on DNS-321 HOWTO

echo "nameserver 192.168.0.19" > /etc/resolv.conf

That's if your DNS server is 192.168.0.19... or use something like 205.171.3.65, which is Qwest's DNS server. Then give it a whirl with an update.

As for the base package not installing... not real sure, there may be some other force flags you could try. Google any help for those messages?

Offline

 

#13 2009-05-17 05:52:16

Bobby
Member
Registered: 2009-04-05
Posts: 42

Re: Debian squeeze chroot on DNS-321 HOWTO

This is odd, its like if debian wasn't connected to the internet at all, it won't do anything. If I wanted to install everything again, I should just delete the squeeze folder, right?

EDIT: Nevermind that, the reason was stated above, the DNS server was not properly set tongue

Last edited by Bobby (2009-05-20 05:41:03)

Offline

 

#14 2009-05-17 05:53:25

kennega
Member
Registered: 2009-05-07
Posts: 10

Re: Debian squeeze chroot on DNS-321 HOWTO

Yeah you can just blow away the folder and start over. Maybe try the dpkg on that base package first.

Offline

 

#15 2009-05-17 06:01:04

Bobby
Member
Registered: 2009-04-05
Posts: 42

Re: Debian squeeze chroot on DNS-321 HOWTO

Alright, I deleted the folder, extracted the squeeze.tar again and and ran the "iGREB ." command like 7 times and everything is installed properly. Regarding the "nameserver" issue, I just found out my DNS server (silly me tongue) and everything *should* be working correctly now.

Thanks for your help, I really appreciate it.

If you must know, I'm planning on installing: irssi, rTorrent, and screen into the debian distro see if it is stable like this unlike on the normal OS.

What exactly does this part do, by the way?

Code:

# mknod /dev/null c 1 3
# mknod /dev/random c 1 8
# mknod /dev/ptmx c 2 5
# mount proc /proc -t proc
# mount devpts /dev/pts -t devpts

Last edited by Bobby (2009-05-17 06:41:38)

Offline

 

#16 2009-05-17 08:00:24

Bobby
Member
Registered: 2009-04-05
Posts: 42

Re: Debian squeeze chroot on DNS-321 HOWTO

Have you been able to make the "screen" application work? No matter what I do it just won't show a screen, it keeps telling me "You must be connected to a terminal"

Offline

 

#17 2009-05-17 08:54:10

kennega
Member
Registered: 2009-05-07
Posts: 10

Re: Debian squeeze chroot on DNS-321 HOWTO

That makes your devices which quite a few services in the OS depend on. I haven't done anything with screen, sorry.

Offline

 

#18 2009-05-19 06:26:10

Bobby
Member
Registered: 2009-04-05
Posts: 42

Re: Debian squeeze chroot on DNS-321 HOWTO

Okay, somehow I made screen work (forgot how tongue) so I'm happy now hehe, I really hated transmission because of its file fragmentation thing, but now with rTorrent fully stable its a whole different story smile

Thanks a bunch again, this is just what I needed =P

EDIT 2 : In order to be able to run screen without the PTY problem, you have to run this command under the main fun_plug environment

Code:

mount -o bind /dev /mnt/HD_a2/squeeze/dev
chroot /mnt/HD_a2/squeeze /bin/bash



And then on the chrooted environment:

Code:

mount proc /proc -t proc
mount devpts /dev/pts -t devpts

Last edited by Bobby (2009-07-06 03:55:00)

Offline

 

#19 2009-07-21 00:27:42

gt9228a
Member
Registered: 2009-03-04
Posts: 9

Re: Debian squeeze chroot on DNS-321 HOWTO

Sorry to ressurect and older thread.  Finally tried the chroot and it works great with squeeze.   Can anyone who is using it in a chroot environment on the DNS-321 post their fun_plug and linuxrc?

Thanks

Offline

 

#20 2009-08-12 00:37:38

djtecha
New member
Registered: 2009-08-12
Posts: 2

Re: Debian squeeze chroot on DNS-321 HOWTO

Hello all,
  So I have tried several of these guides and have figured out I do not have a /bin/bash directory. I have tried all the firmwares of my dns-321 and am completely stuck. Am I supposed to install bash somewhere? Or what? Any help would be greatly appreciated.

  ~Daniel

Offline

 

#21 2009-08-12 22:55:08

djtecha
New member
Registered: 2009-08-12
Posts: 2

Re: Debian squeeze chroot on DNS-321 HOWTO

Ok, I figured it out. Apparently you need to install bash seperatly from the defualt plugins installed. Many "packages" from here: http://www.inreto.de/dns323/fun-plug/0.5/ also I wasn't able to use that current repository until I changed it to # echo "deb http://ftp.ca.debian.org/debian squeeze main contrib non-free" > /etc/apt/sources.list
I don't know if the "1" matters or not though.

Offline

 

#22 2009-08-23 06:19:45

Bobby
Member
Registered: 2009-04-05
Posts: 42

Re: Debian squeeze chroot on DNS-321 HOWTO

djtecha wrote:

Ok, I figured it out. Apparently you need to install bash seperatly from the defualt plugins installed. Many "packages" from here: http://www.inreto.de/dns323/fun-plug/0.5/ also I wasn't able to use that current repository until I changed it to # echo "deb http://ftp.ca.debian.org/debian squeeze main contrib non-free" > /etc/apt/sources.list
I don't know if the "1" matters or not though.

the "1" is just a mirror, just as "2" and "3" would be, so don't worry about it, all of them have the exact same stuff, I didn't have to install bash separately at all when chrooting for the first time.

Offline

 

#23 2010-01-01 18:19:39

Opperpanter
Member
From: Eindhoven, Netherlands.
Registered: 2008-08-11
Posts: 89

Re: Debian squeeze chroot on DNS-321 HOWTO

Is someone able to post a link to that squeeze.tar? It would save me the time of arranging a debian install to perform the steps to create one myself.

Offline

 

#24 2010-01-02 01:18:58

Opperpanter
Member
From: Eindhoven, Netherlands.
Registered: 2008-08-11
Posts: 89

Re: Debian squeeze chroot on DNS-321 HOWTO

Running from Debian Lenny on either a x64 machine or a arm machine gives me segmentation fault:

Code:

cdebootstrap -aarmel squeeze squeeze ftp://ftp.debian.org/debian

Result:

Code:

...
P: Extracting login
P: Extracting ncurses-base
P: Extracting procps
P: Extracting sysvinit
P: Extracting tar
E: Execution failed: Exec format error
E: Internal error: install

Offline

 

#25 2010-01-08 03:36:37

Zombie
New member
Registered: 2010-01-08
Posts: 1

Re: Debian squeeze chroot on DNS-321 HOWTO

Opperpanter wrote:

Running from Debian Lenny on either a x64 machine or a arm machine gives me segmentation fault:

cdebootstrap is buggy: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=514015

I used debootstrap:

Code:

debootstrap --arch=armel --verbose --foreign squeeze ./squeeze
tar cf squeeze.tar squeeze

and after transferring squeeze.tar, on the target:

Code:

cd /mnt/HD_a2
tar xf squeeze.tar
chroot /mnt/HD_a2/squeeze /bin/bash
/debootstrap/debootstrap --second-stage

However, the chroot step segfaults for me. I'm using firmware 1.0.8.

Code:

file squeeze/bin/ls
squeeze/bin/ls: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

Is that because this is a 2.6.12 kernel? Does armel even work (still)?

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB