A tool for creating and extracting archives as well as passing files to another directory tree.
Questions tagged [cpio]
60 questions
48
votes
6 answers
Why is it that my initrd only has one directory, namely, 'kernel'?
I'm using debian live-build to work on a bootable system. By the end of the process i get the typical files used to boot a live system: a squashfs file, some GRUB modules and config files, and an initrd.img file.
I can boot just fine using those…
user986730
- 793
- 1
- 5
- 8
15
votes
3 answers
Why use cpio for initramfs?
I am making my own initramfs following the Gentoo wiki. Instead of the familiar tar and gzip, the page is telling me to use cpio and gzip. Wikipedia says that cpio is used by the 2.6 kernel's initramfs, but does not explain why.
Is this just a…
phunehehe
- 20,030
- 27
- 99
- 151
14
votes
3 answers
How to convince tar (etc.) to archive block device contents?
I have six Linux logical volumes that together back a virtual machine. The VM is currently shutdown, so its easy to take consistent images of them.
I'd like to pack all six images together in an archive. Trivially, I could do something like this:
cp…
derobert
- 107,579
- 20
- 231
- 279
10
votes
2 answers
Appending files to initramfs image - reliable?
I'm modifying a bunch of initramfs archives from different Linux distros in which normally only one file is being changed.
I would like to automate the process without switching to root user to extract all files inside the initramfs image and…
Emilio Lazo
- 243
- 2
- 7
9
votes
4 answers
How to generate initramfs image with busybox links?
Having been directed to initramfs by an answer to my earlier question (thanks!), I've been working on getting initramfs working. I can now boot the kernel and drop to a shell prompt, where I can execute busybox commands, which is awesome.
Here's…
pingswept
- 1,085
- 2
- 9
- 12
8
votes
6 answers
How would you use the cpio command?
While studying for the lpic exam, I've run into the command cpio.
The description of cpio states:
Cpio was originally designed to store backup file archives on a tape
device in a sequential, contiguous manner. Cpio does not compress any
…
spuder
- 17,643
- 36
- 91
- 119
6
votes
1 answer
update-initramfs hangs on debian Stretch
using apt-get upgrade on Debian left me with the decision to update to kernel 4.9.0-6 but the installation never finishes. It always stalls at the following stage:
Setting up linux-image-4.9.0-6-amd64 (4.9.82-1+deb9u3)…
Christian
- 303
- 2
- 9
6
votes
4 answers
Extracting concatenated cpio archives
initramfs archives on Linux can consist of a series of concatenated, gzipped cpio files.
Given such an archive, how can one extract all the embedded archives, as opposed to only the first one?
The following is an example of a pattern which, while it…
Charles Duffy
- 1,651
- 15
- 22
6
votes
4 answers
Unpack, modify and pack initrd as a user
I've got a problem with rebuilding the initrd image as a user. Firstly, when I try to "unpack" the original initrd image:
cpio -idm < initrd-base
cpio: dev/tty8: Cannot mknod: Operation not permitted
cpio: dev/tty3: Cannot mknod: Operation not…
Dejwi
- 221
- 1
- 2
- 7
5
votes
1 answer
How to extract a single file from a cpio archive?
I have a cpio archive with lots of files and I need to extract only one file, not all. With tar I could just use tar -xf archive.tar path/to/file, but that does not work with cpio:
cpio -i < archive.cpio path/to/file
bash: path/to/file: No such file…
manifestor
- 2,423
- 6
- 22
- 47
5
votes
1 answer
How to create ASCII cpio archive (SVR4 with no CRC)?
I have a file in /boot/initramfs.gz
extract it using tar -xzvf initramfs.gz -C ./ I got a file initramfs.
└──╼ $ file initramfs
initramfs: ASCII cpio archive (SVR4 with no CRC)
It can be open using ark. But I want to change some files in this file…
dotslash
- 193
- 1
- 2
- 6
4
votes
2 answers
Why do we use `find -depth` with `cpio`
From the info cpio page:
If you wanted to archive an entire directory tree, the find command
can provide the file list to cpio:
% find . -print -depth | cpio -ov > tree.cpio
The '-depth' option forces 'find' to print of the
entries in a…
John Gowers
- 295
- 1
- 3
- 16
4
votes
3 answers
Transform tar into cpio without rooting?
I have a tarball containing many files with root:root owner and/or special device inodes. cpio only accepts paths existing in the file system when it is creating a cpio archive. And I don't want to have to sudo in order to transform tar into cpio,…
Thiner
- 41
- 4
4
votes
2 answers
what are the techniques to extract files safely?
Yesterday I was making some experiments on Slitaz. It uses multiple initrd.img's to store files/changes.
I wanted to extract one of its initrd.gz images (which is a cpio archive) to a folder, edit/remove them, repack again.
I used this code:
cat…
ceremcem
- 2,231
- 1
- 23
- 53
3
votes
1 answer
What is the meaning of the errors from my cpio command?
I have been using the following command on my system to create the .cpio archive to create an initramfs for my embedded target device
sudo find . | cpio -H newc -oc > ~/initramfs.cpio
This has always worked for me without any problem. Yesterday I…
mathematician1975
- 1,453
- 2
- 24
- 43