LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-28-2016, 02:43 PM   #1
fanoflq
Member
 
Registered: Nov 2015
Posts: 235

Rep: Reputation: Disabled
cpio : Unable to extract


Code:
user1@host ~/backup $ ls -al include.cpio 
ls: cannot access include.cpio: No such file or directory

user1@host ~/backup $ find /usr/include | cpio -o > include.cpio
35933 blocks

user1@host ~/backup $ ls -al include.cpio 
-rw-r--r--. 1 user1 user1 18397696 Jul 28 12:33 include.cpio

user1@host ~/backup $ mkdir cpio
Now I extract:
Code:
user1@host ~/backup $ cd cpio

# Extracting cpio file.
user1@host ~/backup/cpio $ cpio -i < ~/backup/include.cpio
# a bunch of lines were printed out.... e.g. 
... ... 
cpio: /usr/include/gssapi.h not created: newer or same age version exists
cpio: /usr/include/gmpxx.h not created: newer or same age version exists
cpio: /usr/include/cursslk.h not created: newer or same age version exists
35933 blocks


~/backup/cpio $ ls *.*
ls: cannot access *.*: No such file or directory
I am suppose to get those files extracted in
same folder where the extraction command was executed.

But it is trying to extract to original folder, /usr/include.

Why am I not able to extract the cpio file to current folder?

Last edited by fanoflq; 07-28-2016 at 03:01 PM.
 
Old 07-28-2016, 03:04 PM   #2
fanoflq
Member
 
Registered: Nov 2015
Posts: 235

Original Poster
Rep: Reputation: Disabled
Solution, add option --no-absolute-filenames like so:

Quote:
~/backup/cpio $ cpio -id --no-absolute-filenames < ~/backup/include.cpio
cpio: Removing leading `/' from member names
35933 blocks

user1@host ~/backup/cpio $ cd usr
user1@host ~/backup/cpio/usr $ cd include/
user1@host ~/backup/cpio/usr/include $ ls -al | wc -l
191

user1@host /usr/include $ ls -al | wc -l
191

Last edited by fanoflq; 07-28-2016 at 03:13 PM.
 
Old 07-28-2016, 03:06 PM   #3
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 5,387

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
Try --no-absolute-filenames option
Code:
`--no-absolute-filenames'
     Create all files relative to the current directory in copy-in
     mode, even if they have an absolute file name in the archive.
 
1 members found this post helpful.
Old 07-28-2016, 03:26 PM   #4
fanoflq
Member
 
Registered: Nov 2015
Posts: 235

Original Poster
Rep: Reputation: Disabled
I figured it out seconds B4 you did... :-)
Thank you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 to make cpio extract to a folder rng Linux - General 1 12-11-2015 04:00 AM
CPIO extract error ramnath Linux - Software 2 06-02-2011 11:22 AM
Extract cpio.gz file iqbal mohd Red Hat 3 07-17-2010 12:16 AM
How to use cpio to extract a cpio archive? linx win Debian 4 06-17-2005 02:53 PM
CPIO will not extract File stress Linux - Software 2 07-22-2004 02:04 AM


All times are GMT -5. The time now is 05:05 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration