LinuxQuestions.org
Visit Jeremy's Blog.
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 06-08-2009, 07:44 AM   #1
nekkro-kvlt
LQ Newbie
 
Registered: May 2009
Posts: 20

Rep: Reputation: 0
[Solved]CPIO question


Hi all, I have a trouble with CPIO:
I have a file called asa802. I extract it with the following command:

Quote:
bastien@bastien-laptop:~/asaemu/asa802-k8_1$ cd uncompressed/
bastien@bastien-laptop:~/asaemu/asa802-k8_1/uncompressed$ rm -rf *
bastien@bastien-laptop:~/asaemu/asa802-k8_1/uncompressed$ cpio -id --no-absolute-filenames < ../asa802
Then I tried to rebuild archive:
Quote:
bastien@bastien-laptop:~/asaemu/asa802-k8_1/uncompressed$ find . | cpio -o > asa802_cpio
61020 blocks
bastien@bastien-laptop:~/asaemu/asa802-k8_1$ ls -la
total 157924
drwx------ 3 bastien bastien 4096 2009-06-08 14:36 .
drwxr-xr-x 5 bastien bastien 4096 2009-06-08 14:16 ..
-rw-r--r-- 1 bastien bastien 31251968 2009-06-08 14:18 asa802
-rw-r--r-- 1 bastien bastien 31242240 2009-06-08 14:36 asa802_cpio
drwxr-xr-x 12 bastien bastien 4096 2009-06-08 14:34 uncompressed
Filesizes are not identical !


As I saw these messages:
Quote:
pio: dev/ram0: Cannot mknod: Opération non permise
cpio: dev/mem: Cannot mknod: Opération non permise
cpio: dev/kmem: Cannot mknod: Opération non permise
cpio: dev/null: Cannot mknod: Opération non permise
cpio: dev/port: Cannot mknod: Opération non permise
cpio: dev/hda: Cannot mknod: Opération non permise
...
I tried:
Quote:
bastien@bastien-laptop:~/asaemu/asa802-k8_1$ cd uncompressed/
bastien@bastien-laptop:~/asaemu/asa802-k8_1/uncompressed$ rm -rf *
bastien@bastien-laptop:~/asaemu/asa802-k8_1/uncompressed$ sudo cpio -id --no-absolute-filenames < ../asa802
And messages disappears, but filesizes are still not identical

Tried also without the -h newc parameter, but same problem.
Do you know why ? The problem is not that the archive has a different size, but when I boot with the original archive (it's a unix FS, i boot it with QEmu), it works, and the second case got an error. I think it's maybe I extract with --no-absolutes-filenames, and when I zip it again, the filenames are wrong, but how should I fix it, as I can't extract it in my FS, it would overwrite some of my system files :s

Thanks for your help

Last edited by nekkro-kvlt; 06-10-2009 at 03:14 AM.
 
Old 06-09-2009, 08:16 PM   #2
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
hi

I have not studied what you have attempted to modify but as an alternative to unpack repack cpios...try this...assuming you have full file permissions....otherwise do it as root


Code:
pwd ....response is your home dir of course

mkdir cpio/
cp /pathwayto/cpiofile  /home/yourname/cpio/....means put a file into new folder..keeping oldfile as backup
cd cpio/...........................................go into folder
cpio -iv < cpiofile.....unpacks it
rm -f cpiofile...............................delete old file
do your mods....

Code:
ls | cpio -ov newcpiofilename...........create new cpio
try to use a different filename for new cpio so you know which is which?

Last edited by aus9; 06-09-2009 at 08:18 PM.
 
Old 06-10-2009, 03:13 AM   #3
nekkro-kvlt
LQ Newbie
 
Registered: May 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Hi, I finally found the pain, by hexediting the cpio made file, I saw that when I was doing ls uncompressed/ it added uncompressed in the archive, so I made
cd uncompressed
find . -print | cpio -o -H newc > ../newfile

exporting into another folder is important, otherwise the created file will be found by find and included... It is not the exact same size, but the then I can boot it with QEmu.

I had also needed to extract CPIO File with root privileges, or it wasn't able to change attributes...

Thanks anyway
 
  


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
cpio -idcmv command hanged while extracting .cpio command ravindra.atre Linux - General 2 08-22-2011 04:10 AM
help me with CPIO deli007 Linux - General 2 03-05-2007 06:40 PM
using cpio ksun Linux - Newbie 4 05-12-2006 05:14 AM
How to use cpio to extract a cpio archive? linx win Debian 4 06-17-2005 01:53 PM
cpio.gz?? unprocessed Linux - Newbie 7 09-11-2002 04:37 PM

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

All times are GMT -5. The time now is 10:44 AM.

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