Savefolder without 'mount -o bind' - works

Under development: PCMCIA, wireless, etc.
Post Reply
Message
Author
gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#16 Post by gyro »

@mikeb
I do appreciate that the 'mount -o bind' method is all correct and above board Linux, and the scripts and programs are wrong.

gyro

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#17 Post by mikeb »

No worries and I cannot think of any software that is affected other than puppy scripts. I once went around removing instances of rm -rf $VARIABLE from several places as such code can potentially wipe yer system if the generation of $VARIABLE gets upset. (lost a partition that way :D )

Just as an aside slax manages to keep mounts made by the initrd separate from the main system so when running you only see 'normal' mounts and the loops and multiple mounts can only be seen by cat /path/to/initrd/proc/mtab ... not sure what the subtle difference is but it may be that the initrd system is not destroyed once booted since its reused at shutdown to keep things clean so I assume the kernel does not transfer over such special files/devs/proc info like it does in puppy.

Well have fun with the shoehorn... guess you like the challenge like me :)

mike

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

Dpup Wheezy 3.5.2.11

#18 Post by gyro »

An 'initrd.gz' for dpup Wheezy 3.5.2.11 can be downloaded from here http://www.fishprogs.software/puppy/wheezy/initrd.gz
A ydrv for Wheezy containing 'rc.shutdown' and 'shutdownconfig' can be downloaded from here http://www.fishprogs.software/puppy/whe ... 5.2.11.sfs
The 'shutdownconfig' has been lifted directly from TahrPup.

This combination works ok.
The only failure I have noticed is 'freememapplet' did not seem to start. But then I always disable 'freememapplet' in any puppy using savefolder, since I don't think it's providing critical information in this situation.

gyro
Last edited by gyro on Sun 22 May 2016, 01:42, edited 1 time in total.

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#19 Post by gyro »

Ok, I've found the problem with this implementation of 'savefolder'.
It's programs that try to find out how much space is left in the savefile. And they expect to get this from a mount entry. And of course there is no mount entry for '/initrd/pup_rw' (or '/initrd/pup_ro1' in pupmode=13).

I just looked at 'snapmergepuppy' source, and it definitely has this problem. So I suspect that in pupmode13 doing a 'save' will result in an error message saying that you have 0 space, and 0 files were copied. I haven't worked out a patch yet, but I don't think it will be too difficult.

I suspect that 'freememapplet' could have a similar problem. But it's not a script. Besides, I can easily live without it when using a savefolder, in fact I do. Which might explain why I didn't spot this one sooner.

I can't think of any other candidates for the problem.

It's a little frustrating that once again a side-effect breaks some puppy code, because it nullifies an assumption that seemed reasonable at the time the code was written.

gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

snapmergepuppy for TahrPup

#20 Post by gyro »

Here is a possible patch for 'snapmergepuppy' in TahrPup 5.8.3.rc1.

Code: Select all

--- snapmergepuppy.orig	2014-08-28 06:07:44.000000000 +1000
+++ snapmergepuppy	2014-10-06 18:00:13.693546346 +1000
@@ -66,9 +66,15 @@
  BASE="/initrd/pup_ro1"
 fi
 
+if [ -L $BASE ]; then #we have savefolder based on symbolic links
+ BASEMTP="/initrd${PUP_HOME}"
+else
+ BASEMTP="$BASE"
+fi
+
 # Precautions
 [ $PUPMODE -eq 3 -o $PUPMODE -eq 7 -o $PUPMODE -eq 13 ] || { echo "Wrong PUPMODE ($PUPMODE)!"; exit 1; }
-mountpoint -q "$BASE" || { echo "$BASE is not mounted!"; exit 1; }
+mountpoint -q "$BASEMTP" || { echo "$BASEMTP is not mounted!"; exit 1; }
 
 echo "Merging $SNAP onto $BASE..."
 
@@ -146,7 +152,7 @@
 
 #100222 a quick hack: BOOTCONFIG written to in init, before timezone set, can cause trouble...
 touch /etc/rc.d/BOOTCONFIG
-FREEBASE=`df -B 1 | grep -w "$BASE"| head -n 1 | tr -s ' ' | cut -f 4 -d ' '` #110212 Jemimah #110222 shinobar # SFR: result in bytes (see 'find' below)
+FREEBASE=`df -B 1 | grep -w "$BASEMTP"| head -n 1 | tr -s ' ' | cut -f 4 -d ' '` #110212 Jemimah #110222 shinobar # SFR: result in bytes (see 'find' below)
 
 rm -f /tmp/snapmergepuppy-nospace #110222 shinobar
 rm -f /tmp/snapmergepuppy-error   #140102 SFR
@@ -171,7 +177,7 @@
 
  #stop saving if not enough room left in ${DISTRO_FILE_PREFIX}save file...
  if [ $((NSIZE+204800)) -gt $FREEBASE ]; then	# 204800 = 200K slack space
-  FREEBASE=`df -B 1 | grep -w "$BASE" | head -n 1 | tr -s ' ' | cut -f 4 -d ' '` #110212 Jemimah: this is very slow; try not to check every iteration #110222 shinobar: fix for pup_ro10 and more
+  FREEBASE=`df -B 1 | grep -w "$BASEMTP" | head -n 1 | tr -s ' ' | cut -f 4 -d ' '` #110212 Jemimah: this is very slow; try not to check every iteration #110222 shinobar: fix for pup_ro10 and more
   if [ $((NSIZE+204800)) -gt $FREEBASE ]; then	#110212 Jemimah.
    touch /tmp/snapmergepuppy-nospace  #110222 shinobar
    break
This is untested, I don't run any pupmode=13.
I have also include the patched version of 'snapmergepuppy' in the ydrv for TahrPup here http://www.fishprogs.software/puppy/tah ... .3.rc1.sfs

Edit: I'm terribly sorry, there is a bug in the original code I published here. (Missing 'fi') I have fixed the diff here and the patched 'snapmergepuppy' in http://www.fishprogs.software/puppy/tah ... .3.rc1.sfs

gyro
Last edited by gyro on Sun 22 May 2016, 01:44, edited 2 times in total.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#21 Post by mikeb »

The best patch for snapmergepuppy is the delete button...biggest pile of garbage out there.

sorry to vent there :D

mike

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

snapmergepuppy for Dpup Wheezy

#22 Post by gyro »

The ydrv for Dpup Wheezy at http://www.fishprogs.software/puppy/whe ... 5.2.11.sfs has had a patched 'snapmergepuppy' added to it.

gyro
Last edited by gyro on Sun 22 May 2016, 01:44, edited 1 time in total.

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#23 Post by gyro »

I just realised there is another candidate for puppy code that this breaks, that's 'Puppy Package Manager'. When it checks to see if you have enough room to install, in pupmode=12 it will most likely find 0.
A patch using similar techniques to the patch for 'snapmergepuppy' might work. I'll investigate.

gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

Bug in 'snapmergepuppy' code

#24 Post by gyro »

There is a bug in the 'snapmergepuppy' code I published earlier.
The patch in the earlier post has been fixed.
The code in http://www.fishprogs.info/puppy/tahr/yd ... .3.rc1.sfs and http://www.fishprogs.info/puppy/wheezy/ ... 5.2.11.sfs has been fixed.

Apologies,
gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

puppy package manager - /usr/local/petget

#25 Post by gyro »

Strangely enough, Puppy Package Manager, works as is.
In 'installpreview.sh' it checks the size of the package against the free space available.
It gets the free space number from '/tmp/pup_event_sizefreem'. I suspect that this is maintained by 'freememapplet', and if 'freememapplet' is not running, then the file is empty.
But apparently in script arithmetic, an empty variable is not equated to 0. So the test "[ $SIZEVALx2 -ge $SIZEFREEK ]" fails because $SIZEFREEK is empty. So 'installpreview.sh' tells you that all's well, go ahead and install.

So I have made a patch for '/usr/local/petget/installpreview.sh':

Code: Select all

--- installpreview.sh.orig	2014-08-28 06:07:44.000000000 +1000
+++ installpreview.sh	2014-10-06 19:14:25.659426937 +1000
@@ -75,8 +75,17 @@
 
 [ "$DB_description" = "" ] && DB_description="$(gettext 'no description available')"
 
+. /etc/rc.d/PUPSTATE
+
 SIZEFREEM=`cat /tmp/pup_event_sizefreem | head -n 1` #100821 bug in Lucid 5.1, file had two identical lines.
-SIZEFREEK=`expr $SIZEFREEM \* 1024`
+if [ $SIZEFREEM ]; then
+ SIZEFREEK=`expr $SIZEFREEM \* 1024`
+else
+ BASEMTP="/initrd${SAVE_LAYER}"
+ [ -L $BASEMTP ] && BASEMTP="/initrd${PUP_HOME}"
+ SIZEFREEK=`df | grep -m1 -w "$BASEMTP"| tr -s ' ' | cut -f 4 -d ' '`
+ SIZEFREEM=`expr $SIZEFREEK / 1024` 
+fi
 
 if [ $DB_size ];then
  SIZEMK="`echo -n "$DB_size" | rev | cut -c 1`"
The purpose of the patch is twofold:
1) Do something a bit sensible if 'freememapplet' is not running.
2) Within this, use the save partition if we have a link based savefolder.

Patched versions of 'installpreview.sh' have been included in http://www.fishprogs.software/puppy/tah ... .3.rc1.sfs and http://www.fishprogs.software/puppy/whe ... 5.2.11.sfs

I have tested this code in normal frugal installs of both TahrPup 5.8.3.rc1 and Dpup Wheezy 3.5.2.11.

gyro
Last edited by gyro on Sun 22 May 2016, 01:45, edited 1 time in total.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#26 Post by mikeb »

It gets the free space number from '/tmp/pup_event_sizefreem'. I suspect that this is maintained by 'freememapplet',
It used to be and probably still is coming from puppy_frontend_d in its free space check...which probably uses similar code and I found equally useless so removed it :D . You have probably highlighted why it is so.
Indeed if the drive icons are replaced with something better much of this becomes irrelevant anyway.

As a further aside Xfce4 has a great free space monitor as a an applet and I use that... reliable and immeasurable cpu.

Onward and upward.... funny how working on one thing improves several others.

mike

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#27 Post by mavrothal »

Does "pup_rw" shows in mounted volumes/mounts? I would think that any puppy script that looks to pup_rw for info may have a problem with this implementation.
I also wonder if any aufs functions (auchk?) have problems since pup_rw does not appear as a branch.

BTW you may ant to provide deltas against the original ISO. Are equally small and the iso can be tested in a wider range of conditions.
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#28 Post by gyro »

mavrothal wrote:Does "pup_rw" shows in mounted volumes/mounts? I would think that any puppy script that looks to pup_rw for info may have a problem with this implementation.
"pup_rw" does not show in any 'mount' list because it is not a mount point, it's just a directory within a mounted partition. That's why programs like 'freememapplet' and 'snapmergpuppy' have difficulties, because they try to obtain the free space in "pup_rw" from it's mount information.
mavrothal wrote:I also wonder if any aufs functions (auchk?) have problems since pup_rw does not appear as a branch.
I am not familiar with 'auchk', but if it's an aufs function then surely it would work on the actual branches in the aufs stack. And the directory that is the savefolder is a branch. Why would aufs care what the puppy common name is for one of them?

gyro

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#29 Post by mavrothal »

mavrothal wrote:BTW you may ant to provide deltas against the original ISO.
Oh well, I put together a delta for Puppy Prceise 5.7.1, to become 5.7.2.
I contains the gyro's changes (patches) and the shellshock-safe bash-4.1.17.

So if you want to test gyro's new savefolder changes in precise, download the precise-5.7.1.iso___precise-5.7.2.iso.delta (md5:b6ea7b96f49848776186ad7ea7dc907d), update you precise 5.7.1 iso and check it out.

I tested only briefly, ie boot, save to directory and reboot using the said directory, but not any further.

NOTE: The 5.7.2 iso will update precise-5.7.1 if installed. If you do not want to test how it behaves after an update, use pfix=ram. Backup your original savefile if you do update.

Edit: New version Oct 12, also includes fixed freememapplet 2.4, a script to transform your savefile to savefolder, updated Puppy-package-* files, sfs_load and a fix for a soft block in wifi.
Attachments
patches.tar.gz
gyro's patches for savefolder as a symlink
md5:ddc0d5658c70f6e08f182034cb13bf9b
(70 KiB) Downloaded 347 times
Last edited by mavrothal on Sun 12 Oct 2014, 13:48, edited 3 times in total.
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

#30 Post by gyro »

@mavrothal
Thanks for providing the delta.
Thanks for providing the collection of patches.
There's just one little thing, the "df.diff" is not required by savefolder symbolic link, (although it won't hurt). It's the last piece of the jigsaw for savefolder bind mount.
(Until recently I was unaware that 'df' in puppy is a wrapper script.)

gyro

gyro
Posts: 1798
Joined: Tue 28 Oct 2008, 21:35
Location: Brisbane, Australia

freememapplet_tray

#31 Post by gyro »

Here is a patch of 'freememapplet_tray.c':

Code: Select all

--- freememapplet_tray.c.orig	2012-05-19 20:02:51.000000000 +1000
+++ freememapplet_tray.c	2014-10-08 01:56:41.045027125 +1000
@@ -68,7 +68,9 @@
     /*100517 always read free space in save file, not RAM space...*/
     /*if (pupmode!=6 && pupmode!=12) {fp = (FILE *)popen("df -m | grep ' /$' | tr -s ' ' | cut -f 2,4 -d ' '","r");}
     else {fp = (FILE *)popen("df -m | grep ' /initrd/pup_rw$' | tr -s ' ' | cut -f 2,4 -d ' '","r");}*/
-    if (pupmode==3) fp = (FILE *)popen("df -m | grep ' /initrd/pup_ro1$' | tr -s ' ' | cut -f 2,4 -d ' '","r");
+    if ((readlink("/initrd/pup_rw", meminfo, sizeof meminfo) != -1) || (readlink("/initrd/pup_ro1", meminfo, sizeof meminfo) != -1))
+        fp = (FILE *)popen("df -m | grep ' /initrd/mnt/dev_save$' | tr -s ' ' | cut -f 2,4 -d ' '","r");
+    else if (pupmode==3) fp = (FILE *)popen("df -m | grep ' /initrd/pup_ro1$' | tr -s ' ' | cut -f 2,4 -d ' '","r");
     else if (pupmode==7) fp = (FILE *)popen("df -m | grep ' /initrd/pup_ro1$' | tr -s ' ' | cut -f 2,4 -d ' '","r");
     else if (pupmode==13) fp = (FILE *)popen("df -m | grep ' /initrd/pup_ro1$' | tr -s ' ' | cut -f 2,4 -d ' '","r");
 // BK 110805 testing with PUPMODE=2, needs fix, there is no /dev/root...
Yes, same problem, assuming that it can get size information for 'pup_rw' from a mount entry.
I have added a working version of 'freememapplet_tray' to http://www.fishprogs.software/puppy/whe ... 5.2.11.sfs. This is the version I happened to be able to find source for.

So the list of required patches increases. But this symbolic link method has 1 advantage, they're all very specific to puppy.

gyro
Last edited by gyro on Sun 22 May 2016, 01:47, edited 1 time in total.

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

Re: freememapplet_tray

#32 Post by mavrothal »

gyro wrote: I have added a working version of 'freememapplet_tray' to http://www.fishprogs.info/puppy/wheezy/ ... 5.2.11.sfs.
Also works in Precise so you may want to post it as a pet here.
BTW is it stripped? (is too big)

BK keeps sources in http://bkhome.org/sources/. Needs the usual user/pass. Has 7 versions of the applet in http://bkhome.org/sources/alphabetical/f/
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

Re: freememapplet_tray

#33 Post by mavrothal »

mavrothal wrote: Also works in Precise so you may want to post it as a pet here.
Here is BK's freememapplet_tray-2.4 patched as above to v2.5

BTW I have also updated the precise-5.7.2 ISO with this.
Attachments
freememapplet_tray-2.5.pet
patched to recognise savefolder symlink
(4.33 KiB) Downloaded 335 times
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
Bert
Posts: 1103
Joined: Fri 30 Jun 2006, 20:09

#34 Post by Bert »

A question from a simple soul: can I use the delta to update the precise 5.7.1 from within it, while it is running?

Or does this need to happen from another Puppy?
Apologies, I never used a delta before...
[url=http://pupsearch.weebly.com/][img]http://pupsearch.weebly.com/uploads/7/4/6/4/7464374/125791.gif[/img][/url]
[url=https://startpage.com/do/search?q=host%3Awww.murga-linux.com%2F][img]http://i.imgur.com/XJ9Tqc7.png[/img][/url]

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#35 Post by mavrothal »

Bert wrote:A question from a simple soul: can I use the delta to update the precise 5.7.1 from within it, while it is running?

Or does this need to happen from another Puppy?
Apologies, I never used a delta before...
The delta will update the precise-5.7.1.iso (not the retro version), that you must have locally, to produce the precise-5.7.2.iso. So get the 5.7.1 iso and the delta and use "Xdelta file difference manager" to update the iso.
Then you can do a "manual frugal install" with the vmlinuz, initrd.gz and puppy_precise-5.7.2.sfs files from the new iso, either in a new folder or replacing the ones from 5.7.1 in your installation, or just burn and boot the iso.
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

Post Reply