heliostic wrote:I cd into /usr/src/initramfs, which the source directory of my initramfs.
Why? The kernel's built-in initramfs generator can do a better job and can pull files straight from the live filesystem.
heliostic wrote:There I run
Code: Select all
find . -depth -print0 | cpio -ocv0 > ../custom-initramfs.cpio
to generate the cpio archive and copy the resulting file to /boot.
This looks wrong. Per the documentation:
Code: Select all
The cpio man page contains some bad advice that will break your initramfs
archive if you follow it. It says "A typical way to generate the list
of filenames is with the find command; you should give find the -depth
option to minimize problems with permissions on directories that are
unwritable or not searchable." Don't do this when creating
initramfs.cpio.gz images, it won't work. The Linux kernel cpio extractor
won't create files in a directory that doesn't exist, so the directory
entries must go before the files that go in those directories.
According to that, I believe this output indicates an archive that is guaranteed to fail:
heliostic wrote:Here's the output of
Code: Select all
cpio -tvI custom-initramfs.cpio
-rwxr-xr-x 1 root root 109128 Dec 3 16:14 bin/busybox
drwxr-xr-x 2 root root 0 Dec 3 16:14 bin
drwxr-xr-x 2 root root 0 Dec 3 14:29 mnt/root
drwxr-xr-x 3 root root 0 Dec 3 14:29 mnt
crw-rw-rw- 1 root root 1, 3 Dec 2 21:09 dev/null
brw-rw---- 1 root 994 8, 2 Dec 2 21:09 dev/sda2
crw--w--w- 1 root root 5, 1 Dec 12 18:26 dev/console
crw--w--w- 1 root root 4, 0 Dec 12 18:26 dev/tty0
crw-rw-rw- 1 root tty 5, 0 Dec 2 21:09 dev/tty
drwxr-xr-x 2 root root 0 Dec 12 18:26 dev
I expect that all the shown inner objects will be ignored by the kernel's extractor, leaving you with no
bin/busybox, no
mnt/root on which to mount, and no nodes in
dev. I don't know if having
. at the end will mean you get nothing at all, but even losing the objects I cited will likely break this.
I suggest you generate the initramfs using a list file, so that the kernel can build the archive correctly for you. It produces diagnostics (albeit not great ones) when you make a mistake, and those diagnostics occur at build time, not boot time.
Failing that, I suggest you review the linked documentation for the
cpio invocation that will generate an archive the kernel can consume.