| Author |
Message |
Jim1911
Joined: 19 May 2008 Posts: 2353 Location: Texas, USA
|
Posted: Mon 01 Mar 2010, 13:14 Post subject:
Howto unpack, edit and repack initrd.gz |
|
This post will show how to unpack and repack initrd.gz in order to edit the init file. This technique has worked well for me with initrd.gz files in pup431, dpup, upup, Lighthouse, and Stardust. Thanks to Mikeb for sharing what he called Pizzasgood's technique, otherwise I would not have found it.
Unpack the initrd.gz file
1. Make a tempinit directory and place the initrd.gz file that you want to edit in this new directory.
2. Using a console execute this:
| Code: | cd to directory containing initrd.gz
mkdir initrd-tree
cd initrd-tree/
zcat ../initrd.gz | cpio -i -d |
3. Using a text editor open the /initrd-tree/init file and make your changes.
4. Pack the new file using a console and this:
| Code: | cd again to initrd-tree
rm ../initrd.gz
find . | cpio -o -H newc | gzip -9 > ../initrd.gz |
The new initrd.gz is now ready for use, just copy it to the proper location. However before the copy, first rename the old initrd.gz.
Note: See Iguleder's suggestions in next post.
Last edited by Jim1911 on Sun 18 Apr 2010, 16:18; edited 3 times in total
|
|
Back to top
|
|
 |
Iguleder

Joined: 11 Aug 2009 Posts: 1613 Location: Israel, somewhere in the beautiful desert
|
Posted: Mon 01 Mar 2010, 14:22 Post subject:
|
|
2 notes you should add:
- If you copy the directory with the extracted initrd, do it with "cp -pa" to preserve the permissions, as BusyBox needs SUID and 4755, and some files in /etc need specific permissions.
- it's possible to compress with other compression levels instead of 9, good for older hardware, might save 0.0000000000(...)1 seconds of wasted boot time. If you really insist on small size you can use AdvanceCOMP or some other gzip recompressor to recompress the gzipped CPIO archive, could save 100-200 KBs for an average initramfs.
Nice tutorial, keep up the good work
|
|
Back to top
|
|
 |
Jim1911
Joined: 19 May 2008 Posts: 2353 Location: Texas, USA
|
Posted: Mon 01 Mar 2010, 16:46 Post subject:
|
|
Thanks, the credit goes to Mikeb for sharing what he called Pizzasgood's technique that I just edited. The code is above my skill level.
|
|
Back to top
|
|
 |
emil
Joined: 10 Nov 2009 Posts: 547 Location: Austria
|
Posted: Tue 02 Mar 2010, 04:34 Post subject:
|
|
nice Howto Jim!
I just needed exactly this.
I think this is the original post from pizzasgood ...
http://www.murga-linux.com/puppy/viewtopic.php?t=24899
|
|
Back to top
|
|
 |
nooby
Joined: 29 Jun 2008 Posts: 9382 Location: SwedenEurope
|
Posted: Tue 02 Mar 2010, 07:23 Post subject:
|
|
very good thread. I guess this can be used to edit in European Keyboard stuff from scratch? And set the Firewall to be on from out of the box too.
Maybe add Firefox and Chrome or is that in the sfs?
_________________
I'm a noob so I use Google Search of Puppy Forum
|
|
Back to top
|
|
 |
Sit Heel Speak

Joined: 30 Mar 2006 Posts: 2595 Location: downwind
|
Posted: Sun 18 Apr 2010, 15:33 Post subject:
|
|
@iguleder:
cp -pa is good to know. Thanks!
@nooby:
Applications which start after the switchroot, such as Firefox and Chrome, are in the .sfs.
|
|
Back to top
|
|
 |
PaulBx1
Joined: 16 Jun 2006 Posts: 2308 Location: Wyoming, USA
|
Posted: Mon 18 Jul 2011, 12:34 Post subject:
|
|
I found that if you make the tempinit directory in /mnt/home, then you get all sorts of "Operation not permitted" errors in the zcat step which makes the procedure fail. Putting it somewhere else, like in /root or /tmp, works fine.
|
|
Back to top
|
|
 |
rcrsn51

Joined: 05 Sep 2006 Posts: 7743 Location: Stratford, Ontario
|
Posted: Tue 19 Jul 2011, 04:35 Post subject:
|
|
With what file system is your /mnt/home formatted?
|
|
Back to top
|
|
 |
PaulBx1
Joined: 16 Jun 2006 Posts: 2308 Location: Wyoming, USA
|
Posted: Sat 30 Jul 2011, 20:07 Post subject:
|
|
I'm sorry I didn't see this question earlier. Now I can't tell you for sure. I've recently gone from ext2 back to FAT32, and also may have edited initrd.gz on different flash drives, so I can't really say. If I had to bet though, I'd say FAT32.
|
|
Back to top
|
|
 |
RSH

Joined: 05 Sep 2011 Posts: 1564 Location: Germany
|
Posted: Sat 22 Oct 2011, 03:31 Post subject:
|
|
Hello!
Here is the GUI for that Stuff. Did it in /root and works.
http://murga-linux.com/puppy/viewtopic.php?p=575255#575255
Nice work.
Thanks, RSH
|
|
Back to top
|
|
 |
emil
Joined: 10 Nov 2009 Posts: 547 Location: Austria
|
Posted: Sat 22 Oct 2011, 07:32 Post subject:
|
|
Sorry misspost - should have gone to
http://murga-linux.com/puppy/viewtopic.php?p=575255#575255
Super das es geklappt hat - ich habe das mit dem Abändern der Namen auch schon einmal probiert - habs allerdings nicht geschafft und dann darauf verzichtet.
Einen Kommentar habe ich noch zum Link - in einem Kommentar heisst es man müsste mit cp -pa kopieren, da busybox das SUID flag benötigen würde. Da bin ich mir überhaupt nicht sicher.
So gut kenne ich mich in Linux nicht aus, aber
SUID heisst das alle Busybox Befehle (/bin/busybox) immer mit root Berechtigung ausgeführt werden, egal welcher user (immerhin können auch unter puppy einige Server und daemons gestartet werden die jeweils unter ihrem eigenen user laufen.) Und busybox beinhaltet sehr viele shell Befehle.
Ich habe z.b. im slacko RC geschaut, hier ist das SUID nicht gesetzt.
|
|
Back to top
|
|
 |
RSH

Joined: 05 Sep 2011 Posts: 1564 Location: Germany
|
Posted: Sat 22 Oct 2011, 11:48 Post subject:
|
|
Hello,
SUID? I think that means Super User ID.
So, after I failed editing the initrd.gz, my Puppy Studio doesn't boot anymore. I've used Puppy 4.1 and edited the initrd.gz again. After repacking the initrd.gz copying the File with Mouseaction (Drag & Drop) did not work. Always getting an Error Message. Using the "cp -pa" did not work, because i did not know enough about the Syntax.
Please: could anyone post a Full-Syntax-Example, using "cp -pa"? and maybe one or two other examples to explain Terminalksyntaxes to me?
So, I've edited the initrd.gz again (outside of Puppy, sdb1) and it prints a long List of "no permissions"-Messages on my Screen. I quit Puppy 4.1 and reboot my PC with Puppy Studio from DVD. Edited the initrd.gz again, inserted the Line: DISTRO_FILE_PREFIX="cpup" after inserting the Line: DISTRO_PUPPYSFS="cpup_330.sfs" end repack the initrd.gz. It works. No "No-Permissions"-Messages on the Scrren and the initrd.gz has been copied by Drag & Drop.
The "New"-Puppy now searches for "cpup_330.sfs. The Savefile is now cpupsave-blablabla.2fs and it is loaded by the new Puppy as well.
NOW I WILL OVERCOME THE WORLD WITH NEW PUPPIES. (just kidding)
RSH
Any further Messages will be posted here: http://murga-linux.com/puppy/viewtopic.php?p=575255#575255
Edit: and now, there is a english GUI right here:http://murga-linux.com/puppy/viewtopic.php?p=575255#575255
|
|
Back to top
|
|
 |
|