I use full HD installation to create basic computers for elderly, etc. out of older computers. I have discovered that EXT2 is very fussy, and will really mess itself up if shutdown improperly, but even EXT3 can self-destruct if shutdown improperly enough times with no intervention.

SO.......rather than just booting to a bash shell after an improper shutdown, I need to have it behave like Windows 98 and do an fsck -f -y and then reboot itself. Upon reboot, I believe it will automatically go to the xwin "wait 30 seconds or select ignore" screen, which is fine.

Sooooooo.......I know the commands IIRC:

fsck -f -y /dev/hda1
reboot

..................but where do I put them so they get run after an improper shutdown instead of just dumping to a # prompt?

Wow, what a wealth of information. I'm going to have a much more dependable puppy that I send to keep old people company. That's good, because the elderly don't exactly enjoy cleaning up digital crap......

And THIS is the beauty of OSS. Collectively, we can do so much more than M$ ever will. Just you wait, Bill! We're coming after your empire!

Well, I have achieved partial success. I have reengineered the startup and shutdown scripts with the help of the OSS Community so that now it will detect and automatically recover from the most common improper shutdowns (turning power off without selecting power off on the menu.) I will link the files I modified later.

I have NOT however succeeded in getting fsck to run in the startup script. If I put it between loading kernel modules and swap activation, fsck says the partition is mounted. If I add a umount first it gripes that's not possible and then fsck still says it's mounted. If I put it before "making filesystem usable" fsck says that it can't access the device, probably because /dev hasn't been properly populated yet.

While it seems very solid the way I have it, and booting from a CD and fsck-ing the hard drive found no serious errors after about a dozen nasty shutoffs, I would feel better if cleanup was being done along the way after an unclean shutdown. I have heard that ext3 checks itself at mount, but fsck said it had been mounted 24 times without an fsck. I tried the /forcefsck trick, which did nothing.

I read something about Barry disabling automatic fsck to improve boot times. How can I selectively re-enable it without (for example) adding one-time options to grub's menu.lst boot line and then yanking them back out?

I strongly recommend using these or an improved version of these with EXT3 if you are using Puppy as a full install for a non-computer-person (such as an elderly person) as they greatly reduce the amount of fiddling required to clean up after things we wish they wouldn't do.......or power loss, etc.

This was very educational, to say the least. Maybe one day I'll upload an improved Puppy Package Manager that makes uninstall archives with the files which would have otherwise been overwritten and then puts them back upon uninstall. That project needs to be tackled, and it sounds like fun. I have a feeling someone more sage will beat me to it, though.......

[EDIT] One other thing I've learned in screwing around with this Puppy-----when fsck warns that fsck-ing a mounted partition is dangerous, they're NOT KIDDING! I've completely destroyed 2 or 3 installations that way. The first couple of times I thought that they must have been severely damaged anyway, and would have self-destructed sooner or later without my intervention. The third time it dawned on me......I'll bet something happened in the background that caused fsck to royally screw up the FS.....because it could, because it was mounted! So from now on, as much as it pains me to wait for a CD bootup, I'll be doing all future fsck-ing from a liveCD.

On an unrelated quirky note, "fsck-ing" just looks kinda......ummmmm........wrong???

[EDIT AGAIN] I thought I should explain what these files do and what they're based on. This script is from the 4.1.2 RETRO kernel, so you might have to just find my insertions and put them in the appropriate places in your files. This version creates a flag file /tmp/RUNNING in the bootup process, then removes it during shutdown. If the file is PRESENT at bootup, then it knows that Puppy was not properly shut down, and performs a little file cleanup and reboots. This allows the services to all start correctly after the automatic reboot and X will also start with just the warning screen, rather than dumping to a bash prompt and waiting for startx. This version does NOT perform fsck on the hard drive; the version below does.

earlier ....basically to make the partition device visable....as long as the check is whilst / is read only..it was a case of trial and error but definately done in rc.sysinit....teach me to keep notes.

The reason puppy does not fsck everytime is that with a frugal install there is no way (as far as I know) to unmount dev_save cos its in the union....so there would be a full check forced every boot. With a clean partition it only takes a fraction of a second.

OK, then! Thanks to Mr. mikeb, I now have it exactly as I want it. I struggled briefly with creating a flag that rc.sysinit could see so early in the boot process, but putting it in / worked. Initially I tried to put it in /tmp to be tidy, as I did with RUNNING (I thought it looks messy in /) but it was not visible in /tmp at that point in the script. That's OK, as messy is not significant, since that flag only exists between the time of first phase cleanup and reboot to fsck and reload properly. The only way someone would ever see the flag file /fsckme would be to boot from a liveCD on the reboot and look at the hard drive. NOT something that most people will be doing. It'll be fine.

So.....here's the updated scripts. I really like these, and I highly recommend them for full HD installs. I see a few of you downloaded my original ones, but trust me, these are BETTER.

On a side note, I found a bug in PupZip........it added the one script to the file listing twice......

[EDIT] Need to clarify again what this file is. This is the version that DOES perform fsck on the hard drive after an improper shutdown. Remember, this is from a RETRO kernel, so if you are using a newer one you will have to change the e2fsck line to reflect the correct nomenclature for your hard drive. Also, if your Puppy is not installed on the first partition, likewise, changing the nomenclature will be necessary. I don't see anything risky about what I've added; if you don't fix it right, it just won't work.

I forgot about hidden files, so yes, that would be possible, but like I said, that flag file only exists during the reboot to finish the cleanup........so no end user (in my case) would ever see it anyway.

Yes, your memory was good. I added the creation of a flag file /fsckme after removing the temporary files but before the reboot, and added an if trigger that notices /fsckme and runs e2fsck on the hard drive if it exists. There's another if trigger deeper into the boot cycle that removes the /fsckme flag afterward. This if trigger is after the reboot in the initial cleanup if trigger, so it doesn't get removed if it is needed.

I wouldn't know how to add this to the HOWTO section, but maybe I can figure it out. Just this discussion in the forums will help a great deal. If I were looking to do this and someone else had had this discussion first, I'm sure I'd have found this, with tips and theoretically ready-to-implement files. (Although, I did just think of a few disclaimers I should put with my files above......)

Thinking about this now, I should state that it is theoretically possible to do this in one pass without a reboot, but I think with a reboot is best because that cleans up the files, flags for fsck, reboots, fscks, and then boots normally. I could move the RUNNING flag file back out of the /tmp folder and make the fsck if trigger look for that as well, which would eliminate the need for a reboot........but that wouldn't fix the fact that a reboot is still required after an improper shutdown to restore proper USB function, and I think something else as well, so rebooting is best. This automates the whole process of recovering from an improper shutdown, rather than leaving my non-computer-literate end-users wondering why their printer doesn't work anymore............rather than wasting their time and mine figuring out that they need to reboot again to finish the cleanup, it's best to just let Puppy take care of it.

Nice one.....just post in the HOW TO section...title of what its for ,summerise its function, include files and instructions to implement. Another reason is that a post like this includes the learning bit that can be confusing to a user.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum