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-03 23:28:53

bareare
Member
Registered: 2007-05-24
Posts: 29

pty_allocate issue

Whenever I try to run any software on the Debian Etch I have installed, I get a "pty_allocate" error all the time.

I get a similar error if I try to access using SSH when there is already a Telnet. So it is a kind of one-user system and Debian isn't able to expand itself to run other software (like scp) ?

Anyone know what this can be caused by? Wrong in my startup script?

When I run the startup script below (busybox3 chroot /mnt/HD_a2/etch /etc/init.d/linuxrc), I get this error, maybe it is related?

Code:

Starting system log daemon: syslogd.
Starting kernel log daemon: klogd.
/etc/init.d/linuxrc: line 8: /etc/init.d/devfsd: No such file or directory
Starting OpenBSD Secure Shell server: sshd.
/etc/init.d/linuxrc: line 25: /etc/init.d/inetd: No such file or directory
/etc/init.d/linuxrc: line 31: /etc/init.d/atd: No such file or directory
Starting periodic command scheduler: crond.
Usage: stop-bootlogd {start|stop|restart|force-reload}

Startup script


Code:

#!/bin/bash

#SYSLOG
/etc/init.d/sysklogd start
/etc/init.d/klogd start

# DEVFS
/etc/init.d/devfsd start


# SSH
cd /dev
MAKEDEV ptyp
/etc/init.d/ssh start

# NFS
#/etc/init.d/portmap start
#/etc/init.d/nfs-common start
#/etc/init.d/nfs-user-server start


# INETD
/etc/init.d/inetd start

# Makedev
/etc/init.d/makedev start

# CRON
/etc/init.d/atd start
/etc/init.d/cron start

# Remove no login
/etc/init.d/rmnologin stop

# STOP BOOTLOG
/etc/init.d/stop-bootlogd

Offline

 

#2 2007-07-03 23:44:49

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

Re: pty_allocate issue

Offline

 

#3 2007-07-04 00:44:05

bareare
Member
Registered: 2007-05-24
Posts: 29

Re: pty_allocate issue

Are your sugggestion to recompile?

I tried the /dev/random thing, but didn't seem to have any effect. What can be the reason to why /etc/init.d/devfsd is missing?

Offline

 

#4 2007-07-04 13:00:54

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

Re: pty_allocate issue

bareare wrote:

Are your sugggestion to recompile?

No, I was suggesting to try this in your chroot:

Code:

mknod -m 0666 /dev/ptmx c 5 2
mkdir /dev/pts
mount -t devpts devpts /dev/pts

Anyway, your linuxrc output looks real damaged. Have you tried to chroot manually (see some other thread a few days ago)?
Also, why do you start devfsd if it isn't installed? Why isn't it installed? Same with inetd and atd?

Offline

 

#5 2007-07-10 00:08:20

bareare
Member
Registered: 2007-05-24
Posts: 29

Re: pty_allocate issue

The linux rc script is from the wiki (http://dns323.kood.org/howto:chroot_debian:linuxrc). I have commented out the things I know don't work.

I have chrooted manually, then the system works for a while.

I'm considering starting completely from scratch again, erasing system and getting Debian Etch with SSH up and running. Several of the commands in wiki gave errors during initial install, maybe because it was made for Sarge(?).

Anyhow: Do you have some tips on how to do this clean install, including getting the latest busybox and software that works with this box. First time, I just found busybox in some thread, and a little information here and there. To have a detailed instructions on this would be nice smile I just need ssh and Debian Etch up and working..

I'll start with trying to follow the wiki again, maybe I get more lucky this time wink

Fonz.. do you reccomend starting with your fun_plug for Debian, or is Wiki instructions best for my use? Also, your site seems down..

Last edited by bareare (2007-07-10 00:33:01)

Offline

 

#6 2007-07-10 00:55:08

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

Re: pty_allocate issue

Well, busybox and ssh+sftp server are included in my funplug.

Can't help you much with Debian, though - Debian often is a little complicated.

Offline

 

#7 2007-07-10 08:48:34

xenyz
Member
Registered: 2007-04-15
Posts: 12

Re: pty_allocate issue

Try this fun_plug script below for Debian etch. It's a combination of a couple scripts I picked up here and it works on 1.03 (sorry I don't have time to find the other author!). I added on to fonz's fun_plug script in order to have busybox and telnet available in case I botch something up. I commented out the ptx & external usb, and time adjustment is now done with ntpd in the debian chroot.

Code:

#!/bin/sh

VOL1=/mnt/HD_a2
VOL2=/mnt/HD_b2
FUNPLUGTAR=${VOL1}/fun_plug.tar
FUNPLUGDIR=${VOL1}/fun_plug.d
ETCDIR=${FUNPLUGDIR}/etc
BINDIR=${FUNPLUGDIR}/bin
LOGDIR=${FUNPLUGDIR}/log
LOGFILE=${LOGDIR}/fun_plug.log
PATH=${BINDIR}:${PATH}

export VOL1
export VOL2
export FUNPLUGDIR
export ETCDIR
export BINDIR
export LOGDIR
export LOGFILE
export PATH

umask 022

mkdir -p ${FUNPLUGDIR} ${LOGDIR}
echo "**** fun_plug script for DNS-323 (2007.04.03 tp@fonz.de) ****" >>${LOGFILE}
date >>${LOGFILE}

if [ -r "${FUNPLUGTAR}" ]; then
    echo "* Extracting ${FUNPLUGTAR}..." >>${LOGFILE}
    /bin/tar -xv -f ${FUNPLUGTAR} -C ${FUNPLUGDIR} 1>>${LOGFILE} 2>&1
    echo "* Deleting ${FUNPLUGTAR}..." >>${LOGFILE}
    rm -f ${FUNPLUGTAR}
fi
    
if [ -d "${FUNPLUGDIR}/start" ]; then
    for fun_plug_script in ${FUNPLUGDIR}/start/*.sh; do
        if [ -x "${fun_plug_script}" ]; then
            echo "* Running ${fun_plug_script}..." >>${LOGFILE}
            ${fun_plug_script} 1>>${LOGFILE} 2>&1
        else
            echo "* ${fun_plug_script} not executable..." >>${LOGFILE}
        fi
    done
else
    echo "* ${FUNPLUGDIR}/start: Directory not found"
fi

echo "* Debian Chroot" >>${LOGFILE}

VOL1=/mnt/HD_a2
VOL2=/mnt/HD_b2

etch=$VOL1/etch
busybox=$VOL1/fun_plug.d/bin/busybox
#modules=$VOL2/modules

# Correct time issues
#$busybox/adjtimex -t 9968
#$busybox/echo | $busybox/crontab -
#$busybox/echo WET0WEST,M3.5.0/01,M10.5.0/02 > /etc/TZ

# Load usb-storage
#$busybox/insmod $modules/usb-storage.ko

# Create /dev/random
$busybox mknod /dev/random c 1 8

# Correct dev permissions
$busybox chmod a+w /dev/tty
$busybox chmod a+w /dev/full
$busybox chmod a+w /dev/null
$busybox chmod a+w /dev/zero
$busybox chmod a+w /dev/random
$busybox chmod a+w /dev/urandom

# Setup pseudo-terminals
#$busybox mkdir -p /dev/pts
#$busybox mount -t devpts devpts /dev/pts
#$busybox mknod -m 0666 /dev/ptmx c 5 2

# Start telnet
#$busybox telnetd -l $busybox/sh

# Bind mount VOL1
$busybox mkdir -p $etch/$VOL1
$busybox mount --bind $VOL1 $etch/$VOL1

# Bind mount VOL2
$busybox mkdir -p $etch/$VOL2
$busybox mount --bind $VOL2 $etch/$VOL2

# Bind mount dev
$busybox mkdir -p $etch/dev
$busybox mkdir -p $etch/dev/pts
$busybox mount --bind /dev $etch/dev
$busybox mount --bind /dev/pts $etch/dev/pts

# Bind mount sys
$busybox mkdir -p $etch/sys
$busybox mount --bind /sys $etch/sys

# Bind mount proc
$busybox mkdir -p $etch/proc
$busybox mount --bind /proc $etch/proc

# Tmpfs mount /tmp /var/tmp /var/log /var/run /var/lock
$busybox mount -t tmpfs tmpfs $etch/tmp
$busybox mount -t tmpfs tmpfs $etch/var/tmp
$busybox mount -t tmpfs tmpfs $etch/var/log
$busybox mount -t tmpfs tmpfs $etch/var/run
$busybox mount -t tmpfs tmpfs $etch/var/lock

# Create mtab, fstab
$busybox ln -sf /proc/mounts $etch/etc/mtab
$busybox echo -n > $etch/etc/fstab

# Set hostname
$busybox hostname nas
$busybox hostname > $etch/etc/hostname

# Copy hosts, resolv.conf
$busybox cp -f /etc/hosts $etch/etc/hosts
$busybox cp -f /etc/resolv.conf $etch/etc/resolv.conf

# Chroot into Debian
$busybox chroot $etch /etc/init.d/rc 2 > /dev/null 2>&1

echo "* Debian Chroot Done" >>${LOGFILE}

Last edited by xenyz (2007-07-10 08:49:47)

Offline

 

#8 2007-07-10 18:51:29

bareare
Member
Registered: 2007-05-24
Posts: 29

Re: pty_allocate issue

Ok, I vent for the fonz fun plug to start with. But I do not have to mutch luck yet. I copied fun_plug and fun_plug.tar into /Volume_1 folder and rebooted. No action. The folders(files are chmod 777. It seems like several folders should have been created, but they are not.

I have only one voumne (running raid), but could that be the cause? I planned to get that original fun plug from fonz installed before I modified it more, but this wasn't to promising smile I'm running 1.03 firmware.

Last edited by bareare (2007-07-10 18:54:29)

Offline

 

#9 2007-07-10 20:16:44

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

Re: pty_allocate issue

bareare wrote:

/Volume_1

You didn't create that folder, right? Have you checked that fun_plug is executable? How did you copy?

Offline

 

#10 2007-07-11 02:58:16

bareare
Member
Registered: 2007-05-24
Posts: 29

Re: pty_allocate issue

No, it was created by default after the format of the disk.

First, I copied through a Windows share and rebooted. When that didn't work (no folders created and no telnet), I deleted the two files.

Then, I logged in with ftp and uploaded the files ito the Volumne folder again. Permissions was 777 for both files and the Volume_1 folder.

The user I logged in with ftp was Anonymous, but with root access. Could that make a permission problem maybe?

Last edited by bareare (2007-07-11 03:03:06)

Offline

 

#11 2007-07-11 04:16:35

bareare
Member
Registered: 2007-05-24
Posts: 29

Re: pty_allocate issue

For some reason, I got it to work now. The only thing different is that I pasted the fun_plug into a new document named fun_plug and uploaded it, instead of uploading it from the zip smile

Starting telnetd...
* /mnt/HD_a2/fun_plug.d/start/unfsd.sh not executable...
* Done
* Debian Chroot
* Debian Chroot Done

How can I get into a shell where I can run apt-get, install ssh server etc. like a normal Linux box?

Last edited by bareare (2007-07-11 05:02:04)

Offline

 

#12 2007-07-11 09:24:40

xenyz
Member
Registered: 2007-04-15
Posts: 12

Re: pty_allocate issue

bareare wrote:

For some reason, I got it to work now. The only thing different is that I pasted the fun_plug into a new document named fun_plug and uploaded it, instead of uploading it from the zip smile

Starting telnetd...
* /mnt/HD_a2/fun_plug.d/start/unfsd.sh not executable...
* Done
* Debian Chroot
* Debian Chroot Done

How can I get into a shell where I can run apt-get, install ssh server etc. like a normal Linux box?

Go in through telnet and type # chroot /mnt/HD_a2/etch /bin/bash and it should give you a root shell. From there, root@nas:/# apt-get update ; apt-get install ssh

After that is finished, you should be able to reboot the NAS, have it run the script and start up sshd on the NAS. Remember to create another user under Debian, or set a root password first to log in.

(I should have taken better notes as I was doing this. If the above works, maybe it should be added to the Wiki for an 'easier' Debian etch install?)

Offline

 

#13 2007-07-11 17:56:22

bareare
Member
Registered: 2007-05-24
Posts: 29

Re: pty_allocate issue

It seems to work ok (apt-update works).

When I run apt-get install ssh, I get that many files that do exists (grep exists, but the openssh-client.postins does not)

Code:

Setting up openssh-client (4.3p2-9) ...
/var/lib/dpkg/info/openssh-client.postinst: line 21: /mnt/HD_a2/fun_plug.d/bin/grep: No such file or directory

I did only extract the tar into Volume/etch directory. But then some permissions maybe becomes wrong?


Yes, it would be nice to have it as part of the wiki. It was far simlier to follow this than the one in the wiki now.

Last edited by bareare (2007-07-11 17:58:47)

Offline

 

#14 2007-07-11 18:05:55

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

Re: pty_allocate issue

It's not the permissions. It's this one:

xenyz wrote:

# chroot /mnt/HD_a2/etch /bin/bash

Should be:

Code:

# chroot /mnt/HD_a2/etch /bin/bash -ls

(it's dash small-L small-S) This way, you should get a clean environment. After the chroot, check

Code:

echo $PATH

It must not contain any fun_plug-stuff.

Offline

 

#15 2007-07-11 18:39:00

bareare
Member
Registered: 2007-05-24
Posts: 29

Re: pty_allocate issue

Rebooted and tried that now, then i got this:

Code:

BusyBox v1.5.0 (2007-05-06 16:42:17 CEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

/ # chroot /mnt/HD_a2/etch /bin/bash -ls
bash: /mnt/HD_a2/fun_plug.d/bin/id: No such file or directory
bash: [: : integer expression expected

I did however get into the box even thow the error occured, typing "echo $PATH" gave me /usr/local/bin:/usr/bin:/bin:/usr/games.

Code:

Extracting templates from packages: 100%
Preconfiguring packages ...
dpkg: `ldconfig' not found on PATH.
dpkg: `start-stop-daemon' not found on PATH.
dpkg: `install-info' not found on PATH.
dpkg: `update-rc.d' not found on PATH.
dpkg: 4 expected program(s) not found on PATH.
NB: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.

Last edited by bareare (2007-07-11 18:43:11)

Offline

 

#16 2007-07-11 18:50:01

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

Re: pty_allocate issue

There's still something wrong with the environment - and it looks similar to Emacs' problems (http://dns323.kood.org/forum/t688-Debia … nuxrc.html)

Instead of bash, he uses sh:

Code:

chroot /mnt/HD_a2/etch /bin/sh -l

Maybe that one works better...

Offline

 

#17 2007-07-11 19:04:35

bareare
Member
Registered: 2007-05-24
Posts: 29

Re: pty_allocate issue

Strange.. Got the same error

sh: /mnt/HD_a2/fun_plug.d/bin/id: No such file or directory
sh: [: : integer expression expected

I did a complete wipeout (format) again just to be sure it was not a random issue.

Code:

1. Uploaded fun_plug and funplug-0.2.tar and restarted: Telnet up and running, log ok.
2. Uploaded etch.tar. Extracted into /mnt/hd_a2/ and now etch is up in /mnt/hd_a2/etch.
3. Edited the funplug to include the Debian related stuff.
4. Log reports everything OK.
5. Running  chroot /mnt/HD_a2/etch /bin/bash -ls
6. Getting this: "bash: /mnt/HD_a2/fun_plug.d/bin/id: No such file or directory. bash: [: : integer expression expected"
7. root@Boksen:/#

Last edited by bareare (2007-07-11 21:20:20)

Offline

 

#18 2007-07-11 21:37:29

bareare
Member
Registered: 2007-05-24
Posts: 29

Re: pty_allocate issue

I added all these to path, and then it worked smile At least, apt-get etc. works nicely. I'm sure I get some other problem wink But hopes it does it..

/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/sbin:/sbin:/usr/local/sbin

Offline

 

#19 2007-07-11 21:45:28

bareare
Member
Registered: 2007-05-24
Posts: 29

Re: pty_allocate issue

100% success smile

ssh is starting automatically on boot and everything, after adding /etc/init.d/ssh start to /etc/init.d/rc.

This should definitly be written some place.

Last edited by bareare (2007-07-11 21:50:10)

Offline

 

#20 2007-07-12 10:10:23

xenyz
Member
Registered: 2007-04-15
Posts: 12

Re: pty_allocate issue

bareare wrote:

100% success smile

ssh is starting automatically on boot and everything, after adding /etc/init.d/ssh start to /etc/init.d/rc.

This should definitly be written some place.

For now, are you able to rename this thread's topic to something easier to locate?

Offline

 

#21 2007-07-12 10:24:51

xenyz
Member
Registered: 2007-04-15
Posts: 12

Re: pty_allocate issue

fonz wrote:

It's not the permissions. It's this one:

xenyz wrote:

# chroot /mnt/HD_a2/etch /bin/bash

Should be:

Code:

# chroot /mnt/HD_a2/etch /bin/bash -ls

(it's dash small-L small-S) This way, you should get a clean environment. After the chroot, check

Code:

echo $PATH

It must not contain any fun_plug-stuff.

For the record, if I follow the /bin/bash -ls I get the same error, even though it still goes to the bash prompt.

From telnet:

Code:

/ # chroot /mnt/HD_a2/etch /bin/bash -ls
bash: /mnt/HD_a2/fun_plug.d/bin/id: No such file or directory
bash: [: : integer expression expected
root@nas:/# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games
root@nas:/# exit
logout
/ # chroot /mnt/HD_a2/etch /bin/bash    
root@nas:/# echo $PATH
/mnt/HD_a2/fun_plug.d/bin:/usr/bin:/bin:/usr/sbin:/sbin

From sshd inside the Debian chroot:

Code:

computer:~ xenyz$ ssh nas
xenyz@nas's password: 
xenyz@nas:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/games
xenyz@nas:~$ su -
Password: 
nas:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
nas:~#

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB