PDA

View Full Version : knoppix 7.4.2 persistence



rspiteri
06-15-2015, 06:48 AM
hi,

I have downloaded knoppix 7.4.2 and installed it on usb flash drive using the read only option. At that time I did not want persistence.

Now I need persistence. On earlier versions, knoppix would ask where to create knoppix-data.img if it did not find one in any of the root partitions.

This is not done in this version.

I tried to manually create an img file myself (using dd) and saved it in the root of my harddisk. However this is ignored at boot.

Am I missing something please? A boot flag maybe? Or has the name of the persistent image file changed? Or does it need it to be in a directory called KNOPPIX even when not on the pendrive?

Thanks

Werner P. Schulz
06-15-2015, 09:58 AM
Have a look at Cheat Codes (http://knoppix.net/wiki/Cheat_Codes) → knoppix mkimage.

rspiteri
06-15-2015, 04:56 PM
Thanks for this. However this creates an img on the usb. I need to create the overlay file in the hard disk of the laptop/PC I am working on and then configure knoppix to use it.

How can that be achieved please?

Thanks

rspiteri
06-15-2015, 09:21 PM
Anyone please? Cannot seem to find anything in the documentation.


----
Quote deleted by mod.
Don't quote your own posting!

Werner P. Schulz
06-16-2015, 09:00 AM
There have been some discussions in the past, for example this thread and my posting (http://knoppix.net/forum/threads/31431-I-need-to-know-more-about-knoppix-data-inf?p=132496&viewfull=1#post132496).

rspiteri
06-16-2015, 11:31 AM
I have already seen that link and http://www.wp-schulz.de/scripte/backup-script.html

However how does knoppix-data.inf work? Where should it be located on the usb and can you use it to make it point to the knoppix-data.img file on a PC's hard disk (on which the usb is booting) ?

Thanks

superman
06-16-2015, 12:18 PM
@ rspiteri

By default, KNOPPIX 7.4.2 won't find the persistent files (.img / .inf / .aes) which are stored on a different partition, unless the minirt.gz is patched as suggested in the following thread.

http://knoppix.net/forum/threads/30770-suggestion-to-load-persistent-settings-when-booting-from-CD

ATB,

rspiteri
06-16-2015, 12:58 PM
@ superman ... thanks

That confirmed what I was thinking... it is quite disappointing though since if I remember correctly, Knoppix had that feature in earlier versions.

In my opinion, it was very useful since one would keep different overlays for specific system on the system itself and not carry every overlay on the usb and then switching names accordingly.

Is there another way to make a backup of all the changes (data, installed software, config) you made on a hard disk and then restore them back? I see there is a backup option in the menu but you have to specify which folders to backup and I am not sure whether it backs up all of UNIONFS

rajibando
06-16-2015, 01:55 PM
@rspiteri
I would like to remind you that Forum members are advised NOT to revive old threads.

We can't do any good by lamenting on what is not present in knoppix. We are to find an alternative way to make things work. Please keep your calm. Within a short period we would try to have your persistent set on your HDD. Please answer the following queries:

Do you use grub on your computer's HDD?

If you do, how many partitions your HDD has? How many partitions can be free of any data?

rspiteri
06-16-2015, 02:04 PM
@rajibando, I revived the old thread since I thought it was still relevant and useful. Sorry about that.

Please allow, to explain better what I am looking for.

1. I have knoppix on my usb to fix PCs and also do personal work.
2. I do not always use the same PC and/or laptops since clients vary and all have their hardware, wifi settings. printer configuration, network settings etc etc.
3. Sometimes I need to install software specific to a certain situation. Example I install a program that I need to use in one place and not in another. So it is useless having all the programs I need in one overlay file.
4. Therefore it would be nice if I could have a knoppix-data.img on every user's hard drive partition with settings, data and software specific to the user/machine. Then once I boot knoppix from my usb, knoppix would ideally search all the partitions looking for the img file and if found, it is used as the overlay file.
5. Like this, I would not need to have 4 or 5 overlay files on my usb and then rename them according to the environment I am working in.

Hope I was clear in my explanation... How can this be achieved please?

Thanks for your time.

rajibando
06-16-2015, 02:21 PM
First of all, please write an explicit request to the Mod to delete your post from the old, very old, thread.
Your need is likely to be fulfilled in a Knoppix/Linux way. Rather than to change the system it is better that we find work arounds.
Now, please answer some queries:
Do all your users necessarily use grub in their MBR?
Also, the earlier queries for your users instead of your please.

rspiteri
06-16-2015, 02:28 PM
Just sent a PM to the MOD to delete my post about the old thread... sorry about that

RE: grub... No most of them only have windows installed on their systems... therefore no grub

rajibando
06-16-2015, 02:46 PM
Good!
Please answer the next queries too; like how many partitions your clients' HDD generally have? How many partitions can be free of any data? Temporarily, of course.
Please also answer: Does your pen drive have grub installed?

If we take an extra query-answer cycle this is going to take double time.

rspiteri
06-16-2015, 02:58 PM
how many partitions your clients' HDD generally have?
normally 1 partition

How many partitions can be free of any data?
no single partition is totally free of data since normally there is one partition in the system

Does your pen drive have grub installed?
No, it uses syslinux, I used flash-knoppix to install knoppix on the pendrive and it uses syslinux as far as I know

Thanks

rajibando
06-16-2015, 03:49 PM
For your project Grub 2 is absolutely required, not legacy grub.

Make Grub2 to use Syslinux. Use appropriate Grub lines to boot from HDD. Please feel free to ask if you don't know how.

Your key to solve the issue is to install Grub on a pen-drive, but keep no KNOPPIX image name (found from the DVD, very large file of ~4GB, but rename it) there. Use it normally like any pendrive in normal circumstances.

Make at least two NEW partitions on the HDD (EXT4, eg.). Multi-partitioned HDD are better for management of space in Doze (also Linux) in personals. The more the partitions the better (upto 4GB) otherwise space is unnecessarily lost. Linux has no problems with large logical drives, but space is nonetheless lost.

Copy contents of DVD image in one partition and rename the earlier-renamed file back to KNOPPIX. Use grub and syslinux lines to direct the OS to that partition.

In that partition, add the knoppix-data.inf file to direct knoppix to the next partition and use it as persistent.

That way, your HDD's MBR is not changed.

I have a [solved] post. Refer to it.

If in doubt, write a PM to the Mod. He is the best man available for you personally, other than some very senior members. Discuss whether you could post your queries on the forum.

Even on hindsight, if you find a post was not that necessary but would confuse new members, request the mod to remove the post. He will judiciously advise.

Since you would use Knoppix professionally remember to contribute thoughtfully to Knoppix/ GNU monetarily. You are getting my help for FREE. Unheard of in Windows environment.

I neither get nor wish for a share of these donations. But there are some who need money for new hardware, books, research, etc. They are not beggars. They have willingly joined FOSS because of the Social Contract.

That's all for now.

Experiment, and post your ideas elaborately on the form, properly formatted.

Good wishes!

rajibando
06-16-2015, 04:03 PM
For knoppix-data.img you can use the same partition where you kept the KNOPPIX file. No extra partitions required.

rspiteri
06-16-2015, 08:34 PM
Thanks for your explanation.

I think I got your point. However this does not solve my issue. I cannot just create partitions on other users' systems. All I need is to work on their PCs with customized settings. They surely won't let me manage their harddisk and repartiton it. That is why I am using a live usb.

You said that I can use the knoppix-data.inf to let knoppix know where to find the overlay file. Can I just do that even from the usb and, for example, point knoppix to /dev/sda1/knoppix-data.img from the inf file on the usb?

What exactly does this knoppix-data.inf contain?

Werner P. Schulz
06-16-2015, 09:10 PM
What exactly does this knoppix-data.inf contain?Again! Read my posting #5. There you'll find the hint which parts of the two scripts you have to modify by yourself. With the standard Knoppix installation your wish is insoluble.

Werner P. Schulz
06-16-2015, 09:45 PM
If in doubt, write a PM to the Mod. He is the best man available for you personally, other than some very senior members. Discuss whether you could post your queries on the forum.

Even on hindsight, if you find a post was not that necessary but would confuse new members, request the mod to remove the post. He will judiciously advise.
I believe Rajib is talking about me.

First of all, my job as mod is to purge all the spammer postings each day (especially the last weeks). With this job I'm not alone; there are other moderators who works quietly and keep the Forum clean.

Sometimes I do a little format - if necessary - of new users postings or in case of wrong quote. Sometimes I edit or delete a posting if a user violates the Forum rules.

But I do not remove postings of users which "would confuse new members" and I do not stop queries. Either I try to describe my view of the problems or in case of troll posting I'll send these users a personal message.

rajibando
06-17-2015, 03:05 AM
@rspiteri

Please have patience to read and apply your mind.
I have already given you the solution.

rspiteri
06-17-2015, 08:41 PM
@rajibando... I appreciate your help really but unfortunately as I told you, your solution is not valid in my case... I cannot just create partitions on others' PCs. Also I prefer to have a file (.img) rather than a partition. It is more portable in my opinion.

@ Werner P. Schulz... I read your post over and over again going through all the links... I even tried to patch minirt.gz with no luck... Can you please guide to what scripts do I need to modify and where please?

I thank you both for your patience.

I really like Knoppix and would like to learn more about this distro.

Werner P. Schulz
06-17-2015, 09:28 PM
The interesting part of the script "flash-knoppix2" → "If we don't already have an overlay, ask to create one"

How Knoppix interprets the config files (knoppix-data.inf, knoppix-data.aes or knoppix-data.img) during boot, you can see within the "init"-file of the minirt.gz → function mountdata()

Read and analyze the source code.

If you want another behaviour of Knoppix and his overlay you have to change these two scripts, insert your own code and remaster Knoppix.

rajibando
06-18-2015, 02:42 AM
...I cannot just create partitions on others' PCs,,,

You haven't read and understood.

rspiteri
06-21-2015, 06:10 PM
Hi,

I managed to accomplish what I wanted.

Modified mountdata() to check for a new boot parameter which I called overlay and now when you type:

knoppix overlay=/dev/sda1

Init will mount /dev/sda1/knoppix-data.img to KNOPPIX-DATA

I need to update it to cater for aes as well

Thanks for all your help

rajibando
06-21-2015, 10:18 PM
Now it is your turn to elaborately explain via a post about the steps you took to accomplish your target and where you were going wrong, including the support you obtained from various threads.

You know, freedom comes at a huge price which some of us don't like to pay, but take freedom for granted. We forget that some of our predecessors fought relentlessly for those freedoms.

Intentionally, we don't spoon-feed you because we wish to keep your choices free. Sometimes, we fail to get the message across. And the seekers turn highly abusive - they usually don't wish to own up responsibility and ask the right questions. Usually, they want to be spoon-fed.

I have a difficulty with reading, I am visual, so Linux is difficult for people like me, while people who read relentlessly find it cakewalk. I overcame this difficulty by skimming through the text, trying to pick up things that I require. I don't complain that people don't understand. Why should they understand? It is my problem and I have to solve it. What is my mind (brain) for, if it can't find a way?!

We give up easily and say we don't have time to read or experiment. As if others are in lesser responsible positions!

I have found that if I ask the right questions there are people who would answer my query. And sitting still like in meditation helps a lot. Your subconscious mind provides you answers but you have to be really calm and attentive to listen.

Anyway, keep learning, and remember the suggestions I had earlier given you.

rspiteri
06-22-2015, 09:00 PM
Basically I have followed the links and comments you both supplied and came up with the following solution:

1. Decompress minirt.gz
2. Open init with vim.
3. At the start of mountdata(), use checkbootparam() to check for if the overlay parameter exists
4. If yes, read its value and mount the image as loop on KNOPPIX-DATA using trymount(), outputting a valid message at boot (optional)

Basically the code to mount the overlay image is already there in mountdata(), I just reused it for my purpose.

Now obviously I can tweak init to search if the overlay exists before mounting it, but for now I am satisfied with the output since I managed to do what I had in mind.

Then it is

rajibando
06-23-2015, 05:01 AM
Thank you for posting your experience.

But why do you have to take the hard way? Editing minirt.gz.

You could have :

(1) been patient
(2) Booted to the laptop owner's system normally.
(3) Copied your pendrive's boot and KNOPPIX folders, renamed your pendrive's KNOPPIX binary to KNOPPIX000.
(4) Booted from your pendrive, let your syslinux search and find the HDD's KNOPPIX binary and knoppix-data.inf and boot from there.
(5) You could also have used knoppix-data.img had you so chosen.

Matter ends.

There is a phrase called Occham's razor. You are a programmer, so also try to find simple solutions :-)

It is not for a reason that Windows has been DBD, i.e., defective by design ;-)

Anyway, best wishes with your professional work. Bye!

Werner P. Schulz
06-23-2015, 08:25 AM
knoppix overlay=/dev/sda1
3. At the start of mountdata(), use checkbootparam() to check for if the overlay parameter existsYour way to use a own cheatcode and test for it within a modified init (of minirt.gz) is a simple and nice solution.

rajibando
06-23-2015, 09:49 AM
...simple and nice solution...
But rspiteri is not booting knoppix in his system!
He wants to boot knoppix from his clients' systems, and the clients may not allow by default rspiteri's saving the KNOPPIX image in the HDD of his lap(desk)top's first partition. Then his edited minirt.gz will fail, and his pendrive syslinux will use the default method to search and find out the KNOPPIX image from the HDD, I am not aware if the modified init shall fail.
In that case, it is worthwhile to let the minirt.gz alone and let syslinux do what it does best.
Anyway his approach is not general.
Else, please advise.

rspiteri
06-23-2015, 12:10 PM
Your way to use a own cheatcode and test for it within a modified init (of minirt.gz) is a simple and nice solution.

Thanks for the feedback Werner P. Schulz, I appreciate...

@rajibando, perhaps you did not understand me well then. let me explain better...

1. I boot knoppix from my pendrive on every machine and NOT from the client's machine. That would not make sense since I need 4GB on disk on every machine then.
2. However I do not want to store all the different clients' modifications (keyboard settings, wifi settings etc) on my pendrive.
3. Therefore I create a knoppix-data.img file on each client's machine.
4. Finally I specify overlay=/dev/sda1 (where sda1 refers to the partition where the overlay file (knoppix-data.img) is found. (overlay is the new boot parameter I configured init to look for)
5. That's it. Like this, if I need to save few settings or make minor modifications for the future, I just create a 500MB overlay file and save all changes there.
6. If I do not want to save any settings or modifications on the client's machine, I just omit the overlay boot parameter and knoppix will boot normally in "read only" mode. My edited minirt.gz does not search for an img file on the client's machine unless the boot parameter is specified.

The solution you proposed also works but is very expensive in terms of the client's disk space.

superman
06-23-2015, 12:12 PM
@ Werner P. Schulz

... simple and nice solution ...

Indeed! If rspiteri's client is using Win7 with separated boot and system partitions, his client won't even realise the knoppix-data.img has been planted in the /dev/sda1 since the boot partition won't be shown in the Windows Explorer. Cheeky, cheeky... ;)

@ rajibando

(2) Booted to the laptop owner's system normally.
(3) Copied your pendrive's boot and KNOPPIX folders, renamed your pendrive's KNOPPIX binary to KNOPPIX000.
(4) Booted from your pendrive, let your syslinux search and find the HDD's KNOPPIX binary and knoppix-data.inf and boot from there.

If (big if) I am not mistaken, the internal hard discs generally occur earlier than the usb storage devices on the Linux's device list, and KNOPPIX's init will use the first KNOPPIX/KNOPPIX found in the system by default. So there may be no need to re-name KNOPPIX to KNOPPIX000 as mentioned in point 3. ... NAND flash memory's wear leveling... Ouch...

Werner P. Schulz
06-23-2015, 12:12 PM
1. I have knoppix on my usb to fix PCs ...
2. I do not always use the same PC and/or laptops since clients vary ..
..
4. .. if I could have a knoppix-data.img on every user's hard drive partition ..
.. Then once I boot knoppix from my usb, ..
.. looking for the img file and if found, it is used as the overlay file.
The solution does exactly what the OP wanted.

rspiteri
06-23-2015, 12:27 PM
Indeed! If rspiteri's client is using Win7 with separated boot and system partitions, his client won't even realise the knoppix-data.img has been planted in the /dev/sda1 since the boot partition won't be shown in the Windows Explorer. Cheeky, cheeky... :wink:

well said superman ;)

rajibando
06-23-2015, 01:30 PM
... his client won't even realise the knoppix-data.img ...

Is it? Oh, then I am not aware of this, because I exclusively use Linux, and Wine, occasionally.
I use several versions of linux, and my MBR directs to Syslinux.
I can use both pen drive isolated (physically removing internal HDD), rename my HDD KNOPPIX KNOPPIX000 and boot from pendrive or boot from HDD with/without pendrive.
In my BIOS even with pen drive first, and HDD later in boot seq, Knoppix prefers the HDD version first :-) I stand corrected, and I am sorry for the error. But I know I haven't confused you and rspiteri because you two are avid readers as well as programmers.
I will definitely need your help in future! I would very much wish that you'd remember the Social Contract.
And I would accept Mr. Schulz's opinion as final without dispute. I greatly respect and admire him as a benevolent person.
Very well, then. Let us focus elesewhere then :-)

macjoubert
08-07-2017, 12:24 AM
well said superman ;)

I just registered to say THANK YOU - I was having the same problem and your steps really helped me.
The other guys suggestion was actually even more cumbersome than yours.

szzsqing1
02-13-2020, 01:10 AM
Hallo rspiteri!

Sorry for my words, but I really do not understand your logic. You spent many time and did a lot of work for a bad solution. :D
Why I say this? For this:

You wrote: "Sometimes I need to install software specific to a certain situation. Example I install a program that I need to use in one place and not in another. So it is useless having all the programs I need in one overlay file."

OK, maybe you need some different software to install for different computers. But this must not be too much amount of data because Knoppix already has almost all software we may need. Yes, sometimes we need some specific software but anyway the size for these software together could not be very much. In the worst case 10 GB would be enough even if you install very big programs. Nowadays the USB sticks are very cheap: a 16 GB size USB stick is not expensive at all. And this size would be enough for Knoppix itself and a 10 GB persistence partition (also on USB stick). (But even if you need more space you can use an external HDD...) So, you could have all your software and configuration on one stick (always in your pocket) and do not need to bother with and touch client devices...
It is not a lot of simpler and more logic?

And that software and things on the overlay are not "heavy" (if a USB stick is full of stuffs still function as good as an empty one ;)) and "useless" anyway, even is you do not need them all, always. Think just about Knoppix: almost 10000 programs, and of course we need only a little part of them one time. But nobody thinks that the other part is useless and Knoppix should be splitted because contains "useless" software. :) Which today and here is "useless", maybe tomorrow and there will not be.

On the other hand, a big part of your img files' data is common to each one, since when using persistence a lot of data will be saved only because the config files had changed. This means that if you use 3 img files (A,B,C) instead of only 1 img file (D) (and D contains all the software that the three files contain separately), the amount of those 3 img files will be much more than the size of D. A + B + C > D So, using only 1 file is not only more effective but it is also more economic.

And you wrote: "it would be nice if I could have a knoppix-data.img on every user's hard drive partition with settings, data and software specific to the user/machine"

For a lot of settings you do not need img file, persistence. You can use cheatcodes for language, keyboard, timezone. Wifi data (names, passwords) are stored in little files, the amount of size for this is negligible. Linux is not like Windows, here you do not need specific software, drivers for different hardware. Particularly, Knoppix supports almost every hardware, so of course you do not need to install anything for this. Also Knoppix executes automatic hardware detection and system configuration at start, you do not need to save any hardware-specific setting. Linux is not Windows, and Knoppix is not an installed system but a live one with autoconfiguration...