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

#26 2008-05-18 06:31:09

quekky
Member
Registered: 2008-03-30
Posts: 20

Re: fun_plug on USB-Stick?

perhaps after writing the partition table you may want to verify it is stored as Linux not FAT. Maybe your thumbdrive auto-rename it back to FAT

Code:

#fdisk -l

you can run this on another telnet session while you are formating

Offline

 

#27 2008-05-18 16:42:06

bspvette86
Member
Registered: 2008-05-09
Posts: 81

Re: fun_plug on USB-Stick?

quekky wrote:

perhaps after writing the partition table you may want to verify it is stored as Linux not FAT. Maybe your thumbdrive auto-rename it back to FAT

Code:

#fdisk -l

you can run this on another telnet session while you are formating

Interesting.  The DNS-323 seems to ignore the partition type.  My fdisk partition  was still set to FAT even though it was formatted and mounted as EXT2.  You can update the partition type without reformatting the by using the "t" option of fdisk.  (not that it seems to matter on 1.04 or 1.05)

Cheers!
k

Offline

 

#28 2008-05-19 07:47:39

halfsoul
Member
Registered: 2008-01-28
Posts: 57

Re: fun_plug on USB-Stick?

bspvette86 wrote:

quekky wrote:

perhaps after writing the partition table you may want to verify it is stored as Linux not FAT. Maybe your thumbdrive auto-rename it back to FAT

Code:

#fdisk -l

you can run this on another telnet session while you are formating

Interesting.  The DNS-323 seems to ignore the partition type.  My fdisk partition  was still set to FAT even though it was formatted and mounted as EXT2.  You can update the partition type without reformatting the by using the "t" option of fdisk.  (not that it seems to matter on 1.04 or 1.05)

Cheers!
k

A similar scenario happened to me.  I partitioned & formatted as ext2, but then when trying to mount the drive in auto mode the DNS-323 kept thinking it was FAT.  My problem was that either the partitioning or the formatting wasn't completing successfully due to lack of power, even though it seemed to finish.  Maybe the box defaults to FAT if it can't determine what FS it is due to corruption?

Offline

 

#29 2008-05-19 19:19:10

blbrown
Member
Registered: 2007-11-02
Posts: 88
Website

Re: fun_plug on USB-Stick?

halfsoul, glad to hear you solved your problem--I was gone all weekend, so I didn't see your post until today.  I added this thread to my instructions since it provides yet more symptoms of the weird compatibility issue with the USB port on the DNS-323.

Offline

 

#30 2008-06-20 00:11:01

rcblackwell
Member
From: Pickering, ON
Registered: 2008-05-19
Posts: 204
Website

Re: fun_plug on USB-Stick?

grmek wrote:

Okay, I've tried SilentException's script now, of course changing the UUID to the proper value, but still:

**** fun_plug script for DNS-323 (2008-04-13 tp@fonz.de) ****
Thu May 15 13:10:02 GMT 2008
Found usb-storage.ko module. Copying...
insmod usb-storage.ko
ln -snf /mnt/HD_a2/ffp /ffp
Waiting for F486-21D2 (up to 30 seconds) ...
/dev/sdc1: LABEL="JUMPDRIVE" UUID="F486-21D2" TYPE="vfat"
/dev/sdc1: LABEL="JUMPDRIVE" UUID="F486-21D2" TYPE="vfat"
Success. Found F486-21D2.
Mounting /dev/sdc1 on /mnt/USB
USB stick mounted
* Found FFP on USB device
ln -snf /mnt/USB/ffp /ffp
* Running /ffp/etc/rc ...
./fun_plug: /ffp/etc/rc: No such file or directory
*  OK

That's it... rc doesnt get run and ffp is not started..

I've just gone through the exact same problem. That is until I realized the file attributes associated with the fun_plug files were not copied to the USB drive when I copied the files over from the harddive. To be exact, the execute attribue was lost. Using the -p switch (preserve mode, ownership, timestamps) with the copy command resolved the problem.

I now have ffp and my model railroad web (afticarr.com) running from the USB key.

Bob Blackwell
Pickering, ON

Last edited by rcblackwell (2008-06-20 00:12:28)


Bob Blackwell
Pickering, ON

Offline

 

#31 2008-06-24 19:10:52

bfg100k
Member
Registered: 2007-09-15
Posts: 55

Re: fun_plug on USB-Stick?

SilentException wrote:

thanks. i did something similar using your first script as a template..

then, with help from uf0un from irc channel i modified fun_plug that mounts the usb partition using UUID instead of fixed device name.

attached is my current fun_plug

One question on the use of UUID. DOes it make it more robust from the point of view of locating the right stick (in case you have many attached)? Also, if I were to use your script, do I need to change the UUID to something else? If so, how do I find out what UUID to use for my stick? TIA

Offline

 

#32 2008-06-24 19:53:42

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: fun_plug on USB-Stick?

bfg100k wrote:

SilentException wrote:

thanks. i did something similar using your first script as a template..

then, with help from uf0un from irc channel i modified fun_plug that mounts the usb partition using UUID instead of fixed device name.

attached is my current fun_plug

One question on the use of UUID. DOes it make it more robust from the point of view of locating the right stick (in case you have many attached)? Also, if I were to use your script, do I need to change the UUID to something else? If so, how do I find out what UUID to use for my stick? TIA

exactly, so far i have only one usb device connected so it was always sdc1 but that might change. and the script will still be working after that, as planned smile in this case, there are no other reasons for mounting using UUID..

you can find UUID using command 'blkid'


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#33 2008-06-24 22:16:30

bfg100k
Member
Registered: 2007-09-15
Posts: 55

Re: fun_plug on USB-Stick?

Thanks for the reply. I managed to figure out the blkid command after looking through your script. One more question though... I was under the impression that after ffp is moved to the USB stick, I should then be able to umount HD_a2 once I shutdown all services (except ssh of cuz) right? I can't seem to get to that stage for my box. FYI, I need to unmount it so that I can run e2fsck on it. The cleanboot script doesn't seem to work for me and I was hoping that by moving ffp to the USB stick, I will no longer have problems with the umounting of HD_a2!

Offline

 

#34 2008-06-24 22:42:05

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: fun_plug on USB-Stick?

try reading here and forward if you'd like to chk your disks:

http://dns323.kood.org/forum/p14563-200 … tml#p14563

i've quickly made a small pack for booting into e2fsck mode. hope it helps! smile


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#35 2008-06-25 03:41:25

bfg100k
Member
Registered: 2007-09-15
Posts: 55

Re: fun_plug on USB-Stick?

SilentException wrote:

try reading here and forward if you'd like to chk your disks:

http://dns323.kood.org/forum/p14563-200 … tml#p14563

i've quickly made a small pack for booting into e2fsck mode. hope it helps! smile

Yeah, I've been using that for running e2fsck on HD_a2. but booting into an alternative mode is a pain that I'm trying to avoid. (yeah, I'm lazy! smile)

Offline

 

#36 2008-06-25 04:19:31

bspvette86
Member
Registered: 2008-05-09
Posts: 81

Re: fun_plug on USB-Stick?

bfg100k wrote:

SilentException wrote:

try reading here and forward if you'd like to chk your disks:

http://dns323.kood.org/forum/p14563-200 … tml#p14563

i've quickly made a small pack for booting into e2fsck mode. hope it helps! smile

Yeah, I've been using that for running e2fsck on HD_a2. but booting into an alternative mode is a pain that I'm trying to avoid. (yeah, I'm lazy! smile)

bfg100k,
Are you sure your USB-storage support is starting from someplace like /tmp instead of /mnt/HD_a2?

ie:
cp /mnt/HD_a2/lnx_bin/usb-storage.ko /tmp
insmod /tmp/usb-storage.ko

If it is being loaded from /mnt/HD_a2, it will prevent the FS from being unmounted.  Also, what does a "ps -ef" show?

Cheers!
bspvette

Offline

 

#37 2008-06-25 10:39:48

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: fun_plug on USB-Stick?

bspvette86 wrote:

bfg100k wrote:

SilentException wrote:

try reading here and forward if you'd like to chk your disks:

http://dns323.kood.org/forum/p14563-200 … tml#p14563

i've quickly made a small pack for booting into e2fsck mode. hope it helps! smile

Yeah, I've been using that for running e2fsck on HD_a2. but booting into an alternative mode is a pain that I'm trying to avoid. (yeah, I'm lazy! smile)

bfg100k,
Are you sure your USB-storage support is starting from someplace like /tmp instead of /mnt/HD_a2?

ie:
cp /mnt/HD_a2/lnx_bin/usb-storage.ko /tmp
insmod /tmp/usb-storage.ko

If it is being loaded from /mnt/HD_a2, it will prevent the FS from being unmounted.  Also, what does a "ps -ef" show?

Cheers!
bspvette

yeah, if you take a look at my fun_plug, it copies the module to ram drive, then loads it smile

Code:

usbmod_loaded=no
#copy usb-storage module
if [ -e $FFP_HD/lib/modules/$(uname -r)/usb-storage.ko ]; then
        echo "Found usb-storage.ko module. Copying..."
        mkdir -p /lib/modules/$(uname -r)/
        cp $FFP_HD/lib/modules/$(uname -r)/usb-storage.ko /lib/modules/$(uname -r)/
        #load usb-storage module
        insmod /lib/modules/$(uname -r)/usb-storage.ko
        echo "insmod usb-storage.ko"
        sleep 2
        usbmod_loaded=yes
fi

i made sure *nothing* runs on the hdd as i'm alergic to disk spin-ups smile

you should be able to umount hdds. if you want to debug, get a copy of lsof for arm (i could send you one) and do:

#lsof |grep HD_
(this will show you open files on HDDs)

also, before umount try this:
#swapoff /dev/sda1
#swapoff /dev/sdb1


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#38 2008-06-25 13:19:36

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

Re: fun_plug on USB-Stick?

SilentException wrote:

if you want to debug, get a copy of lsof for arm (i could send you one) and do:

#lsof |grep HD_
(this will show you open files on HDDs)

I've just added lsof to ffp 0.5. It's small enough and definitely a useful debugging tool.

Offline

 

#39 2008-06-25 15:35:17

bfg100k
Member
Registered: 2007-09-15
Posts: 55

Re: fun_plug on USB-Stick?

not exactly sure what happened last night but after a reboot today, i'm able to unmount the partition and run e2fsck successfully... new (but expected) problem though... my usb stick is not able to unmount properly on shutdown/reboot (even after applying cleanboot)

Offline

 

#40 2008-06-25 16:00:59

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: fun_plug on USB-Stick?

i have same problem and havent been able to figure it out yet.

the cleanboot script i'm using should be able to stop all the stuff and umount cleanly but it fails. funny thing is that you cannot debug it easily (maybe with another usb stick on which you'll write the log file)...

@ fonz: yeah, realy useful utility. thanks for including it in ffp wink


edit: now i got the idea of logging over network. will redirect the cleanboot script output to /tmp/cleanboot.log, then netcat the file to my listening xp computer. let's see how it works smile

Last edited by SilentException (2008-06-25 16:19:10)


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

#41 2008-06-25 20:12:14

EnricoM
Member
From: Netherlands
Registered: 2008-06-03
Posts: 77

Re: fun_plug on USB-Stick?

bfg100k wrote:

not exactly sure what happened last night but after a reboot today, i'm able to unmount the partition and run e2fsck successfully... new (but expected) problem though... my usb stick is not able to unmount properly on shutdown/reboot (even after applying cleanboot)

Same problem here, cleanboot does not work on my CH3SNAS at all.
My current work around: After reboot I kill the process mt-daapd and then i am able to remount the USB stick as read only. Then I run e2fsck to correct any errors...

If there is a better solution, I would be more happy!


Hardware: Conceptronic CH3SNAS, FW1.03 - 2x Samsung Spinpoint F1 750 MB, no RAID  - Imation Whizz 4GB USB Flash Drive
Software:  Fun_plug 0.5 beta, SSH, Samba recycle bin, Firefly, hellanzb, nzbget, cleanboot, chrooted etch, optware, midnight commander, rsnapshot

Offline

 

#42 2008-06-25 20:14:06

EnricoM
Member
From: Netherlands
Registered: 2008-06-03
Posts: 77

Re: fun_plug on USB-Stick?

bfg100k wrote:

not exactly sure what happened last night but after a reboot today, i'm able to unmount the partition and run e2fsck successfully... new (but expected) problem though... my usb stick is not able to unmount properly on shutdown/reboot (even after applying cleanboot)

Same problem here, cleanboot does not work on my CH3SNAS at all.
My current work around: After reboot I kill the process mt-daapd and then i am able to remount the USB stick as read only. Then I run e2fsck to correct any errors...

If there is a better solution, I would be more happy!


Hardware: Conceptronic CH3SNAS, FW1.03 - 2x Samsung Spinpoint F1 750 MB, no RAID  - Imation Whizz 4GB USB Flash Drive
Software:  Fun_plug 0.5 beta, SSH, Samba recycle bin, Firefly, hellanzb, nzbget, cleanboot, chrooted etch, optware, midnight commander, rsnapshot

Offline

 

#43 2008-07-03 15:43:37

knireis
Member
Registered: 2007-12-10
Posts: 231

Re: fun_plug on USB-Stick?

I am trying to understand what happens when i remove the usb stick. I thought that in that case the /ffp on HD_a2 would load. This /ffp is in my case the same as the /ffp on the usb stick because i copied it over.
But the logfile shows that /ffp on a usb stick is found?

**** fun_plug script for DNS-323 (2008-04-13 tp@fonz.de) ****
Thu Jul  3 15:14:06 GMT 2008
Found usb-storage.ko module. Copying...
insmod usb-storage.ko
Waiting for sdc1 (up to 30 seconds) ...
Failed. Did not find sdc1 in /proc/partitions.
* Found FFP on USB device
ln -snf /mnt/HD_a2/Datagb/sdc1/ffp /ffp

Is this normal behavior? I'm using the funplug file provided by Kylek

Offline

 

#44 2008-07-04 14:58:01

KyleK
Member
From: Dresden, Germany
Registered: 2007-12-05
Posts: 1178

Re: fun_plug on USB-Stick?

Yes, the script should fall back to a HDD-based fun_plug should it not find the USB stick.
Looking at your log, it seems like you use the same path for the hdd funplug and the USB funplug, which might confuse the script.

Make sure that your mount point for the USB stick is not a directory on one of your disks. I use /mnt/USB for this. (You have to create the directory before something can get mounted to it).

Offline

 

#45 2008-07-07 18:33:39

Sparkss
Member
Registered: 2008-05-09
Posts: 44

Re: fun_plug on USB-Stick?

just had our new USB stick die.. maybe "worn out" ? I wonder if it explains a few NFS streaming errors that we experienced over the weekend ? hmmmmm., Anyways now we get these lovely errors in the dmesg output and the majority of the FS on the USB drive is toast.  sad

usb-storage: *** thread awakened.
usb-storage: Bad target number (7:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: device scan complete
scsi2 (0:0): rejecting I/O to dead device
scsi2 (0:0): rejecting I/O to dead device
scsi2 (0:0): rejecting I/O to dead device
scsi2 (0:0): rejecting I/O to dead device
Buffer I/O error on device sdc1, logical block 0
lost page write due to I/O error on sdc1
EXT2-fs error (device sdc1): ext2_readdir: bad page in #2
scsi2 (0:0): rejecting I/O to dead device
scsi2 (0:0): rejecting I/O to dead device
Buffer I/O error on device sdc1, logical block 0
lost page write due to I/O error on sdc1
EXT2-fs error (device sdc1): ext2_readdir: bad page in #8146
scsi2 (0:0): rejecting I/O to dead device
scsi2 (0:0): rejecting I/O to dead device
Buffer I/O error on device sdc1, logical block 0
lost page write due to I/O error on sdc1
EXT2-fs error (device sdc1): ext2_get_inode: unable to read inode block - inode=2, block=123
scsi2 (0:0): rejecting I/O to dead device
scsi2 (0:0): rejecting I/O to dead device
Buffer I/O error on device sdc1, logical block 0
lost page write due to I/O error on sdc1
EXT2-fs error (device sdc1): ext2_get_inode: unable to read inode block - inode=8145, block=32891

#######################################
#              HD0 awake now !        #
#######################################
scsi2 (0:0): rejecting I/O to dead device
scsi2 (0:0): rejecting I/O to dead device
Buffer I/O error on device sdc1, logical block 0
lost page write due to I/O error on sdc1
EXT2-fs error (device sdc1): ext2_get_inode: unable to read inode block - inode=8146, block=32891
scsi2 (0:0): rejecting I/O to dead device
scsi2 (0:0): rejecting I/O to dead device
scsi2 (0:0): rejecting I/O to dead device

Offline

 

#46 2008-07-07 18:50:22

Sparkss
Member
Registered: 2008-05-09
Posts: 44

Re: fun_plug on USB-Stick?

I wanted to add something here. I use a USB hub to connect the flash drive and another external HD. Nothing I did would get the flash drive readable at it's current position (which was /dev/sdc1), so I went ahead and just pulled and and re-inserted it into a new port on the hub, found it's dev mount and mounted a dir to it. I can read the drive fine and dandy which leads me to believe that perhaps the port on the hub went bad ? Either way I am going to reboot to test things out. Up until now I did everything I could NOT to reboot, since I didn't know what state it would come back up in. I had 95% of everything from the flash drive backed up, but there were a couple of strt scripts that I had recently customized some more that I had not yet backed up (they are backed up now smile). I will try to jump back onto this forum later on today and post the outcome  smile.

Offline

 

#47 2008-07-07 23:12:44

knireis
Member
Registered: 2007-12-10
Posts: 231

Re: fun_plug on USB-Stick?

KyleK wrote:

Yes, the script should fall back to a HDD-based fun_plug should it not find the USB stick.
Looking at your log, it seems like you use the same path for the hdd funplug and the USB funplug, which might confuse the script.

Make sure that your mount point for the USB stick is not a directory on one of your disks. I use /mnt/USB for this. (You have to create the directory before something can get mounted to it).

Thanks, that solved it. I made another mount with a different name to the HD_a2 for easier access.

Offline

 

#48 2008-10-08 21:31:20

halfsoul
Member
Registered: 2008-01-28
Posts: 57

Re: fun_plug on USB-Stick?

SilentException wrote:

i made sure *nothing* runs on the hdd as i'm alergic to disk spin-ups smile

I don't understand something in the script.  After mounting the usb drive and before the symbolic link, why is there a second SUID BUSYBOX script, and why does it seem to call the HD?  Or am I misunderstanding something?

Code:

    # suid busybox on USB
    if [ -x $FFP_USB/bin/busybox ]; then
        chown root.root $FFP_HD/bin/busybox
        chmod 0755 $FFP_HD/bin/busybox
        chmod u+s $FFP_HD/bin/busybox
    fi

Offline

 

#49 2008-10-08 21:44:37

SilentException
Member
From: Island of Krk, Croatia
Registered: 2008-05-04
Posts: 148

Re: fun_plug on USB-Stick?

halfsoul wrote:

SilentException wrote:

i made sure *nothing* runs on the hdd as i'm alergic to disk spin-ups smile

I don't understand something in the script.  After mounting the usb drive and before the symbolic link, why is there a second SUID BUSYBOX script, and why does it seem to call the HD?  Or am I misunderstanding something?

Code:

    # suid busybox on USB
    if [ -x $FFP_USB/bin/busybox ]; then
        chown root.root $FFP_HD/bin/busybox
        chmod 0755 $FFP_HD/bin/busybox
        chmod u+s $FFP_HD/bin/busybox
    fi

thats my bug. it should say $FFP_USB in each of chown and chmod commands.

btw, those commands are there just to make sure busybox has right permissions and that it's suid root. in 99.99% cases they don't even get executed and have nothing to do with disk spinning up or down smile


D-Link DNS-323 v1.05 fun_plug-ed + many mods,  2 x 320GB Seagate Barracuda 7200.10 RAID0, Cat6 Gigabit Network, 9k Jumbo Frames, Average (WRITE): 19,32 MB/sec, Average (READ): 28,6 MB/sec

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB