[SOLVED] How do I edit the initrd.img (decompress & compress)
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How do I edit the initrd.img (decompress & compress)
Greetings
Problem, short version: I need to recreate my initrd.img after having extracted its contents. Bash by itself; pointing me to similar threads in this forum and google are useless to me and a waste of everyone's time as that has all failed. I need a working example.
Apparently, I am supposed to use this bash command (s): "zcat ../initrd.gz | cpio -i -d." The preceding command is unintelligible to me. To anyone: please provide a working example.
I cannot compress the initrd.img file and folders back into an initrd.gz file with a compression level of 9, so that I can rename with a .img extension. This is what google and similar threads in this forum suggest to do.
********************************************************************************************* Other details, if desired
My understanding of recompressing folders back into the initrd.img:
Google and this forum all point to bash involving either zcat or cpio and then gzip with a compression level of 9. However, I require exacting instructions for using these commands to compress the folders that have been extracted from the initrd.img back into one homogenous initrd.gz archive so that that the created initrd.gz can be renamed initrd.img
Note:posting bash without that an example is a waste of everyone's time as I found that on Google and it was useless as I lack the requisite computer science degree or years of Linux guru experience needed to figure out how to specify the arguements proprerly. What I need is a working example, not just bash.
Note2: To save time, the answer to why I need to edit the initrd.img is this: Two different utilities (based upon the same parent system & kernel) use the same initrd and the same file paths. When they are installed on separate partitions and the one farthest from the mbr is selected for boot, it will begin to boot and then switch to the one closest to the mbr, which results in a failed boot. If one is removed, the other boots fine, so it's not a menu.lst or a lilo config problem.
Again, bash without an example is useless to me and a waste of everyone's time This bash "zcat ../initrd.gz | cpio -i -d" is unintelligible to me To anyone: please provide a working example.
thanks
Last edited by yanfaun; 10-19-2010 at 07:59 AM.
Reason: Clarity
Bash does not explain filepaths, file names and options, nor does it explain proper command usage, Period, and that is why I need an example. As it pertains to this post, Bash may be the answer for you, but it is not the answer for me, not without a working example. Does it not stand to reason that if I could have used these commands properly I would be doing so instead of waiting for a response from a forum? Once again, not all bash without an example is the answer for everybody, Period.
Typically, one can paste file paths options and file names into commands and they will work. That does not happen here, which is why I posted.
If bash were all I needed, I would have simply copied the file paths and options into the commands and everything would be fine, so clearly I need more help than that.
This bash "zcat ../initrd.gz | cpio -i -d" is unintelligible to me To anyone: please provide a working example.
I cannot compress the initrd.img file and folders back into an initrd.gz file with a compression level of 9, so that I can rename with a .img extension. This is what google and similar threads in this forum suggest to do.
I do not know how to use the commands. I need an example
Typically, one can paste file paths options and file names into commands and they will work. That does not happen here, which is why I posted.
If bash were all I needed, I would have simply copied the file paths and options into the commands and everything would be fine, so clearly I need an example.
This bash "zcat ../initrd.gz | cpio -i -d" is unintelligible to me To anyone: please provide a working example.
This bash "zcat ../initrd.gz | cpio -i -d" is unintelligible to me To anyone: please provide a working example.
I cannot compress the initrd.img file and folders back into an initrd.gz file with a compression level of 9, so that I can rename with a .img extension. This is what google and similar threads in this forum suggest to do.
I do not know how to use the commands. I need an example
Typically, one can paste file paths options and file names into commands and they will work. That does not happen here, which is why I posted.
If bash were all I needed, I would have simply copied the file paths and options into the commands and everything would be fine, so clearly I need an example.
This bash "zcat ../initrd.gz | cpio -i -d" is unintelligible to me To anyone: please provide a working example.
Your first line IS THE WORKING EXAMPLE!!!!!
Execute it and it will be done for you. Or, at least, the line you listed will extract the contents of initrd.gz and set up a directory tree for the contents.
The WORKING EXAMPLE IS IN FRONT OF YOUR EYES, so you scrunch them shut, put your fingers in your ears, and scream "nah nah nah, can't hear you cant hear you".
From a shell, type the following:
man zcat
info cpio
man bash
And you will find that all of this stuff IS explained.
And this is my last post on this thread, unless you ditch the rant and have some intelligent questions to ask.
Execute it and it will be done for you. Or, at least, the line you listed will extract the contents of initrd.gz and set up a directory tree for the contents.
The WORKING EXAMPLE IS IN FRONT OF YOUR EYES, so you scrunch them shut, put your fingers in your ears, and scream "nah nah nah, can't hear you cant hear you".
From a shell, type the following:
man zcat
info cpio
man bash
And this is my last post on this thread, unless you ditch the rant and have some intelligent questions to ask.
jiml8! STOP POSTING ON MY THREADS YOUR KIND IS WHAT GIVES LINUXQUESTIONS.ORG FORUMS A BAD NAME!!!
YOUR ASSINE INSISTENCE THAT I USE that which I've stated that I cannot use without an example is absurd and constitutes the only unintelligent rant heretofore in this thread. I clearly stated that could not understand the bash and needed an example. How many ways must I say do not undertand this bash, nor the man pages??!!
jiml8! You are not welcome and you are not liked due to your rudeness. Anymore absurdity from you and I will report you. Stay away!
Just because I say that I cannot understand the bash that you understand is no justification for being rude, yelling and name calling. Grow up!
My apologies to everyone for having to deal firmly with the rudeness of the Jiml8. I do not like such exchanges, but apparently some (Jiml8) like to provoke them. If you dobt me, read to see who first started yelling (typing in caps is the internet equivalent of yelling) and hurtling insults.
Problem, short version: I need to recreate my initrd.img after having extracted its contents. Bash by itself; pointing me to similar threads in this forum and google are useless to me and a waste of everyone's time as that has all failed. I need a working example. The man pages are even more cryptic.
This bash "zcat ../initrd.gz | cpio -i -d" is unintelligible to me To anyone: please provide a working example.
*********************************************************************************************
This is not something that I can solve on my own. Normally, I can paste filepaths, folder names and options into the terminal, but nothing I do here has worked, so I request a working example.
Thank you and please ignore the exchange that Jim provoked between him and myself.
you ARE WORKING ON A BACK UP COPY ????
AND made a backup of the original!!!!!
and RENAMED that back up to initrd.img.backup
--- edit --
i found that in less than 5 min.
Yeah, I found it too. None of it works for starters.
Gunzip does not open .img files renamed or not renamed.
Originaly, I had stated that I was forced to used file-roler with root authority to open the initrd. Deleted that line because my problem is compressing not decompressing.
Also, all the methods for mounting initrd.img fail as the files type is not recognized or unsupported.
The preceding is not important now as I've extracted the files.
What I need now is to recompress everything (the initrd's contents) back into an img file or a gzip file (compression level 9) to be renamed with a .img extension. Compressing the initrd.imgs's contents is my impasse. Reading suggest they need to be compressed into initrd.gz> mv to initrd.img. Apparently, I am supposed to use this command: "zcat ../initrd.gz | cpio -i -d." The preceding command is unintelligible to me. To anyone: please provide a working example.Compressing with the zcat cpio stuff is beyond my undertsanding and so I posted. Need a working example
As I keep saying and putting in red, I cannot use ([CODE]find . | cpio -o -H newc | gzip -9 > ../initrd.gz) this line. I do not know how to use it. Please put it in example format. If someoone would put this in example format including file paths, I would not be posting. This is ([CODE]find . | cpio -o -H newc | gzip -9 > ../initrd.gz)unintelligible to me, seen it before. I have no cpio knowledge. If the solution involves the command cpio or zcat, I need an example.
your not giving enough info
and I just gave you the example
1) what is the name of the initrd?
2) what system is the initrd from? arch, debian, etc
Not trying to provoke but... Thanks I think if you read this response you'll understand.
initrd1.img, debian
Also, you did not give an example;you gave lines of bash. that does not help me. I cannot copy and paste [CODE]find . | cpio -o -H newc | gzip -9 > ../initrd.gz or zcat ../initrd.gz | cpio -i -d and get a result. The lines in red are not examples;they are lines of bash
These need an example of usage. by themselves they are of no vaue to me, period, and I not trying to be other than cordial What I need
Not trying to complain or provoke, but if someone says I need help to renane a file and you give them a response of "mv." That won't help them unless they know the "mv" command means "mv /home/username/Desktop/"Some file" /home/username/Desktop/"A different file name." There. Ijust provided a working example of the mv command. What I need are working examples of the these: [CODE]find . | cpio -o -H newc | gzip -9 > ../initrd.gz or zcat ../initrd.gz | cpio -i -d
the directions are assuming you have the initrd1.img in your home directory
let's assume your going to have the initrd1.img on your Desktop, user_name yanfaun
open a terminal, become root, then...
cd /home/yanfaun/Desktop
mv initrd1.img initrd.gz
mkdir tree
cd tree
zcat ../initrd.gz | cpio -i -d
as I said before, the initrd1.img is now extracted into the folder tree, (/home/yanfaun/Desktop/tree)
with the terminal you just used still open, after editing contents of tree, recompress contents of tree into new initrd.gz, then rename it initrd1.img
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.