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 done a solution which will shutdown and umount the filesystem correctly.
I've found that the DNS-323 box do call the script /usr/sbin/raidstop at shutdown.
I've attached a patch (raidstop.patch) which will modilfy the raidstop shell script to umount the /dev/md0 device correctly.
How to (tested with firmware version 1.05):
1. Login to your box via e.g. via telnet.
2. Copy the patch to the mount point on your box (normally /mnt/HD_a2).
3. Modify your fun_plug script and add the following lines on your dlink box:
cd /usr/sbin patch -p0 < /mnt/HD_a2/raidstop.patch chmod +x raidstop
4. Check if the filesystem is clean. If not umount /mnt/HD_a2 and do a filesystem check (e2fsck).
5. Reboot your box, after the reboot the file /usr/sbin/raidstop will be patched.
Thats all.
I've never seen ext2 filesystem warnings after patching anymore after shutdown over the front button or the Web UI
Bye
André
Last edited by aeronet (2008-11-10 10:00:24)
Offline
Is this patch instead of using cleanboot?
Do this patch work even if your not using RAID on your dns 323?
Offline
Eskas wrote:
Is this patch instead of using cleanboot?
Yes, correct you don't need cleanboot for using this patch.
Eskas wrote:
Do this patch work even if your not using RAID on your dns 323?
Yes, I think the patch is also working without any RAID configured.
The patch call only the fuser command with the /mnt/HD_a2 mount point and kill all processes which are attached to the filesystem.
After the fuser command is done, a final umount of /mnt/HD_a2 will be called.
The patch is only a three liner, no black magic
Offline
forgive the newbie question, but why umount /dev/HD_a2 and not /dev/md0 ?
Offline
luusac wrote:
forgive the newbie question, but why umount /dev/HD_a2 and not /dev/md0 ?
You meen /mnt/HD_a2
OK, it makes no difference if you umount /dev/md0 or the mount point /mnt/HD_a2 in this case, because it is an entry in the mtab file with a mapping which tells the system that /dev/md0 is mounted to /mnt/HD_a2.
Offline
Hi,
I have do some modification of my small patch.
Look at the attachment.
It's now a little bit longer as a three liner
Greetings
André
Offline
I get this in the log with your latest version, is that ok?
patch: No such file or directory
chmod: raidstop: Read-only file system
Offline
knireis wrote:
I get this in the log with your latest version, is that ok?
patch: No such file or directory
chmod: raidstop: Read-only file system
No, which messages are not OK.
Can you login via telnet on your box, and try to enter the following command:
busybox patch
If the busybox patch command work add the busybox word to the patch command in your fun_plug script.
I forgot to say, that I have done some modifications of the busybox on my dlink box.
Can you also check if your RAM disk mounted to / is writable on your dlink box.
Offline
aeronet wrote:
patch: No such file or directory
Patch went here:
http://www.inreto.de/dns323/fun-plug/0. … html#patch
Offline
I installed patch with funpkg, but log shows the same.
And the busybox patch returns following:
root@CH3SNAS:~# busybox patch
patch: applet not found
By the way i run a CH3SNAS
Offline
knireis wrote:
I installed patch with funpkg, but log shows the same.
And the busybox patch returns following:
root@CH3SNAS:~# busybox patch
patch: applet not found
By the way i run a CH3SNAS
Hm, I have no experience with the CH3SNAS. But I meen you can add the `patch' command to your
CH3SNAS box. But I don't know if the raidstop shell script exist on the CH3SNAS in the /usr/sbin path and
if the CH3SNAS box use the same procedure as the DLINK DNS-323 box for shutdown.
Offline
The raidstop script on the CH3SNAS is version 1.09 (09/26/2006) by Wilson Chan.
Offline
RunaR wrote:
The raidstop script on the CH3SNAS is version 1.09 (09/26/2006) by Wilson Chan.
My version of the raidstop script is the same (md5 checksum c91e1f2a5eada6ab9d7a4cba11d909bc).
I've using a additional version of busybox with command `patch' included.
To easily use all of these additional commands, I've created a lot of symlinks to busybox3 on startup.
(e.g. /bin/patch -> /mnt/HD_a2/lnx_bin/busybox3 and so on)
# busybox3 BusyBox v1.2.1 (2006.10.30-10:27+0000) multi-call binary Usage: busybox [function] [arguments]... or: [function] [arguments]... BusyBox is a multi-call binary that combines many common Unix utilities into a single executable. Most people will create a link to busybox for each function they wish to use and BusyBox will act like whatever it was invoked as! Currently defined functions: [, [[, adjtimex, ar, ash, awk, basename, bbconfig, bunzip2, busybox, bzcat, cal, cat, catv, chattr, chgrp, chmod, chown, chroot, chvt, cksum, clear, cmp, comm, cp, cpio, crond, crontab, cut, date, dc, dd, deallocvt, devfsd, df, diff, dirname, dmesg, dos2unix, dpkg, dpkg-deb, du, dumpkmap, e2fsck, echo, ed, egrep, eject, env, expr, false, fbset, fdflush, fdformat, fdisk, fgrep, find, fold, free, freeramdisk, fsck, fsck.ext2, fsck.ext3, fsck.minix, ftpget, ftpput, fuser, getopt, grep, gunzip, gzip, halt, hdparm, head, hexdump, hostid, hostname, hwclock, id, insmod, install, ipcrm, ipcs, kill, last, length, less, linux32, linux64, ln, loadfont, loadkmap, login, logname, losetup, ls, lsattr, lsmod, makedevs, md5sum, mdev, mesg, mkdir, mke2fs, mkfifo, mkfs.ext2, mkfs.ext3, mkfs.minix, mknod, mkswap, modprobe, more, mount, mountpoint, mt, mv, nc, netstat, nice, nohup, nslookup, od, openvt, passwd, patch, pidof, ping, pivot_root, poweroff, printenv, printf, ps, pwd, rdate, readprofile, realpath, reboot, renice, reset, rm, rmdir, rmmod, route, runlevel, rx, sed, seq, setarch, setconsole, setkeycodes, setlogcons, setsid, sh, sha1sum, sleep, sort, start-stop-da emon, stat, strings, stty, su, sum, swapoff, swapon, switch_root, sync, sysctl, tail, tar, tee, telnet, telnetd, test, time, top, touch, tr, traceroute, true, tty, tune2fs, umount, uname, uncompress, uniq, unix2dos, unzip, uptime, usleep, uudecode, uuencode, vi, watch, watchdog, wc, who, whoami, xargs, yes, zcat
HTH,
André
Last edited by aeronet (2008-11-10 10:01:47)
Offline
I don't have the patch command in the defined functions, how do i define it?
Offline
by either installing it (see above post from fonz) or by using a later version of busybox with it in. If I remember correctly ffp 0.5 comes with busybox v1.10.1 which includes patch. You may already have a later version of busybox, in which case you would just need to replace the symlink so when you call patch it calls the correct busybox.
Offline
luusac wrote:
by either installing it (see above post from fonz) or by using a later version of busybox with it in. If I remember correctly ffp 0.5 comes with busybox v1.10.1 which includes patch. You may already have a later version of busybox, in which case you would just need to replace the symlink so when you call patch it calls the correct busybox.
Well, as you see i'm a bit lost. I googled aroun dfor symlink and busybox, but i don't know what to do. I installed the latest patch.tgz and busybox.tgz from Fonz site, but there is still no patch listed in the defined functions.
Offline
knireis wrote:
luusac wrote:
by either installing it (see above post from fonz) or by using a later version of busybox with it in. If I remember correctly ffp 0.5 comes with busybox v1.10.1 which includes patch. You may already have a later version of busybox, in which case you would just need to replace the symlink so when you call patch it calls the correct busybox.
Well, as you see i'm a bit lost. I googled aroun dfor symlink and busybox, but i don't know what to do. I installed the latest patch.tgz and busybox.tgz from Fonz site, but there is still no patch listed in the defined functions.
I've installed the busybox included in the package utelnet-kit.tar.gz found here http://dns323.kood.org/howto:telnet
Offline
knireis wrote:
Well, as you see i'm a bit lost. I googled aroun dfor symlink and busybox, but i don't know what to do. I installed the latest patch.tgz and busybox.tgz from Fonz site, but there is still no patch listed in the defined functions.
Just use patch, it's a separate program, ignore busybox. Use it as in the original instructions.
Offline
fonz wrote:
knireis wrote:
Well, as you see i'm a bit lost. I googled aroun dfor symlink and busybox, but i don't know what to do. I installed the latest patch.tgz and busybox.tgz from Fonz site, but there is still no patch listed in the defined functions.
Just use patch, it's a separate program, ignore busybox. Use it as in the original instructions.
Yes, of course. You can also simply get and use `patch' itself.
Last edited by aeronet (2008-11-05 11:42:02)
Offline
Sorry, I don't understand anymore. I installed latest patch and busybox versions from Fonz, followed instructions in the first post, but still get following
patch: No such file or directory
chmod: raidstop: Read-only file system
in the log. What do i do wrong?
Last edited by knireis (2008-11-05 13:43:44)
Offline
It sounds like now you will have several versions of patch/busybox on your box. Not that this is a problem, you just need to know how to actually call the one that you want. Stick with the seperate patch as per Fonz's post. What is the output of
which patch
also, are you sure that raidstop.patch is in the root of Volume_1 (do you see it listed when you telenet and type "ls /mnt/HD_a2"). This assumes that the ch3nas is laid out the same way as the dns323 (I think that it is, but have no way of checking as I only have a 323).
Offline
If you don't find the `patch' command or the right busybox for your CH3NAS box
you can also simply add the lines of the raidstop.patch (without the plus signs) directly on the top of the
raidstop script after #!/bin/sh and add a simple copy operation to your fun_plug script:
1. cp -a /usr/sbin/raidstop /mnt/HD_a2/raidstop
2. Add the following lines from the raidstop.patch to the /mnt/HD_a2/raidstop script after the first line:
mp=`grep "/dev/md0" /etc/mtab | awk '{ print $2 }'` if [ "$mp" ]; then # Try to kill all processes for a in 0 0 0 0 0 0 0 0 0 0; do kill -9 `fuser -m $mp` > /dev/null 2>&1 umount $mp > /dev/null 2>&1 sleep 1 if ! grep "$mp" /etc/mtab > /dev/null 2>&1; then a=1; break; fi done if [ $a -eq 0 ]; then # If nothing helps, do a lazy umount umount -l $mp > /dev/null 2>&1 fi fi
3. Add these line to your /mnt/HD_a2/fun_plug script:
cp -a /mnt/HD_a2/raidstop /usr/sbin
But I think this will also not work on your CH3NAS box because
this message "chmod: raidstop: Read-only file system" tell me that the root filesystem
mounted on / (on the DNS-323 is the root fs a RAM disk and rw mounted) is read-only and you can't modify it.
You can check if the root filesystem is read-only mounted by typing simply the command `mount'.
Thats all
Last edited by aeronet (2008-11-10 10:01:16)
Offline
I guess it is not going to work then, your instructions give the expected result:
cp: unable to open `/usr/sbin/raidstop': Read-only file system
patch: No such file or directory
chmod: raidstop: Read-only file system
Thanks anyway
Offline
I have a CH3SNAS too. On the CH3SNAS the directory /usr/sbin is read-only and it can not be modified. The directory /usr/sbin is a link to /sys/crfs/sbin
And /sys/crfs is squashfs (squashfs is a compressed read-only filesystem for Linux).
You can work around this read-only behaviour of /usr/sbin by creating a copy of /sys/crfs/sbin and link the directory /usr/sbin to this copy.
Offline
aeronet wrote:
Eskas wrote:
Do this patch work even if your not using RAID on your dns 323?
Yes, I think the patch is also working without any RAID configured.
The patch call only the fuser command with the /mnt/HD_a2 mount point and kill all processes which are attached to the filesystem.
After the fuser command is done, a final umount of /mnt/HD_a2 will be called.
I'm not sure if raidstop is called without any RAID configured. However, even if it is, the patch will have to be modified to work on a box without raid. In this circumstance, there is no "/dev/md0" in /etc/mtab - at least not on a DNS-323 (FW 1.05).
/ # grep "/dev/md0" /etc/mtab / # cat /etc/mtab %root% / unknown rw 0 0 proc /proc proc rw 0 0 /image.cfs /sys/crfs cramfs rw,loop=/dev/loop0 0 0 /dev/sda2 /mnt/HD_a2 ext2 rw,usrquota,grpquota 0 0 /dev/sdb2 /mnt/HD_b2 ext2 rw,usrquota,grpquota 0 0 /dev/sda4 /mnt/HD_a4 ext2 rw 0 0 /dev/sdb4 /mnt/HD_b4 ext2 rw 0 0 none /proc/bus/usb usbfs rw 0 0 /dev/sdc1 /mnt/usb1 ext2 rw 0 0
If raidstop is called (I don't have time now to try), the patch could be rewritten to grep for "/dev/sd/" and then loop (instead of a single if statement) through all the filesystems found and run the unmount procedure on each of them.
Cheers,
Dave
Offline