Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
Hi.
I have fun_plug running on my DNS-320. I tried to install it on a 8gb usb stick. Everything is working, but one thing...
The DNS-320 seems to chmod -R 777 * on any usb device with ext3 that I put in it. Very annoying behaviour. Any one know where to search? I found the usbmount script, but it only seems to do chmod -R a+w stuff, not a+rwx :-P
/Magnus
Offline
Hi,
did you find any more info on where the DNS calls chmod -R 777? I'd like to install funplug on a USB stick as well.
Offline
It's very annoying, I'd love if this could be fixed.
Offline
The bootlog suggests that the rootfs is a ramdisk. If that is true, you can exchange chmod by a script which logs it commandline, and its PPID, and the commandline of the parent, and the PPPID, and...
This might tell where and how it's called.
A work around to be able to put FFP on an USB stick could be the usage of a loop device on a big file on the stick.
Offline
The bootlog suggests that the rootfs is a ramdisk. If that is true, you can exchange chmod by a script which logs it commandline, and its PPID, and the commandline of the parent, and the PPPID, and...
This might tell where and how it's called.
Not a bad idea, I'll give it a try later today.
Although this'll only work if the commandline tool 'chmod' is called. If a binary tool uses a syscall, the script won't help.
Last edited by KyleK (2011-09-22 15:09:12)
Offline
KyleK wrote:
If a binary tool uses a syscall, the script won't help.
Well, at least then you know it's not a script which does the ugly work.
Offline
I just connected my ext2-formatted USB-drive to my new (funplugged) DNS-320. It was auto-mounted and started with a lot of activity. When I checked with ps-command I saw "19972 root chmod 777 -R /mnt/USB/HD_c1". I killed it immediate. So I think it's the normal chmod-command, triggered by an automount. Not sure if it's the funplug-version or the original.
I don't like this, all the stuff I copy from USB to the NAS is completely open to everybody.
I don't understand why. A bug?
I wonder this this will also happen if I connect the USB before powering on (is mounting done by funplug of DNS-automount? With funplug I can do a r/o-mount.)
Last edited by bertgr (2011-10-16 21:30:32)
Offline
Ok, I did some digging.
First attempt was to intercept any calls to "chmod" to see who's actually doing the chmodding:
CALLER: 0 init ---> 1 /ffp/bin/bash /bin/chmod 777 -R /mnt/USB/HD_c1
That's not much help
But, I think I still found the culprit: /usr/local/modules/scripts/usbmount (shell-script) calls /usr/local/modules/sbin/usb_disk (binary). And that binary contains the string "chmod 777 -R 777 %s/%s/%s". Bam!
Now my problem is, since /usr/local/modules is mounted ro, I can neither change the script nor hex-patch the binary.
Any ideas how to obtain this?
Offline
You can bindmount a writable directory on /usr/local/modules/sbin/, containing a patched usb_disk. Or you could do the same with /usr/local/modules/scripts/, and change usbmount to export a PATH which forces another chmod to run.
/Edit: Or, if /bin is writable, you could exchange chmod by a script which filters on exact this string, and else passes it to busybox.
Last edited by Mijzelf (2011-10-16 22:18:57)
Offline
Hey guys,
I've been running funplug from a (ext2) USB stick for a couple of weeks now, and finally had some time to create a little package for everyone to use.
I followed Mijzelfs suggestions to replace /bin/chmod with a custom script that blocks that one particular command that causes so much trouble.
You can get the package here: dns325-chmod-fix-0.1-1.tgz
This script should work with ffp-0.5 and ffp-0.7.
So, what does it do?
The package contains 2 script files, chmod_usb.sh and dns325-fix-chmod.sh. The first is the replacement for /bin/chmod, the second does the dirty work to replace /bin/chmod with a symlink to chmod_usb.sh.
All this is done automatically when you install the script (via funpkg -i dns325-chmod-fix-0.1-1.tgz).
The 2 scripts are copied to /usr/local/config. Also, the file rc.init.sh residing in that folder is modified so that it calls dns325-fix-chmod.sh when you boot the NAS.
That script is perfect for the task, because it gets called right before the hotplug script takes action, and also before the NAS looks for fun_plug.
Anyway, let me know how it goes for you (this is my first package with a doinst.sh).
PS: For now, all calls to /bin/chmod are logged to /usr/local/config/chmod.log, and you can see here which calls are suppressed and which go through.
Edit: Fixed link.
Last edited by KyleK (2012-06-13 09:51:40)
Offline
KyleK, thank you!
I will try today evening and post some reply.
Gyngy
Offline
Hi KyleK,
your installation package works like a charm. Finally is my USB mounted as it should be - with permissions.
Thank you again!
Gyngy
Offline
Hi folks,
I recently purchased a DNS-345 and I tried to install the dns325-chmod-fix-0.1-1.tgz on the NAS but it didn't work.
I dug a bit deeper into the issue and found that the script rc.init.sh is never called during system start.
Here is the system start as I could identify it:
1) /etc/inittab
2) /etc/rc.sh
3) system_init
In the system_init script I can see the following lines :
echo "*** execute rc.init.sh" ip.sh booting
So, it appers as if the rc.init.sh call has been removed.
Hence the first non read-only script which is called during system start is the fun_plug script.
But at that point all auto-mounts are done with the wrong permissions.
Has anyone else recognized the same behaviour ?
One solution might be to store the permissions after install of the fun_plug stuff and restore them after the reboot usinng the fun_plug vehicle. This might work but it is not a smart solution.
Are there any plans for a custom firmware for the DNS-345 which fixes this 'chmod' nightmare ?
Offline
Depending on your goal you could avoid automounting. When the 345 supports loopdevices, you could let a filesystem start on an offset on a raw disk. It won't be automounted, but fun_plug can mount it.
Offline
Updated the link in my post, as the package was moved to a different folder. Thanks for catching this, bazzer!
Offline
@schluri: Are there no other scripts in /usr/local/config that might be executed before usbmount/funplug?
We might then be able to inject the code at a different position.
Offline
Hi,
i ran into a problem trying to run FFP on USB.
Followed shadowandy guide on http://www.shadowandy.net/2011/12/movin … to-usb.htm
however following all the steps..
except running into an error on Update it to suppress HD_c instead of HD_c1 by typing cat /usr/local/config/chmod_usb.sh | sed -e s/\/HD_c1\/\/HD_c\/ >> /usr/local/config/chmod_usb.sh
can't get it to run hence i forgot it knowing my mounting is hd_c1
followed all the way through..
and finally the error here.
/dev/sdc1: UUID="5ef5ce8f-cab0-4adc-9f54-cc320707d57a" TYPE="ext2"
Success. Found 5ef5ce8f-cab0-4adc-9f54-cc320707d57a.
* FFP was not found on a USB device. Reverting back to HDD-based FFP
Offline
Did you format the USB stick and put the fun_plug.tgz archive onto the stick?
Offline
KyleK wrote:
Did you format the USB stick and put the fun_plug.tgz archive onto the stick?
yes i did format the stick and did a copy instead.
following shadowandy guide.
Copy the current ffp folder to USB
We will be shifting the current ffp installation on your disk to the USB drive and it will take a while before the copy completes so sit back and enjoy a can of coke or a cup of Starbucks.
Copy the current ffp installation to USB by typing cp -a /mnt/HD/HD_a2/ffp /mnt/USB/HD_c1/
I did this.
I have double confirmed that my USB stick is ext2 format and have ffp folder inside.
Offline
Is your USB stick mounted to /mnt/USB/HD_c or /mnt/USB/HD_c1?
If the latter, then you need to modify the fun_plug script (put the correct path in the variable FFP_USB, right at the beginning of the file).
Offline
KyleK wrote:
Is your USB stick mounted to /mnt/USB/HD_c or /mnt/USB/HD_c1?
If the latter, then you need to modify the fun_plug script (put the correct path in the variable FFP_USB, right at the beginning of the file).
oh! i get it. let me try it now!
thank you so much!
I have just installed transmission. Do i need to move the file to the USB instead?
Offline
KyleK wrote:
Is your USB stick mounted to /mnt/USB/HD_c or /mnt/USB/HD_c1?
If the latter, then you need to modify the fun_plug script (put the correct path in the variable FFP_USB, right at the beginning of the file).
Awesome! got it to work.
/dev/sdc1: UUID="5ef5ce8f-cab0-4adc-9f54-cc320707d57a" TYPE="ext2"
Success. Found 5ef5ce8f-cab0-4adc-9f54-cc320707d57a.
* Found FFP on USB device
Offline