Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
I apologize if this is covered elsewhere, I searched and couldn't find anything that matched well. Pieces of this are discussed elsewhere, but not the mechanism I'm trying to use. "cleanboot" tries to address a similar problem, but in a completely different way. Also, I tried using it and it took me 90 minutes to figure out how to get back into my system.
I'd like to have a maintenance run level where only the root partition is mounted. Obviously, I cannot boot directly into this level without changing the firmware, but I should be able to get there from the default run level.
I'd also like to have the disks unmounted cleanly on shutdown.
In a standard system, this is all handled through the inittab and associated scripts.
The system that ships with the DNS-323 and DNS-321 seems to shutdown in a relatively nonstandard way. The disks do not seem to be unmounted cleanly and there is no way of getting into a "maintenance" or "single user" run-level. Both ffp and optware seem to know how to shut themselves down, but there seems to be no way of getting that called from inittab.
I wrote an /etc/rc.maintenance and /etc/rc.halt script and tried to put them into inittab.
ha:0:wait:/etc/rc.halt
ma:1:wait:/etc/rc.maintenance
halt shuts down the ffp services using /ffp/etc/rc stop, shuts down the smb services using smb stop and then attempts to unmount all of the partitions.
rc.maintenance copies utelnetd onto the / file system, shuts down the ffp services, starts utelnetd, shuts down the smb services and unmounts the drives. I've created a user, toor with uid=0 but shell /bin/sh. I can telnet in as toor to do maintenance.
Once I solved the problem of the ffp.log file being open, and copied the scripts into /etc, they seem to work if I call them manually.
So far so good. The next step is where I'm stuck.
In theory, I should be able to say something like:
init -q
init 1
My existing telnet or ssh session should die, but when I log in as toor, I should be in something that looks close enough to single user mode.
"/bin/init -q" does not report an error.
"/bin/init 1" does not work.
reboot and poweroff don't seem to get rc.halt called either.
Has anyone tried something similar?
Is this known to be impossible?
Does anyone have information on how runlevels in the DNS-323 1.06FW kernel or the DNS-321 1.0FW kernel are configured?
Does anyone know what reboot and poweroff actually do?
Any help would be appreciated.
Offline
talkingRock wrote:
I'd like to have a maintenance run level where only the root partition is mounted. Obviously, I cannot boot directly into this level without changing the firmware, but I should be able to get there from the default run level.
The firmware doesn't use runlevels. I know of basically two approaches to get into 'maintenance mode':
1. copy tools to the ramdisk, kill unneeded stuff, and unmount the disks (e.g. http://dns323.kood.org/forum/viewtopic. … 620#p18620 )
2. boot into a maintenance ramdisk (e.g. http://www.inreto.de/dns323/fsck/ for dns323 A1 models)
More info on how firmware shutdown/poweroff works: http://dns323.kood.org/forum/viewtopic. … 2236#p2236
PS: Well, there's of course a third method (there's always three): http://dns323.kood.org/forum/viewtopic. … 665#p20665
Last edited by fonz (2009-04-15 23:34:23)
Offline
It sounds like I've got a manually activated, very light-weight version of (1).
I should probably tar it all up and post it if I get it working the way I want it to.
I think the main difference between what I'm doing and what's been done before is how lightweight I'd like it to be.
I really like your idea of mounting a second ramdisk full of system maintenance goodies in this mode. I will look at that thread in more depth. Presumably you could have versions of e2fsck, parted, hdparm, smartctl, ...,
It keeps everything nicely independent.
What about the issue of getting a clean shutdown?
I am running ffp off of /mnt/HD_a4 and putting ffp.log there. This is mainly a backup box, so I'm running rsnapshot from there as well. I can manually get /dev/sda2 and /dev/sdb2 unmounted most of the time, but I'd love to have a way to do it automatically, or even better yet have it happen when I push the power button.
Does init -q actually work? For example, if I put a respawn for the utelnetd into the inittab as a failsafe and ran init -q, should it work?
Also, do you know if there are any disadvantages of utelnetd compared to the telnetd in ffp? Right now, I copy utelnetd to /sbin, build ttys and start utelnetd directly from fun_plug. This makes it easier to get into maintenance mode.
Offline
I read those threads.
So is chkbutton the thing that ultimately processes all shutdowns, including the front button? If so, it looks like your posts indicate that /etc/hotplug/sataumount could be my hook to get something done near the end of that process and make sure that I get a clean shutdown. The only other option would be recompiling chkbutton with a hook?
Offline
I had some time to play around with this last night and had a few observations.
I am not running raid, but I do not believe that /etc/hotplug/sataumount is being called. I modified the script to put an "IWASHERE" bread crumb on the /dev/sda4 on entry. I did not see the bread crumb after shutdown.
Has anyone verified that /etc/hotplug/sataumount is run in the v1.06 firmware?
The other observation I had was as follows:
For most maintenance operations, it's sufficient to have file systems mounted read-only, not fully unmounted. I can have my maintenance mode and have access to ffp by using this trick.
My ffp root is on /dev/sda4 and my data are on /dev/sda2 and /dev/sdb2. If I unmount /dev/sda2, /dev/sdb2, /dev/sdb4 and remount /dev/sda4 read only, I should have the beginning of a good maintenance mode.
Does this make sense as an alternative to creating a second ramdisk?
Offline
talkingRock wrote:
Does this make sense as an alternative to creating a second ramdisk?
Sure, but there may be problems when e2fsck corrects errors on the (ro-)mounted disk.
Regarding chkbutton, you can try gdb/objdump/strings to look inside and find out yourself.
Offline
Thanks for the response.
Once the fsck for that partition finishes, I could unmount and remount to fix that.
I used strings on chkbutton and the string is still there.
I would probably have to gdb my way through it to figure out when it gets called. Presumably, there is no source code available for chkbutton since it is d-link code?
Offline