Make Puppy recover automatically from improper shutdowns

How to do things, solutions, recipes, tutorials
Message
Author
gcmartin

Make Puppy recover automatically from improper shutdowns

#41 Post by gcmartin »

@SilverPuppy

This Looks a very useful and thought thru effort.

My question is what are the implication of my using Puppy on a system that has multiple partitions on it....particularly since much of the data that use is on Linux and Microsoft partitions?

Is your process ONLY applicable to the "Puppy" partition or is it applicable to all mounted partitions that were in the running when power was lost?

Thanks in advance

User avatar
SilverPuppy
Posts: 143
Joined: Fri 29 May 2009, 02:21

Re: You pm-ed me.....

#42 Post by SilverPuppy »

enhu wrote:
SilverPuppy wrote:
rameshiyer wrote:I am using 4.3.1 full installation with Ext4 ( dual boot). I am not able to boot after power loss or improper shutdown. Kindly provide solution or pet package to install so that I can reboot my puppy with reinstall the same. I have read your postings int his regard, however, I am not able to follow the postings. Kindly help me in this regard.
Well, if you can't boot, then your first course of action is to boot from a LiveCD and run fsck on the partition that Puppy lives on (probably sda2 in your case, but do verify this)

Once you get things running again, check out my original post for new files I just made yesterday for 4.3.1----they work the same as the ones for 4.1.2, (drop-in to /etc/rc.d, then change the line in rc.sysinit that says "fsck /dev/sda1" to reflect whatever the partition Puppy lives on is called, then reboot) with one additional caveat: the TIME ZONE MUST BE SET TO GREENWICH, or fsck reports that the superblock last write time is in the future, and won't run automatically (might only apply for the first few hours after installation, come to think of it.)

Anybody want to comment on the superblock/Greenwich issue? Thinking about it now, I guess it shouldn't matter in general, only for the first few hours after installation, as IIRC the superblock is not written to otherwise.....or am I mistaken?

it didn't work. even after installing it back and setting it to greenwich.
2 things.

1. I was mistaken on the way the superblock works, and the time will have to be set to GMT until one of us figures out a workaround.

2. You have to change the e2fsck line in the rc.sysinit file to have the correct name of the Puppy partition. Otherwise it won't work. Also, if you are not using EXT2 or EXT3, substitute the appropriate command for e2fsck. A lot of people have forgotten this, it seems.

User avatar
SilverPuppy
Posts: 143
Joined: Fri 29 May 2009, 02:21

Re: Make Puppy recover automatically from improper shutdowns

#43 Post by SilverPuppy »

gcmartin wrote:@SilverPuppy

This Looks a very useful and thought thru effort.

My question is what are the implication of my using Puppy on a system that has multiple partitions on it....particularly since much of the data that use is on Linux and Microsoft partitions?

Is your process ONLY applicable to the "Puppy" partition or is it applicable to all mounted partitions that were in the running when power was lost?

Thanks in advance
By default, the only partition that would be checked is the Puppy partition, but the answer to that question depends a bit on what software is included on your system.

I am pretty certain that by default, Puppy does not have a utility installed capable of checking/repairing NTFS filesystems, and I'm not totally sure that such a utility exists, as NTFS is proprietary.

That said, it is possible to add lines to the rc.sysinit file to check other partitions at the same point in the process. Just add them immediately under the e2fsck line that checks the Puppy partition.

I am pretty sure that you can check FAT32 partitions from within Puppy, and it would just be a matter of inserting the correct command line after the e2fsck line. I don't recall offhand what that is.

If you can find a command-line Linux utility to check NTFS partitions, it should be possible to achieve the functionality you seek.

Hope that helps you.

sindi
Posts: 1087
Joined: Sun 16 Aug 2009, 13:30
Location: Ann Arbor MI USA

Puppy 4.3.1 frugal ext2 ROX-filer error on improper shutdown

#44 Post by sindi »

HP Pavilion 84802, circa 1999, 450MHz, 256MB RAM. HSF1 modem
(combo with riptide sound). Onboard video okay with Xorg
(and I think Xvesa - unload ctmouse first).

puppy 4.3.1 oldest retro kernel, files in /dev/hda2
ext2. Puppy is loaded using loadlin from /dev/hda1 (FAT32,
used for 100 old DOS games, boot to DOS then choose games
or Puppy Linux).

loadlin vmlinuz initrd=initrd.gz ro nosmp

On first use, the 11-year-old user turned it off without
shutting down.
They returned it (via bus - huge computer).
During boot, pages of udevd-event error messages.
After booting, dialog box with error (may not be exact).

Error :
root/Choices/ROX-filer?
Pinboard PuppyPin:
Input/Output error

None of this showed up in a forum search.
Home icon. No trash or lock or other icons. Menu is
there. The owner wants the icons back.

fd0 hda1 hda2 piled on top of each other in lower left,
refuse to be separated.

e2fsck did not help (from Basiclinux 3.5 floppy disk).

Works if booted pfix=ram (ignore save file).
Since this computer is only for internet access and school
work, one possible fix is a small DOS batch file called
'fixit' which would recopy both the .sfs and the save
file from a backup location, on top of originals in FAT2
partition. Since e2fsck did not fix the
problem, would ext3 help anyinstead of the above fix?

Is there some way to fix the ROXfiler problem rather than
delete the save file? They can wait a few days for a
better solution.

sindi
Posts: 1087
Joined: Sun 16 Aug 2009, 13:30
Location: Ann Arbor MI USA

Puppy 4.3.1 frugal lost icons on improper shutdown

#45 Post by sindi »

I was able to mount -o loop pupsave.2fs. It is ext2.
e2fsck -y /initrd/mnt/dev_save/puppy431/pupsave.2fs fixed the problem.

Should I also e2fsck /dev/hda2 at startup? That was apparently required for the full install. In my case Puppy boots to X (Xvesa) but most of the icons are missing (see previous message).

How do I run it at startup? I put it in rc.sysinit before the first occurrence of pinboard (since I got a pinboard error otherwise). How do I know
if it is actually running? It was not in dmesg, and there is still the complaint about needing to run e2fsck.

User avatar
SilverPuppy
Posts: 143
Joined: Fri 29 May 2009, 02:21

Why not full installation, people?

#46 Post by SilverPuppy »

I do understand the portable environment benefits of Puppy, but that said, why wouldn't you just do a full install on a small partition in this situation? Then you can use my files and have recovery fully automated, and everything wonderful!

Not only can it automatically fix the problems idiots introduce by dumping computers in a heap instead of turning them off nicely, but you also experience the following benefits running full vs. frugal:

1. The SFS system uses RAM, as everything else does. Running off a LiveCD I've observed as much as 17MB of additional RAM usage compared to a full install.

2. The SFS decompression takes up a significant amount of CPU time on low-powered computers. Running full installations removes this load as well.

I would recommend using EXT3 when you do, as the journaling makes it easier for fsck to fix things, but that's just a fringe benefit. :D

sindi
Posts: 1087
Joined: Sun 16 Aug 2009, 13:30
Location: Ann Arbor MI USA

Fixed inode count problem Puppy 4.31 frugal

#47 Post by sindi »

I kept running e2fsck on pupsave.2fs and new errors kept developing. Copied the files from one 2 GB hard disk without UDMA support to a slightly newer one with UDMA support which runs twice as fast. No more errors. Normally frugal install can recover from improper shutdown. I had too many unfixable crashes with full install that e2fsck could not fix.

Only the pupsave.2fs file ever got the bad inodes so I ignored it and started fresh. DOS works okay on that drive. Puppy works on a 400MB drive without UDMA.

With 256MB RAM, I don't worry about losing 17MB of it. Puppy does run faster from memory than from hard disk on older computers (at 300MHz it was up to 5 sec between click and program appearing on screen). The full install appears not to load into RAM.

DarinB
Posts: 24
Joined: Wed 30 Dec 2009, 19:44

#48 Post by DarinB »

I am using a full install. of 431 please explain how to use your files. i had a couple of bad shut downs but after typing reboot it came back, i am a newbie to this and don't know if i am using ext 2 or ext 3 and if that matters. Since this is an old p3 256mb ram lap top with a dead motherboard bat and pc bat i use the power cord that sometime falls off. BUT with pup this thing is really fast and i love it.

nassausky
Posts: 26
Joined: Sun 08 Jun 2008, 03:59

#49 Post by nassausky »

This thread has been very interesting. Thanks for the interesting scripts you pieced together. I actually had a problem this sunday. I was running terminal in a secure session and decided to reboot puppy 4.31 by using the 'reboot' command. Waited a while and never regained ssh control of the puppy linux box remotely. Showed up at the client and it was stuck at the root prompt #. The USB Keyboard wasn't working. Wound up reinstalling Puppy 4.31. It happened again this afternoon. I thought it was a rare situation until I typed 'reboot' again and it seems that it doesn't cleanly reboot the computer. Anyhow my question is if I plug in a PS/2 keyboard and I have access to the root prompt. Can I just install the 4.31 files into the /etc/rc.d folder and change their permissions and run it after whatever damage was done to the file system or is it too late already and should I reinstall puppy again for the 2nd time.

User avatar
pri
Posts: 342
Joined: Fri 09 Oct 2009, 18:31
Location: Bandung Indonesia
Contact:

#50 Post by pri »

SilverPuppy :
the script is work on 4.3.1, but there is a new problem. i must set up mouse every boot.
Learning by Doing

nassausky
Posts: 26
Joined: Sun 08 Jun 2008, 03:59

#51 Post by nassausky »

So far one test run of the script on a virtualbox machine with Puppy 4.31 the script didn't restart the GUI. It was able to sense the irregular shutdown and rebooted a 2nd time and ran a file check but then it returned to the root prompt#

tmay
Posts: 3
Joined: Sat 06 Feb 2010, 00:09

#52 Post by tmay »

Hello all this is my first post on this site. I have found your topic to be very interresting and have attempted to follow along. but have been unsuccessful. I have a old gateway 700c that i have been fixing for my daughter and would really like to get this to work. any help would be appreciated. I have backed my original files and have even altered them to match yours silverpuppy. but am unable to boot off hard drive. I am using puppy 4.3.1. thanks in advance

nassausky
Posts: 26
Joined: Sun 08 Jun 2008, 03:59

#53 Post by nassausky »

Just a note again for newcomers... This is for a Full Install not a Frugal Install and the scripts have to be chmod 755 to get them to execute. It seems on my test runs it's sporatic and works some of the time. Has anyone tested it a few times?

User avatar
pri
Posts: 342
Joined: Fri 09 Oct 2009, 18:31
Location: Bandung Indonesia
Contact:

#54 Post by pri »

i tested, but have problem always ask seting mouse every boot.
Learning by Doing

User avatar
SilverPuppy
Posts: 143
Joined: Fri 29 May 2009, 02:21

Sounds like a classic case of.....

#55 Post by SilverPuppy »

OOPS! :D

I think your mouse problem is that you picked the wrong rc set. If you put the 4.1 set with 4.3, there's no telling what will happen. At the least, it will act more like 4.1.

As for working intermittently, I have never had problems with that. Properly configured, this works every time. I have dumped test machines several times, and they always recovered to a happy X.

That said, my test machines were all real.....I have no idea what will happen in a virtual machine. Use at your own risk there.

Tmay who can't boot: did you load grub properly? Did it boot before you changed the files out? Did you use the correct set of files? You'll have to be MUCH more specific about the behavior you're getting if we're to be able to help.

Nassausky, I have noticed that if you type reboot in a terminal on Puppy, it will throw a fit. I've only ever tried it in a local RXVT, but I'd imagine that it might do the same thing when you're logged in with telnet-ish (I presume that's what you did, sorry, I'm still rather addicted to doze....) ....I'd presume that you can just dump the files in and boot it for repair, but do note that you'll have to do 2 things: verify that the partition matches in the e2fsck line, and create a file called /tmp/RUNNING (can be empty) so that it realizes that it was improperly shut down.

Hope that helps....believe it or not, I'm actually somewhat new to Linux, but I understand the way it thinks pretty well because of my childhood DOS and BASIC life. :lol:

User avatar
SilverPuppy
Posts: 143
Joined: Fri 29 May 2009, 02:21

Please review.....

#56 Post by SilverPuppy »

DarinB wrote:I am using a full install. of 431 please explain how to use your files. i had a couple of bad shut downs but after typing reboot it came back, i am a newbie to this and don't know if i am using ext 2 or ext 3 and if that matters. Since this is an old p3 256mb ram lap top with a dead motherboard bat and pc bat i use the power cord that sometime falls off. BUT with pup this thing is really fast and i love it.
EXT2 or EXT3 doesn't strictly matter, but in your situation I suggest EXT3 because the journaling makes it a bit more forgiving, albeit it does give you slightly less usable space and slightly worse write performance.

If you start at the top and read down, I think you'll understand deployment pretty well.

User avatar
SilverPuppy
Posts: 143
Joined: Fri 29 May 2009, 02:21

RAM it?

#57 Post by SilverPuppy »

sindi wrote:With 256MB RAM, I don't worry about losing 17MB of it. Puppy does run faster from memory than from hard disk on older computers (at 300MHz it was up to 5 sec between click and program appearing on screen). The full install appears not to load into RAM.
You're right, it doesn't. I prefer that behavior. I don't see the sense either of storing the entire OS and the core apps in RAM all the time, or of constantly compressing and decompressing stuff to make that possible. It does slow things down, and very noticeably on old original Pentium machines that are a bit more CPU-cycle starved.

But to each their own. That's Linux for you! :D

nav2k4
Posts: 1
Joined: Fri 12 Feb 2010, 22:02

Power Failure

#58 Post by nav2k4 »

Hey guys,

I am trying to use puppy 4.3.1 as a terminal services (RDP) client. I am using the PCTSCscripts to accomplish this.

The problem is that when ever a user resets the computer or there is a power failure it loops trying to start X. I have tried the methods suggested in this thread and various other threads on this forums but it still seems to be broken.

Here is a list of files that I have edited:

rc.sysinit

Code: Select all

busybox mount -t proc none /proc ;STATUS=$((STATUS+$?))
if [ -f /RUNNING ];then
echo -n "(Checking Filesystem..)" >/dev/console
 e2fsck -p -f /dev/sda1 &
 wait
fi
if [ ! -d /initrd ];then #w468
 busybox mount -o remount,rw /
 echo 'PUPMODE=2' > /etc/rc.d/PUPSTATE
fi
. /etc/rc.d/PUPSTATE #variables created at bootup by init script in initrd.

#v409 mount/umount scripts no longer write to /etc/mtab, as gparted failed to create a
#ext3 partition -- dunno why. Instead, now have /etc/mtab a symlink to /proc/mounts...
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab
#-------------------------------------------------------------------------------------------------
##############SHUTDOWN RECOVERY Add to /etc/rc.d/rc.sysinit################
#If we were not shutdown cleanly, try and recover
if [ -f /RUNNING ];then
 echo -n "(Cleaning up after Unclean SHUTDOWN)" >/dev/console
 rm -f /var/log/X*
 rm -f /RUNNING
 rm -rf /tmp/*
 rm -f /var/lock/LCK*
 rm -f /var/run/*.pid
 rm -rf /root/tmp 2>/dev/null
 rm -rf /root/.thumbnails/* 2>/dev/null
 rm -f /etc/.XLOADED
fi

###################Detect Bad Shut######################
#create a file in tmp that should be deleted on a clean shutdown
if [ ! -f /RUNNING ];then
 echo 'this file is deleted during a clean shutdown' > /RUNNING
fi 
#-------------------------------------------------------------------------------------------------

#redirect all output to a log file (must do after remount rw)...
[ ! "$LOGLEVEL" ] && exec 1>/tmp/bootsysinit.log 2>&1

rc.shutdown

Code: Select all

echo "${DISTRO_NAME} is now shutting down..." > /dev/console
#------------------------------------------------------------
rm -f /RUNNING
echo "Puppy is deleting RUNNING..." > /dev/console
#------------------------------------------------------------
ORIGPUPMODE=$PUPMODE #v2.22
I have attached the file that pctsc uses to call pctsc.auto.tsc which runs rdesktop.

Any help solving the power issue will be greatly appreciated :)

EDIT: Oh and the filesystem im using is ext3, full-HD install
Attachments
root.zip
(2.37 KiB) Downloaded 408 times

arcadeko
Posts: 14
Joined: Fri 12 Feb 2010, 21:04

USB Flash Drive recovery not an issue?

#59 Post by arcadeko »

I installed puppy on a flash drive using the installer at

http://www.pendrivelinux.com/install-pu ... m-windows/

posted this http://www.murga-linux.com/puppy/viewtopic.php?t=52455

then spent the past hour reading every post in this thread :D

- Since I am a total Puppy noob and only learned about it yesterday :X I donn't know if I am going to have an issue with using the 4GB USB drive as the ONLY drive for the computer. I have it all booting up fine and I even yanked the cord a few times just to see if it would fail on resume -
I guess I tested it about 3 times and no problems, but then I read this thread and now I am worried again.

Do I need to install a script to run fsck on the flash drive? is that even possible?

I am guessing its a Frugal install (since its for a pendrive and I had to install the dev-XXX-.sts thingy manually to compile C code) and since Wikipedia says flash memory doesn't usually (can't maybe?) use journaling, I am guessing I am using ext2 not ext3...

I want to use this as the system for a arcade cabinet running puppy arcade - the machine will invarably get unplugged often, do I risk turning my arcade cabinet into a 150 lb paperweight until I hook up a CD drive and try to reinstall? :shock:

man, reading more just creates more questions.. head hurt, must stop now...

User avatar
pri
Posts: 342
Joined: Fri 09 Oct 2009, 18:31
Location: Bandung Indonesia
Contact:

#60 Post by pri »

hei... great.....

look like i was wrong download.... :lol: :lol:

thk now i included on mu puppy remastered
Learning by Doing

Post Reply