How to turn off autosave for USB flash install?

Booting, installing, newbie
Message
Author
User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

How to turn off autosave for USB flash install?

#1 Post by Pizzasgood »

Note from Flash (Admin): I split this thread off from this one.
htnakirs wrote:...Pizza : What is this autosave daemon that you refer to and where can I disable it?
These directions use Puppy 3.01. Other Puppies should be fairly similar.

Daemon: /usr/sbin/savepuppyd
Find these lines:

Code: Select all

#only run if need to save tmpfs periodically...
SAVETMPFS="no"
[ $PUPMODE -eq 3 -o $PUPMODE -eq 7 -o $PUPMODE -eq 13 ] && SAVETMPFS="yes"
[ "$SAVETMPFS" = "no" ] && exit
Place a '#' in front of the third line, like so:

Code: Select all

#only run if need to save tmpfs periodically...
SAVETMPFS="no"
#[ $PUPMODE -eq 3 -o $PUPMODE -eq 7 -o $PUPMODE -eq 13 ] && SAVETMPFS="yes"
[ "$SAVETMPFS" = "no" ] && exit
Now Puppy should only save when it reboots.

Shutdown script: /etc/rc.d/rc.shutdown
There should be a group of lines like this:

Code: Select all

 13) #PDEV1 and PUPSFS and PUPSAVE
  #/initrd/pup_rw has tmpfs, pup_ro1 has pup_save.2fs file (PUPSAVE), pup_ro2 has PUPSFS file.
  #the above are in unionfs at /.
  echo "Saving session to $SAVEFILE (${SAVEPART})..." >/dev/console
  /usr/sbin/snapmergepuppy /initrd/pup_ro1 /initrd/pup_rw
  ;;
Modify it to be more like this:

Code: Select all

 13) #PDEV1 and PUPSFS and PUPSAVE
  #/initrd/pup_rw has tmpfs, pup_ro1 has pup_save.2fs file (PUPSAVE), pup_ro2 has PUPSFS file.
  #the above are in unionfs at /.
  dialog --yesno "Save session?" 0 0 >/dev/console
  if [ $? -eq 0 ]; then
   echo "Saving session to $SAVEFILE (${SAVEPART})..." >/dev/console
   /usr/sbin/snapmergepuppy /initrd/pup_ro1 /initrd/pup_rw
  fi
  ;;
That should make it prompt before saving on shutdown with a Flash install.


Sorry for not posting this stuff last night. I was too tired.

EDIT 2009-03-18: Forgot that the dialog command must be redirected to /dev/console. Corrected instructions.
Last edited by Pizzasgood on Wed 18 Mar 2009, 17:15, edited 2 times in total.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

Bruce B

#2 Post by Bruce B »

Pizzagood,

What do you think of the practicality of using a script to turn savepuppyd on or off, according to the type of session he wants?

Bruce

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#3 Post by Pizzasgood »

Wouldn't be hard. Just have a flag file somewhere that it checks before attempting to save. Then there could be a toggle script that would change it from "true" to "false".

You could also just kill or restart it, but I think that in some Puppies it's in charge of things besides just saving.

I believe Barry was talking about adding a settings panel in Puppy 4.1 that would let you disable the daemon. And I think he also modified it to use interrupts rather than just looping and sleeping.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

matrix88
Posts: 4
Joined: Tue 16 Dec 2008, 18:10

things have changed for saving ?

#4 Post by matrix88 »

I just installed Puppy Linux yesterday and am thrilled to find this version (does so much more and better than my other 'tiny' Linux). I'm trying to get up to speed on a couple things regarding the pup_save file and have had trouble locating how this is done with the current version. The above suggestion sounded great but it seems that is now in the pup_eventd file?

I'm using this on a flash drive and now that I have things configured would like to disable all saving (for my situation) except when I manually choose to save.

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#5 Post by Pizzasgood »

The part about the /etc/rc.d/rc.shutdown script hasn't changed yet. The relevant section should be at line 671 in Puppy 4.1.2, and somewhere nearby in other versions.

The stuff about the periodic saving is now unneeded. Instead, you can just go to "Menu->System->Puppy Event Manager". Switch to the "Save Session" tab and change the "Save interval" to 0, which will tell it to not periodically save.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

KJ
Posts: 176
Joined: Thu 20 Jul 2006, 13:29
Location: Above sea level .. about 320m

#6 Post by KJ »

pizzasgood, Just found this thread a couple days ago and tried the "13)" part of your solution with the "save interval set to 0" on a puppy412 (fatdog111) usb-frugal install. I cut and pasted your "13)" section which stops the shutdown (or reboot), goes to a blinking prompt and waits for an input. However, the "save session" comment does not show on the screen and "enter" or any key (other than ' n') plus "enter" results in a regular save.

Most interestingly, reversing "yesno" to "noyes" in your "13)" section creates an automatic shutdown without a "yes" possibility in about 5 seconds and the manual "save" button put on the desktop by the usb-frugal install works great so I now have just about what I've wanted for a long time. A reasonably secure "manual save only" usb Puppy for surfing the web.

KJ
Posts: 176
Joined: Thu 20 Jul 2006, 13:29
Location: Above sea level .. about 320m

#7 Post by KJ »

Forgot to clarify .... these results are with a frugal install on a bootable usb flash drive. KJ.

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#8 Post by Pizzasgood »

Odd. What do these command do when run in a terminal:

Code: Select all

dialog --yesno "Save session?" 0 0
echo $?
which dialog
On my system, they show a menu and return '0' for choosing 'yes', '1' for 'no', and '255' for the ESC key. It also tells me that 'dialog' is at /usr/bin/dialog.

If they work from a terminal on your end, then either you made an error in implementing the dialog command in the script, or something weird is going on in the script - like the path being broken, 'dialog' being aliased, or some other weirdness.

If you don't care and just want it to not save, you could just comment out that entire 13) section, from the 13) to the ;;. Currently, I believe what you've done is give 'dialog' an invalid parameter (It doesn't have a --noyes option), causing it to return with an error code of 255 and thus fail the if statement. (I only "believe" that, rather than know, because I'm not sure what else is going on in your situation.) Doing it that way works, but isn't a very "good" way to do it.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

awatar100
Posts: 3
Joined: Mon 16 Mar 2009, 09:45

#9 Post by awatar100 »

Hello
I read all post above - i comment this line in rc.shutdown but all that i made in sesion still is save to flash drive
I have CF on IDE board.
In puppy event menager Save Session - i set interval to 0

So i still have problem - HOW TO STOP SAVING session in puppy linux that is on CF !?!?!

KJ
Posts: 176
Joined: Thu 20 Jul 2006, 13:29
Location: Above sea level .. about 320m

#10 Post by KJ »

Pizzasgood .... Thanks for your reply. Tried your "test" from a rxvt and got a blue background with a "save session?" comment block with "yes" and "no" buttons. No verbage about 255. I get this output with both "noyes" and "yesno".

I have used your section 13 revision with "yesno" on a bootable frugal installed standard Puppy412, Puppy 410F, and FatDog111 (412 based) usb flash drives and get the same test output but different actual shutdown results according to the hardware and usb flash drive I'm using but no case do I get a comment box with buttons or text of any kind.

The manual save button on the desktop has worked in all cases.

Thnaks for you help... KJ

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#11 Post by Pizzasgood »

@awatar100: Look in /etc/rc.d/PUPSTATE and tell me what PUPMODE you have.

KJ wrote:Pizzasgood .... Thanks for your reply. Tried your "test" from a rxvt and got a blue background with a "save session?" comment block with "yes" and "no" buttons. No verbage about 255.
The 0, 1, or 255 are what are returned by running echo $? immediately after chosing yes/no or pressing 'esc' in the dialog. That command displays the return code from the last program to run in that terminal.
KJ wrote:I get this output with both "noyes" and "yesno".
When I try using '--noyes', it fails with this error message:

Code: Select all

Error: Unknown option --noyes.
Use --help to list options.
So maybe you have a different version of the 'dialog' program than I do. What do you get when running which dialog and dialog --version
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

KJ
Posts: 176
Joined: Thu 20 Jul 2006, 13:29
Location: Above sea level .. about 320m

#12 Post by KJ »

@ pizzasgood

#dialog --version

returns:
Version: 1.0-20060221

in both puppy412 and fatdog111.

Commenting out rc.shutdown 13) produces a "session not saved" and a clean shutdown with nothing automatically saved ... Sweet. A manual save only works great for me as I usually have several different small save.2fs and something keeps filling them up slowly with no changes or saves made by me. Eliminating most saves should at least slow the problem down.

Thanks again - KJ

awatar100
Posts: 3
Joined: Mon 16 Mar 2009, 09:45

#13 Post by awatar100 »

Pizzasgood
In this file PUPMODE = 7
From what i google my pupmode have to be something about 13 ?

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#14 Post by Pizzasgood »

The difference between 7 and 13 is that in 7 you save directly to the partition, whereas in 13 you save to a pup_save.2fs file on the partition.

For mode 7, I believe you can still follow the same directions, but instead of using the section for '13)', use the one for '7)' which is just above it.

@KJ: Well, that's the same as what I get. Maybe I'm making a bad assumption somewhere. I'll poke around tomorrow and make sure this still works right on my computer.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#15 Post by Pizzasgood »

Okay, the problem is that the dialog command needs to be redirected to /dev/console, like this:

Code: Select all

  dialog --yesno "Save session?" 0 0 >/dev/console
Sorry, dumb oversight on my part. I've gone back and corrected my instructions.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

KJ
Posts: 176
Joined: Thu 20 Jul 2006, 13:29
Location: Above sea level .. about 320m

#16 Post by KJ »

@ Pizzasgood ... Thank you very much.. Works great, adding ">/dev/console" does the trick. Blue dialog window, buttons , all there and working ....also it's clean on the next bootup too.

Thanks for working on this as I've wanting this solution for some time. KJ

KJ
Posts: 176
Joined: Thu 20 Jul 2006, 13:29
Location: Above sea level .. about 320m

#17 Post by KJ »

@ Pizzasgood FYI ... while running Puppy412 or Fatdog111 the rc.shutdown 13) solution doesn't seem to work the same with some boxes from the WM menu. I run wmreboot and wmpoweroff from icons on the desktop and these work great. On my e140 box shutdown (and reboot) work fine from JWM and IceWM menues, while on my newer Acer laptop menu entries do not work and result in a blank screen requiring the old "push the power button for 5 seconds" shutdown. Will do some more testing. KJ

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#18 Post by Pizzasgood »

It could be that they're running poweroff and reboot directly rather than going through wmpoweroff and wmreboot like they should.

Maybe if you add some code to the poweroff and reboot scripts to detect if X is running, and if so use the wmpoweroff/wmreboot options.

For example, /sbin/poweroff would become:

Code: Select all

#!/bin/sh
X_RUNNING="$(ps -Ao comm | grep '^X$')"
if [ "$X_RUNNING" ]; then
  exec wmpoweroff
else
  /etc/rc.d/rc.shutdown
  exec /bin/busybox poweroff
fi
And /sbin/reboot would be:

Code: Select all

#!/bin/sh
X_RUNNING="$(ps -Ao comm | grep '^X$')"
if [ "$X_RUNNING" ]; then
  exec wmreboot
else
  /etc/rc.d/rc.shutdown
  exec /bin/busybox reboot
fi

If those work, it could help reduce some confusion new users get due to not knowing about the wmreboot/wmpoweroff options.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

KJ
Posts: 176
Joined: Thu 20 Jul 2006, 13:29
Location: Above sea level .. about 320m

#19 Post by KJ »

@ Pizzasgood .... FYI ...Haven't gotten to work on this much lately but finally back got to it. I started over with new Puppy_save.2fs files on Puppy410, 412 and FatDog111. I added your re.shutdown 13) patch and your new sbin/poweroff and reboot files. All three shutdown and reboot with the blue background "save session?" dialog window. All three versions work great on two different computers.

FatDog111's default WM is Openbox and shutdown works fine with both Openbox and JWM.

Looks like most of the odd shutdown problems I've noted lately are now related to IceWM on my dual-core Acer notebook. Icewm shutdown works better on my e140 C7 thin-client.

On my notebook, I've installed two different IceWM versions on to Puppy412s from Pets and both will not shutdown from the menu but will shutdown correctly from a console window or a desktop link icon. Most interestingly, after installing IceWM, JWM will no longer shutdown from the menu. Blackscreen from both reboot and poweroff from menu. This behavior seems related to the modified shutdown procedures as they both work OK with the original files. Don't have access to the e140 until the weekend but I'm reasonably sure that IceWM and your file changes work fine on it with FatDog111 and Puppy412.

Looks like your changes are real keepers.
Keep up the good work ... Thanks.

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#20 Post by Pizzasgood »

Most interestingly, after installing IceWM, JWM will no longer shutdown from the menu. Blackscreen from both reboot and poweroff from menu.
Do you mean that after choosing to shutdown, the screen just goes black and sits, or that it proceeds through the normal shutdown procedure and just doesn't power down the machine in the end?

Try looking in /root/.icewm/menu to see how they implemented shutdown. If they added their own custom shutdown menu entry, that entry will define the script to be run. If they have it using IceWM's shutdown option, the command it runs should be defined in /root/.icewm/preferences.

You may also be interested in manually extracting that IceWM package to see if it's modifying things that it shouldn't. IceWM itself is a very small and simple thing, but I've seen some IceWM packages that would make Rube Goldberg proud.

.pet packages can be opened like this:

Code: Select all

pet2tgz some_package.pet
tar xf some_package.tar.gz
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

Post Reply