How to compress and uncompress image.gz?

Booting, installing, newbie
Post Reply
Message
Author
folks
Posts: 24
Joined: Thu 13 Dec 2007, 07:18

How to compress and uncompress image.gz?

#1 Post by folks »

I am looking for remastering image.gz.. i have mounted image.gz.. and finally i do some changes after then i put a a.out file.. ..and i executed .. it show " segmentation error"... ..please help... me.. how to make image. gz...

my objective is can we compress and uncompress image.gz.. can we make a image.gz.. by our self.. but..how...


Thanks in advance

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

#2 Post by Pizzasgood »

The process is different for Puppy 3.xx and Puppies before 3.xx.

To edit initrd.gz from Puppy 3.xx, first copy initrd.gz to someplace on a linux filesystem where you can work on it (I like to use /tmp/NewDir). Then open a terminal there and run this:

Code: Select all

mkdir initrd-tree
cd initrd-tree
zcat ../initrd.gz | cpio -i -d
That will make a directory initrd-tree that contains the contents of the initrd.gz file. Go inside and edit away. When you're finished, from inside the initrd-tree/ directory, run these commands:

Code: Select all

find . | cpio -o -H newc | gzip -9 > ../initrd.gz
That will replace the old initrd.gz file with the new one. Now just copy that into the correct place, and you're good to go.


For 2.xx and earlier, Puppy used actual fileystem images. Those are more annoying to work with. If all you need to do is small edits, you can just decompress it, mount it, edit it, unmount it, recompress it, and replace it, like this:

Code: Select all

gunzip initrd.gz
mount initrd /mnt/data -o loop
### Now go into /mnt/data and make any edits you need to make ###
umount /mnt/data
gzip initrd
If you need to make bigger changes, you need to create a new filesystem image. I made a script called Edit-Initrd that can help, but it sometimes has issues.
http://murga-linux.com/puppy/viewtopic. ... 91&t=12089
If you get a file that's much too small, chances are you need to modify the PAD variable in the script to use a bigger number.
[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
Colonel Panic
Posts: 2171
Joined: Sat 16 Sep 2006, 11:09

#3 Post by Colonel Panic »

Don't know if I'm doing anything wrong here, but I'm not getting this to work. I'm using and trying to "edit" Puppy Community 2.15.

I ungzipped initrd.gz without difficulty, and then tried the command

mount initrd/mnt/data -o loop.

The first message I got was, "can't find initrd/mnt/data in /etc/fstab", so I changed it and inserted a space between "initrd" and "mnt/data" and got this instead;

mount: ioctl: LOOP_SET_FD: Invalid argument
mount: Could not setup loop device

It's not the end of the world if this doesn't work out, but it would be good to have the capability to load a pristine file each time.

Best (and happy Easter to all Puppians),

Colonel Panic .

User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#4 Post by Béèm »

There should be no space.
But I think a -t xxx parm is to be used, xxx indicating the type of file system to be used, but I cant remember the correct syntax for xxx.
The man pages could help.
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#5 Post by MU »

you can use the attached script, based on Pizzasgoods instructions.
I use it to modify Muppy or NYP.

Extract it e.g. to /root/editinit

then copy initrd.gz there, too.
Then type in a console:

cd /root/editinit
./editinit


This gunzips initrd.gz, extracts initrd, and opens "init" in leafpad.
When you close leafpad, the extracted folder is zipped again as "initrd", and gzipped.

Mark
Attachments
editinit.tar.gz
(241 Bytes) Downloaded 612 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
Colonel Panic
Posts: 2171
Joined: Sat 16 Sep 2006, 11:09

#6 Post by Colonel Panic »

Thanks, I'll give it a go soon.

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

#7 Post by Pizzasgood »

Béèm wrote:There should be no space.
No, in this case there should. He's trying to mount a file named initrd at the mountpoint /mnt/data.

I assume the confusion is that it looks like the path /initrd/mnt/data, which is a real path, but that is not the case.

It may be that you don't have a free loopback device, which can happen if you've mounted a number of .iso or .sfs files without unmounting them. Normally Puppy only has something like eight loopback devices, and a number will be in use to run Puppy (for example, the pup_xxx.sfs file uses one, and if you have devx_xxx.sfs, that will use another).

You can check if there are any free with this command:
losetup -f
If it returns something like /dev/loop2, then there is at least that one free, and the mount command is failing for another reason (perhaps a corrupt initrd file?).
[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
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#8 Post by Béèm »

Thank you for the clarification. I understand now.
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
[url=http://puppylinux.org/wikka/HomePage]Consult Wikka[/url]
Use peppyy's [url=http://wellminded.com/puppy/pupsearch.html]puppysearch[/url]

Post Reply