How to save settings with a diskless client?

Under development: PCMCIA, wireless, etc.
Message
Author
Benno_fra_DK
Posts: 8
Joined: Tue 13 Aug 2013, 19:38

How to save settings with a diskless client?

#1 Post by Benno_fra_DK »

I have successfully booted the Puppy-derivative "Browserlinux" over PXE on a diskless client following the guide found here:

http://sirlagz.net/2011/06/13/how-to-bo ... -over-pxe/

But on each boot, I am presented with the settings option, and on each shutdown, the system tells me, that settings were not saved. (Naturally, since the client is diskless)

My workaround has been setting up a browserlinux and copying the pup save.2sf file from there, but with no success.

My first try was copying the file into the newinitrd.gz-file as was done with the pupXXX.sfs-file in the tutorial above, but this shows up nowhere in the system.

My second try was unsquashing the pupXXX.sfs-file, putting the pupsave.2fs-file in /mnt/home and resquashing the file system, but this left me with a kernel error.

Any suggestions?

Benno_fra_DK
Posts: 8
Joined: Tue 13 Aug 2013, 19:38

#2 Post by Benno_fra_DK »

BTW - I only want to save settings once. I just want to boot up the same session on every startup.

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

#3 Post by sunburnt »

Hi Benno_fra_DK; The Save file does need to be inside the initrd.gz file with the SFS file.

This makes for a large initrd.gz file, maybe 200 MB with a 256 MB Save file.
If the browser is setup to not cache anything, then the Save can be smaller.

Puppy`s boot code needs to be modded, a few folks here know how to do it.
Puppy only searches for the Save file on partitions, not in the init-ramdrive.
.
Last edited by sunburnt on Thu 15 Aug 2013, 16:01, edited 1 time in total.

Benno_fra_DK
Posts: 8
Joined: Tue 13 Aug 2013, 19:38

#4 Post by Benno_fra_DK »

Hi and thanx for the reply.

Since I am booting browserlinux and I only need the savefile to store the basic setup(internationalization and standard homepage) once, my pupsave-file can be relatively small(around 32 mb).

In /etc/rd.d/ there is a file called "PUPSTATE", that seems to define where to look for the savefile.

I need to be able to put my pupsave.2sf file somewhere puppy can find after boot, and I also need to edit this PUPSTATE-file.

I think maybe the kernel panic comes from my resquashing the filesystem.
What are the correct parameters to do that?

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#5 Post by Flash »

Once you figure out the Save file (I can't help you there,) you need to tell your web browser to put its cache in /tmp so the browser's cache doesn't fill up the Save file. In SeaMonkey, that's done in Edit -> Preferences -> Advanced -> Cache.

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

#6 Post by sunburnt »

Good tip Flash; That was my repeat warning too.

Benno_fra_DK; The PUPSTATE file is written after the Save file`s mounted.

This is way it can be difficult to modify Puppy`s boot code.
It uses variables all through the boot scrips, if you mod. the scripts,
then the variables must be filled or corrected, or Puppy won`t boot.

In Puppy-5.2.8 initrd.gz file, the Save file mount command is at line 1120.
And the PUPSAVE variable is set at lines 624, 771, 786, 886.

And in Puppy-racy-5.5 it`s at line 1199.
And it`s PUPSAVE variable is set at lines 344, 833, 848, 948.

As you can see, modding Puppy`s boot code is fraught with peril.

Best idea is to do it right and include the init-ramdrive as part of the search.
This would be even more work of course, but it wouldn`t be code hacking.

# Let me get this straight, you want to load the Save file in ram,
so that you can configure and copy of it, so to use the copy for booting?

Benno_fra_DK
Posts: 8
Joined: Tue 13 Aug 2013, 19:38

#7 Post by Benno_fra_DK »

This stuff keeps getting more hairy/scary...

What I really want is to boot the same setup every time I start browserlinux from pxe.

Maybe this can be done with this hack(then scr*w the savefile):
http://murga-linux.com/puppy/viewtopic. ... 45&t=81943

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

#8 Post by sunburnt »

Yes, Puppy`s Save file and main SFS file are unioned into one file system.

So if you boot your Puppy, then set it up how you want it..
Then make and run this script it`ll join the Save and SFS files in a new SFS file.
The nice part is, it won`t mess with the original SFS file.
So you can experiment and make many SFS files until it`s right.

Keep a copy of the original main SFS file, rename it: (filename).sfs_ORG
Then rename the new file by taking the "_NEW" off the end of the file name.
Then put it where the original SFS file was and boot it.
# NOTE: You`ll need to do the file renaming and moving while booted to a different Puppy.

Try this script and let me know how it works. Be sure the script has exec. properties.

Code: Select all

#!/bin/sh
#########Join Puppy`s Save and main SFS files in a new SFS file.

#####	Terry Becker	SunBurnt	Aug. 15  2013


#####	First setup the running Puppy how you want it, then run this script.

#####	It will make a new Puppy main SFS file in /tmp with "_NEW" at the end.



echo -e '\n###  Joining Save and SFS files into new SFS file. Please wait...\n'


sfsFN=`losetup /dev/loop2 |sed 's#^.*/##'`

squashfs /initrd/pup_rw /initrd/pup_ro2 /tmp/$sfsFN'_NEW'


echo -e '\n###  Done joining Save and SFS files into:  /tmp/$sfsFN'_NEW'\n'
Last edited by sunburnt on Thu 15 Aug 2013, 20:47, edited 1 time in total.

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#9 Post by Flash »

This seems like another way to remaster Puppy. Or maybe a poor man's remaster? But it won't solve the problem of Save files if more than one person boots the same iso from the network, will it? Or do I completely misunderstand what you're doing?

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

#10 Post by sunburnt »

No Save file needed at all. The setup boot makes a Save file to be arranged.
Then the script makes a new SFS file from both the Save and main SFS files.
After that the PXE boot loads Puppy and it`s configured modded SFS file.

As more configuration changes are made, just make a new SFS file.

# Realized a full remaster script may be a better choice here.
Puppy has a flag file for Xwin failure at boot, there may be others too.
This will show the [ Ignore ] [ Ram Boot ] options at each boot.
.
Last edited by sunburnt on Fri 16 Aug 2013, 03:09, edited 2 times in total.

Jasper

#11 Post by Jasper »

Hi sunburnt,

Seems a simple, yet ingenious, idea - and especially (for my needs) if it might be adapted to merge multi-session-CD/DVD date files with the main sfs - since it would probably reduce my boot time by some 30 seconds.

My regards

PS Am I right to think that Frugal users could easily remove built-in packages (e.g. a browser they don't want) before making the new sfs?

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#12 Post by greengeek »

Great idea sunburnt. I'm keen to give it a try. Just a question though - presumably there is a risk of including critical or personal info by doing this method - such as wireless router passwords, or browser history, that sort of thing?? Do you have any tips to ensure the user can include / exclude exactly what they want?

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

#13 Post by sunburnt »

greengeek; First boot, do a shutdown and make Save file ( as always ).
Second boot configure settings and apps. and run script.
For a new "clean" SFS file, boot to ram, configure, new Save file at shutdown.

Most of what needs to be in the SFS file is in /root, passwords are in /etc.
Apps can have config. file anywhere, so it`s a real task to track them all.
Tracking each item is a thankless job I wouldn`t wish on anyone.

# Realized a full remaster script may be a better choice here.
Puppy has a flag file for Xwin failure at boot, there may be others too.
This will show the [ Ignore ] [ Ram Boot ] options at each boot.
Full remaster scripts must "patch" all of Puppy`s checks. Yep a can of worms.

# Many remaster scripts have been written over the years, start your search.
Try the Puppy menu remaster. Menu > Setup > Remaster Puppy Live CD.
There`s other scripts folks have made too, look for them, try them out...


Jasper; In removing apps. it`s hard to get all of each one, so many files.
.
Last edited by sunburnt on Fri 16 Aug 2013, 08:33, edited 2 times in total.

Benno_fra_DK
Posts: 8
Joined: Tue 13 Aug 2013, 19:38

#14 Post by Benno_fra_DK »

I might be a poor man, but this is exactly what I need.
I run a school network with older PC only for working online. This makes browserlinux(and puppy) the perfect companion.
Having every user boot the same setup every time fits my needs perfectly.

Only problem is, that I might have to work overtime today because I can't wait to try it out. :D

Benno_fra_DK
Posts: 8
Joined: Tue 13 Aug 2013, 19:38

#15 Post by Benno_fra_DK »

Tried out the script... doesn't work

Did you mean "mksquashfs" instead of "squashes"?

The losetup part errors out, because /dev/loop2 is not found, but this is only to find the name op the pup.sfs-file?

Tried to do
mksquashfs /initrd/pup_rw /initrd/pup_ro2 /tmp/foo.sfs

This keeps stating, that filesystem has changes until it crashes everything, probably because it is trying to squash the output-file??

Then tried to copy the /initrd/pup_rw file with the -P option, squashed that and /initrd/pup_ro2 to a file - copyed that over, put it in the inited and booted over PXE.

Result:
Performing a 'switch_root' to the layered filesystem...Kernel Panic - not syncing: Attempted to kill init!

:cry:

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#16 Post by seaside »

Benno_fra_DK,

Another approach would be to tar compress /initrd/pup_rw and then install it on the pupmainxxx.sfs file.

Code: Select all

cd /initrd/pup_rw
tar -cvzf pupsave.tgz *
Then send pupsave.tgz to the pupmainxxx.sfs file location and use an SFS editor (Edit-SFS is one) to open the pupmainxxx.sfs file. The editor will create a "working tree" which will be the top level where pupsave.tgz should be extracted. After installing pupsave.tgz, the new sfs file including the pupsave.tgz files will be built.

Cheers,
s

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

#17 Post by mikeb »

Hmm all sounding familiar sunburnt
Puppy has a flag file for Xwin failure at boot, there may be others too.
This will show the [ Ignore ] [ Ram Boot ] options at each boot.
Indeed and that's way saving normally occurs after X has been killed. There is/was a live backup script that did deal with such problems.

Question that popped up in my head.... does pxe booting have the possibility of loading an sfs either within or outside the initrd.gz

I suppose the other way is to rewrite pxe in puppy to load files in a more conventional way ... ie establish network then load files as if on a local drive

mike

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#18 Post by seaside »

mikeb wrote:Hmm all sounding familiar sunburnt
Puppy has a flag file for Xwin failure at boot, there may be others too.
This will show the [ Ignore ] [ Ram Boot ] options at each boot.
Indeed and that's way saving normally occurs after X has been killed. There is/was a live backup script that did deal with such problems.

mike
mikeb,

Yes, there are those "first boot" flag files which I think are saved in /var/local. I guess you could just copy these from an existing save file.

Regards,
s

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

#19 Post by sunburnt »

Yep, I`ll bet there`s boot variables that are being messed up.

As I suggested, you should try the Puppy menu remaster, and then look for others.

raffy
Posts: 4798
Joined: Wed 25 May 2005, 12:20
Location: Manila

remaster

#20 Post by raffy »

A remaster with your new settings will give you a new pupXXX.sfs, which you then build into newinitrd.gz.

There is a stage in the remaster when you are asked to inspect /tmp/root (for the contents of the new /root) as well as /tmp/etc. In both cases, you should update /tmp/root and /tmp/etc with your new files - a radical approach is simply copy over /root to /tmp and /etc to /tmp when that question is asked.

In your pxelinux.cfg, you can add different initrd.gz and kernel builds, much like using grub entries (each set has a different label). For example, you may have an English build and a local language build.
Puppy user since Oct 2004. Want FreeOffice? [url=http://puppylinux.info/topic/freeoffice-2012-sfs]Get the sfs (English only)[/url].

Post Reply