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 2007-07-01 18:56:32

Emacs
Member
Registered: 2007-06-24
Posts: 110

Debian Etch fun_plug script - where should "linuxrc" be?

Hi all,

until now I manually chrooted into Debian Etch. Now I'd like to create a fun_plug for doing this each time the DNS-323 boots.

Either I make some fundamental mistakes, or the fun_plug on the Wiki is not matching up with the latest incarnation of fonz' fun_plug-0.2 tar file.

My problem comes down a bit to where to place the "linuxrc" file.

The last line in my fun_plug script is:

   busybox chroot $VOL1/etch linuxrc

Where $VOL1 is /mnt/HD_a2 . Proc is mounted beforehand.
When I run fun_plug I receive the following output:

   chroot: cannot execute linuxrc: No such file or directory

I have a "linuxrc" in /mnt/HD_a2 and one in /mnt/HD_a2/etch
Both are 775 and belong to root.

So where does the chroot look for linuxrc ??

Cheers,

Emacs

Offline

 

#2 2007-07-01 19:02:32

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Debian Etch fun_plug script - where should "linuxrc" be?

the funplug on the wiki has not much in common with my funplug.

Only the linuxrc in /mnt/HD_a2/etch should be relevant. Try adding a slash in front of linuxrc:

Code:

busybox chroot $VOL1/etch /linuxrc

If you're using my funplug, you can also skip the extra "busybox":

Code:

chroot /mnt/HD_a2/etch /linuxrc

Offline

 

#3 2007-07-01 19:36:10

Emacs
Member
Registered: 2007-06-24
Posts: 110

Re: Debian Etch fun_plug script - where should "linuxrc" be?

Hmmm, the linuxrc in the etch directory is now read (using "/linuxrc") but I still get a number of error messages caused by the linuxrc itself (taken from the wiki page):

search infowriteconsulting.com /etc/resolv.conf
Starting system log daemon: syslogd.
Starting kernel log daemon: klogd.
/linuxrc: line 16: /etc/init.d/devfsd: No such file or directory
/linuxrc: line 24: MAKEDEV: command not found
/linuxrc: line 27: /etc/init.d/portmap: No such file or directory
/linuxrc: line 28: /etc/init.d/nfs-common: No such file or directory
/linuxrc: line 29: /etc/init.d/nfs-user-server: No such file or directory
/linuxrc: line 32: /etc/init.d/exim4: No such file or directory
/linuxrc: line 35: /etc/init.d/atd: No such file or directory
Starting periodic command scheduler: crond/etc/init.d/cron: line 26: start-stop-daemon: command not found
failed!
/linuxrc: line 39: /etc/init.d/inetd: No such file or directory
Usage: /etc/init.d/rmnologin start|stop
Usage: stop-bootlogd {start|stop|restart|force-reload}
/mnt/HD_a2 #

Unfortunately I don't end in Etch, but I'm still in the original environment...

Is the linuxrc from the wiki not compatible with Etch?

There seems to be a problem with PATH anyway. When I now manually chroot I get:

/mnt/HD_a2 # chroot /mnt/HD_a2/etch
chroot: cannot execute /mnt/HD_a2/fun_plug.d/bin/sh: No such file or directory
/mnt/HD_a2 #

Where is that "fun_plug.d" coming from? *wonder*

/mnt/HD_a2 # chroot /mnt/HD_a2/etch
chroot: cannot execute /mnt/HD_a2/fun_plug.d/bin/sh: No such file or directory
/mnt/HD_a2 #

Is the local PATH taken over to the chroot environment?
Cheers,

Emacs

Last edited by Emacs (2007-07-01 19:38:33)

Offline

 

#4 2007-07-01 19:40:49

Emacs
Member
Registered: 2007-06-24
Posts: 110

Re: Debian Etch fun_plug script - where should "linuxrc" be?

Even if I edit the local PATH I still get the same problem:

/mnt/HD_a2 # export PATH=/usr/sbin:/bin:/usr/bin:/sbin
/mnt/HD_a2 # chroot /mnt/HD_a2/etch
-sh: chroot: not found


/mnt/HD_a2 # ./fun_plug.d/bin/chroot /mnt/HD_a2/etch
chroot: cannot execute /mnt/HD_a2/fun_plug.d/bin/sh: No such file or directory


/mnt/HD_a2 # echo $PATH
/usr/sbin:/bin:/usr/bin:/sbin
/mnt/HD_a2 #
/mnt/HD_a2 #


Strange...

Emacs

Offline

 

#5 2007-07-01 19:44:41

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Debian Etch fun_plug script - where should "linuxrc" be?

No sure what you mean by "I don't end in etch". You're starting the "linuxrc" process within your chroot. chroot doesn't magically switch the whole system to etch - just a single process (and its sub-processes). If you want to telnet into etch, you need to start a telnet daemon that is chroot'ed.

To manually chroot, run a chroot'ed shell:

Code:

chroot /mnt/HD_a2/etch /bin/bash

You should have a look at the chroot documentation.

I don't use Debian myself, so can't help you with the debian-specific config. But I think there's at least on thread discussion these issues.

Offline

 

#6 2007-07-01 19:54:26

Emacs
Member
Registered: 2007-06-24
Posts: 110

Re: Debian Etch fun_plug script - where should "linuxrc" be?

Just for my understanding, when I have my fun_plug modified to chroot into Debian Etch, should a new telnet performed from my local PC to the DNS bring me into the chrooted Etch or into the original environment?

Cheers,

Emacs

Offline

 

#7 2007-07-01 20:14:33

Emacs
Member
Registered: 2007-06-24
Posts: 110

Re: Debian Etch fun_plug script - where should "linuxrc" be?

Okay, my problem is simple:

Each time I re-boot the DNS-323 I have to do the following three steps manually:

1.) Telnet in to the DNS
2.) issue "chroot /mnt/HD_a2/etch /bin/sh -l"
3.) Once within Debian I issue "/usr/sbin/apache2ctl -k start"

What I want to have is that the apache2 is started automatically when the box re-boots.
What do I need for that?
Subversion scripts?
Modified fun_plug?

Any ideas?


Cheers,

Emacs

Offline

 

#8 2007-07-01 20:47:57

fonz
Member / Developer
From: Berlin
Registered: 2007-02-06
Posts: 1716
Website

Re: Debian Etch fun_plug script - where should "linuxrc" be?

Emacs wrote:

1.) Telnet in to the DNS
2.) issue "chroot /mnt/HD_a2/etch /bin/sh -l"
3.) Once within Debian I issue "/usr/sbin/apache2ctl -k start"

Try combining steps 2 and 3. Put it in a new script /.../fun_plug.d/start/debian-apache.sh:

Code:

#!/bin/sh
chroot /mnt/HD_a2/etch /usr/sbin/apache2ctl -k start

Run the script manually first. If it works, make it executable (chmod a+x debian-apache.sh), so that it will run automatically after reboot.  If you also want a telnet into debian, create another script that starts a chroot'ed telnet and disable the original telnet.sh (chmod a-x telnet.sh).

Offline

 

#9 2007-07-01 21:05:17

Emacs
Member
Registered: 2007-06-24
Posts: 110

Re: Debian Etch fun_plug script - where should "linuxrc" be?

Works beautifully!

Thanks a lot fonz!

Cheers,

Emacs

Offline

 

#10 2007-07-01 21:51:25

kruzes
Member
Registered: 2007-05-31
Posts: 22

Re: Debian Etch fun_plug script - where should "linuxrc" be?

Another alternative, if you're into debian, is using its rc script like this:

Code:

chroot /mnt/HD_a2/etch /etc/init.d/rc 2 > /dev/null 2>&1

This way, you can configure services through the usual debian methods (update-rc.d, etc). Most services will actually be configured out of the box.

But if all you want to do is run apache though, fonz's solution is better, of course.

Last edited by kruzes (2007-07-01 21:56:05)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB