LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 10-18-2010, 09:25 PM   #1
yanfaun
Member
 
Registered: Nov 2009
Distribution: Arch Linux
Posts: 123

Rep: Reputation: 16
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
 
Old 10-18-2010, 09:44 PM   #2
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
The working example IS bash. Period. Those are the commands you have to execute to do what you want to do.

I find the tone of your Note to be very peculiar, for that reason.
 
Old 10-18-2010, 11:07 PM   #3
yanfaun
Member
 
Registered: Nov 2009
Distribution: Arch Linux
Posts: 123

Original Poster
Rep: Reputation: 16
Bash is not an answer period

Quote:
Originally Posted by jiml8 View Post
The working example IS bash. Period.
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.

I do not know what you meant by tone.

Last edited by yanfaun; 10-18-2010 at 11:35 PM.
 
Old 10-19-2010, 12:33 AM   #4
yanfaun
Member
 
Registered: Nov 2009
Distribution: Arch Linux
Posts: 123

Original Poster
Rep: Reputation: 16
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.
 
Old 10-19-2010, 01:13 AM   #5
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by yanfaun View Post
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.
 
Old 10-19-2010, 01:50 AM   #6
yanfaun
Member
 
Registered: Nov 2009
Distribution: Arch Linux
Posts: 123

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by jiml8 View Post
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 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!

YOUR KIND GIVES LINUXQUESTIONS.ORG A BAD NAME

Last edited by yanfaun; 10-19-2010 at 08:03 AM.
 
Old 10-19-2010, 01:53 AM   #7
yanfaun
Member
 
Registered: Nov 2009
Distribution: Arch Linux
Posts: 123

Original Poster
Rep: Reputation: 16
Greetings

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.

Last edited by yanfaun; 10-19-2010 at 02:15 AM.
 
Old 10-19-2010, 02:13 AM   #8
yanfaun
Member
 
Registered: Nov 2009
Distribution: Arch Linux
Posts: 123

Original Poster
Rep: Reputation: 16
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.

Last edited by yanfaun; 10-19-2010 at 02:17 AM.
 
Old 10-19-2010, 03:36 AM   #9
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
A question ?
Have you read the Arch wiki ?
http://wiki.archlinux.org/index.php/Main_Page
from a wiki search of " initrd.img "
http://wiki.archlinux.org/index.php/...he_Install_ISO

from the second post
Code:
gzip initrd.img
cp initrd.img.gz TO/The/original/location/for/initrd.img

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.

Last edited by John VV; 10-19-2010 at 03:37 AM.
 
Old 10-19-2010, 07:48 AM   #10
yanfaun
Member
 
Registered: Nov 2009
Distribution: Arch Linux
Posts: 123

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by John VV View Post
A question ?
Have you read the Arch wiki ?
http://wiki.archlinux.org/index.php/Main_Page
from a wiki search of " initrd.img "
http://wiki.archlinux.org/index.php/...he_Install_ISO

from the second post
Code:
gzip initrd.img
cp initrd.img.gz TO/The/original/location/for/initrd.img

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

Last edited by yanfaun; 10-19-2010 at 08:08 AM.
 
Old 10-19-2010, 07:55 AM   #11
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
this is what I do on Debian

initrd is named "initrd.img-blah-blah"

Code:
mv initrd.img-blah-blah initrd.gz
mkdir tree
cd tree
zcat ../initrd.gz | cpio -i -d
edit whatever in tree/ and to recompress

Code:
find . | cpio -o -H newc | gzip -9 > ../initrd.gz
cd ..
mv initrd.gz initrd.img-blah-blah
dont know if it'll work on arch....
 
Old 10-19-2010, 08:10 AM   #12
yanfaun
Member
 
Registered: Nov 2009
Distribution: Arch Linux
Posts: 123

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by linus72 View Post
[CODE]

[CODE]find . | cpio -o -H newc | gzip -9 > ../initrd.gz
cd ..
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.

Last edited by yanfaun; 10-19-2010 at 08:15 AM.
 
Old 10-19-2010, 08:12 AM   #13
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
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
 
Old 10-19-2010, 08:27 AM   #14
yanfaun
Member
 
Registered: Nov 2009
Distribution: Arch Linux
Posts: 123

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by linus72 View Post
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

Last edited by yanfaun; 10-19-2010 at 08:32 AM.
 
Old 10-19-2010, 08:32 AM   #15
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
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

find . | cpio -o -H newc | gzip -9 > ../initrd.gz
cd ..
mv initrd.gz initrd1.img
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I edit the initrd.img in the RHEL 5.1 boot disk? Ken B Red Hat 6 07-18-2008 08:34 AM
Add new cciss driver module to initrd.img ,stage2.img kunalroy2002 Linux - Software 4 09-25-2007 12:09 AM
Failed to symbolic-link boot/initrd.img-2.6.18-4-486 to initrd.img Scotteh Linux - Software 8 06-01-2007 11:24 PM
I want to edit initrd.img in my fedora 6 dvd-iso rishipandit007 Linux - General 7 01-19-2007 12:42 AM
How to decompress initrd.img to a directory rootyard Linux - Software 1 07-10-2004 10:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration