live mounting of sfs is it possible ?

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

#21 Post by jrb »

reckrhodes wrote:How many sfs's can I load without rebooting my computer?
With the stock puppy I can open 4 .sfs's. If I use JB4x4's modified initrd.gz I can load 20.

You could instead add these lines to /etc/rc.d/rc.local

Code: Select all

mknod /dev/loop8 b: 7 8
mknod /dev/loop9 b: 7 9
mknod /dev/loop10 b: 7 10
mknod /dev/loop11 b: 7 11
mknod /dev/loop12 b: 7 12
which will give you 5 more and you can extend this further, not sure if there's a limit. See:WiKi » How Tos » General » SfsModuleCreation

User avatar
jcoder24
Posts: 604
Joined: Fri 06 May 2005, 12:33
Location: Barbados

#22 Post by jcoder24 »

I have been working on this over the last week or so to make it more suitable for an official puppy release. Most of the changes are things that were accounted for but commented out in the code or things suggested in this thread. Apologies to jrb for duplicating some of his efforts.

Bug fixes

* fix unloading and unmounting loop devices if loading the sfs fails
* fix issue with symlinks to sfs files whose target don't exists
* fix issue where /dev/loop1n loop2n and loop3n were being excluded from selection


New features/changes

* testing for aufs before proceeding
* mounting sfs to /mnt/.sfs_file_name instead of /mnt/sfs_file_name
* provides better explanation of the 'cdrom warning'
* creating new loop devices as needed (must be supported by the kernel).
* support for post-install scripts.
* if no post install script is included in the sfs perform some default post-install actions.


Misc

* reorganised, optimised and cleaned up code.
* packaged as a dotpet with load_sfs moved to the more standard /usr/local/bin/ instead or /usr/sbin. rox openwith is included also.
* tested in puppy 4.12

TODO

* Determine if sfs file is located external storage media and warn user.
* restartwm without restarting xserver


Post-install (post-loading) scripts

The post-install scripts is a hidden file with the same name as the sfs, without extension. Eg if you have a sfs Wine-1.1.14_412.sfs your post-install file would be .Wine-1.1.14_412 and your directory structure for the sfs may look something

Code: Select all

Wine-1.1.14_412
  |-- .Wine-1.1.14_412
  |-- usr/
  |-- root/
  |-- etc/ 
If the post-install script is absent, load_sfs inspects the contents of the sfs and performs some post-install operations as needed. These include, making fonts, libraries and kernel modules accessible and running fixmenus. restartwm is also in the script but commented out since it also restarts xwindows.
Attachments
load_sfs-0.8.pet
does not include ldconfig
(2.15 KiB) Downloaded 604 times

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#23 Post by technosaurus »

I am stuck on windows right now so I can't test - sound great because I have been doing this manually after searching about 3 different forum threads ... just wondered if the install scripts support was the same as .pets (pinstall.sh)... also does unmounting run puninstall.sh?
The uninstall would probably need to be run directly from /mnt/.sfs_package_name/puninstall.sh prior to actual unmounting. Not many pet packages actually use puninstall.sh so its probably not a must have feature.

another idea ...
if [loading fails] then
NEXTLOOP = (use sed/grep to find last loop #) +1
mknod /dev/loop$NEXTLOOP b: 7 $NEXTLOOP
(RETRY MOUNTING SFS HERE)
fi

edit
I could maybe also update the dir2sfs with some stuff from dir2pet and add an Xdialog script (called pinstall.sh) that asks if you want to run the program now
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

magerlab
Posts: 739
Joined: Sun 08 Jul 2007, 20:08

#24 Post by magerlab »

i think the most wished thing is just mounting sfs with only fixmenus and restartwm not (if possible) restart X. Especially for people who are new to linux
thank you!

brymway
Posts: 407
Joined: Sun 09 Dec 2007, 01:08

#25 Post by brymway »

A suggestion to you who are doing this fine work on an
exciting development. Some of us simpletons don't really
follow exactly what all your script talk and the like. As you
make a new development, would it be too much to state the
results of what that new script will do, to the lay person. It's
easier to figure how to get it to work if we know what it should
do. Does that make sense? Good work! And Thanks!
[url]http://wellminded.com/puppy/pupsearch.html[/url]

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#26 Post by sunburnt »

Adding & removing union branches worked great in Puppies up to 2.0
The older Puppies unioned on /root/usr, 2.0 up union on /
This caused problems & branch add/remove didn't work any more.

Eliminating the union all together solves the memory & cpu loading.
The SFS files just need to be made to work without the union.

vanchutr
Posts: 438
Joined: Sat 05 Aug 2006, 12:04

#27 Post by vanchutr »

I can't load more than 5 sfs with load_sfs. How to load more?

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

#28 Post by gyro »

I just downloaded load_sfs-0.8.pet and installed it into Puppy barebones 4.1.2.
(I'm trying to build a Puppy with the smallest possible pup_412.sfs and pup_save.2fs, with most applications bundled into a few large .sfs files.)

1) Please remove the "excecute" quotes from around "$self" in the "Usage" error messages. It can be quite confusing when it attempts to execute itself while attempting to produce an error message. At one stage, while I was playing around with "$self", it went into an endless loop because I had "$self" set to "$0".

2) Always failed to load the sfs.
Mounting the sfs seems to work OK.
The next mount to add it into the aufs, always fails with "union failed" message.
I also get a message from "mount" saying that the filetype should be specified. In Dmesg there is line saying "write permission for read only fs or inode /mnt/.sfsmodule".
If I add "-t aufs" to the mount command, mount complains that "/ is not mounted or bad option", and I still get the same line in Dmesg.

gyro

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#29 Post by sunburnt »

Hi guro; A SFS file is first mounted in the normal Linux fashion, &
then it's unioned, so: " mount -t squashfs (SFS file) (mount dir.) "
This mounts the SFS file & then use the aufs command to union it?

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

#30 Post by gyro »

sunburnt,
Sorry, but I don't understand your question.
In the "load_sfs" script I downloaded, there is no "aufs command".
A "mount" command is used to mount the sfs file as a loop device. This always works.
A second "mount" command is then executed to remount "/". From the error message I get when this fails, I assume that this is supposed to "union" the mounted sfs file. This always fails.

gyro

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#31 Post by sunburnt »

Sorry gyro, it's been a long time since I looked at Barry's boot code.
The " ? " was because of the " I can't remember " thing.
I'd have to look at the boot code to get a better idea of what's going on.

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

#32 Post by gyro »

sunburnt wrote:I'd have to look at the boot code to get a better idea of what's going on.
Thanks, but it's not BK's boot code, it's jcoder24's load_sfs-0.8.pet.

gyro

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

modified load_sfs-08 works on puppy 412 barebones

#33 Post by gyro »

Well I got it to work. Changed

Code: Select all

      mount -o remount,append:"$mount_point" =ro / 
to

Code: Select all

      mount -o remount,append:"$mount_point"=ro / 
Yes, removed a single space character.

I have attached a copy of the script that worked for me.
It also has the "execute" quotes removed from "$self" in the error messages.

Edit: I 've now attached a ".pet" that contains a slightly modified "load_sfs" script, and also includes a crude "unload_sfs" script. Both use "jwm -restart" instead of "restartwm".
It also contains a "loadsfs" script in /etc/init.d, this runs "fixmenus" at startup, in case an sfs was loaded but not unloaded, during the previous session.

Edit: Both scripts now use "refresh-menus" from 420rc2.
Copied parameter checking from load_sfs to unload_sfs.

gyro
Attachments
load_sfs_g4-0.8.pet
my latest load_sfs and unload_sfs scripts.
(2.63 KiB) Downloaded 576 times
Last edited by gyro on Mon 09 Mar 2009, 12:35, edited 4 times in total.

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

Stop restarting X? - solved for JWM

#34 Post by gyro »

On Puppy 4.1.2, JWM can be restarted from the menu without restarting X. How can this be done from a script?

Edit: For JWM use "jwm -restart"

gyro

User avatar
TheBlackSheep
Posts: 20
Joined: Sun 23 Nov 2008, 09:24
Location: Lancashire, UK

#35 Post by TheBlackSheep »

Being able to dynamically mount sfs's seems like a really good idea but I was wondering if there's an order issue when you load several one after another.

e.g. if one SFS has a version of a library in it and another SFS has a later version of the same library, doesn't the order in which they are virtually mounted affect what will be seen by the OS. Further, if you've installed some software via the PET repository (which presumably goes into your 2fs file) doesn't this effectively sit on top of all SFS's or would dynamically loading an SFS after booting effectively sit the other side of this, i.e. on top of the 2fs layer?

...or am I missing something here?

Chris

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

#36 Post by gyro »

TheBlackSheep,

My understanding is that the 2fs is always on top, i.e. takes precedence over all SFS.
Also, if different SFS files contain different versions of the same file, then the order of loading is significant.

Provided these limitations are kept in mind, there are still occasions where dynamic loading of SFS could be useful.

gyro

User avatar
TheBlackSheep
Posts: 20
Joined: Sun 23 Nov 2008, 09:24
Location: Lancashire, UK

#37 Post by TheBlackSheep »

Hi Gyro,

Yes, very much agreed, very useful - a minimal distro that could load/unload sfs files would be perfect. I have a really small low-end sub-notebook (IBM 240X PIII 500Mhz, 10.4" screen with 128Mb+swap) that I use for hols and travelling etc - you could call it a "poor man's netbook" - bought off ebay for <50GBP. It runs the standard 4.1.2 ok although it's not really up to the job for multimedia.

With a minimal distro like barebones and a few SFS files to run office (OpenOffice), internet (say Opera+Flash) or possibly even a media player (VLC - if I could get it to work ok on this laptop) when I needed them would be great. I have an SFS I built of lazarus (the open source version of Delphi) and it's 122Mb on it's own and it still needs the devx SFS on top of that before it will fully compile anything (I haven't worked out why - fpc is in the lazarus SFS so unless it still needs the linkers from the Devx SFS or whatever and I need to include these too - I digress).

Anyway, the point is, I wonder if the ideal here would be to create a dynamic loader management system, something that allows you to specify the order in which the SFS's are loaded and manages the unloading of them (although definitely problematic if applications are running) - possibly unloads them all and reloads what's left in the relevant order. Similar to the dialog that appears when you specify what SFS's to auto-load at boot time but with an option to shuffle the order in which they are loaded.

I presume SLAX takes an arbritrary stance here and just tries to load and unload depending on the click of the mouse, what's top-most at the end of the load takes precedence - in Puppy's case the 2fs file takes precedence over everything based on what you mentioned before.

If I get a chance over the weekend I'll do some testing with some dummy files to see what happens to overlapping SFS's when you take the rug from under them so to speak - unless someone has already done this and can explain what happens.

Chris

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

#38 Post by gyro »

Hi TheBlackSheep,

I'm thinking of creating an SFS for each occasion, e.g. an Internet one, a working with documents one, a programming one, a games one, etc... Each SFS would contain all the programs etc that I want for the particular occasion. If this live mounting and unmounting was working, then I would most likely only mount one SFS at a time.
(Like you I'm targeting this at a small machine, mines a 7in EeePC.)

One advantage of using SFS files, on a frugal install, to contain the bulk of the stuff that doesn't change, is that it makes possible a minimal pup_save.2fs. (My EeePC takes a long long time to save the 2fs file to the SD card.)

I expect that your testing will show that only the top most copy of a file is visible.

gyro

User avatar
TheBlackSheep
Posts: 20
Joined: Sun 23 Nov 2008, 09:24
Location: Lancashire, UK

#39 Post by TheBlackSheep »

hi gyro

made some test SFS files and tried loading and unloading and changing the order but something not right somewhere (sometimes the SFS files would appear in the filesystem sometimes they wouldn't) - also regularly got into a muddle with the /dev/loopx files, and couldn't then load or unload the SFS again.

like you I think this could be a winner for low spec'd devices. have not given up on it yet so will persevere...

chris

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

#40 Post by gyro »

TheBlackSheep wrote:(sometimes the SFS files would appear in the filesystem sometimes they wouldn't)
Did you notice if the files not appearing in the filesystem corresponded to files with the same name as existing files? And files appearing in the filesystem corresponded to files with names that did not already exist in the filesystem?

gyro

Post Reply