You are not logged in.

#1 2011-06-15 17:06:07

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Booting custom initrd.img: "Inconsistent filesystem structure"

I'm trying to make a RAM-only instance of Arch by a complete chroot in an initrd.img. With the chroot 100% functional, I run this function against it ($1 being the chroot), and I get an error when booting via grub about an inconsistent filesystem structure.  What am I doing wrong?

create-initrd() {
 msg "Compressing chroot with cpio"
 cd "$1"
 cpio --verbose -H newc -o < <(find .) > ../initrd.img
 cd "$OLDPWD"

 msg "Compressing chroot with xz"
 xz -v9 initrd.img && mv -v initrd.img.xz initrd.img

Offline

#2 2011-06-16 12:08:41

skodabenz
Banned
From: Tamilnadu, India
Registered: 2010-04-11
Posts: 382

Re: Booting custom initrd.img: "Inconsistent filesystem structure"

Try

cd "$1"
find . -print0 | bsdcpio -0oH newc -v | xz --check=crc32 -9 -v > ../initrd.img
cd "${OLDPWD}"

My new forum user/nick name is "the.ridikulus.rat" .

Offline

#3 2011-06-21 22:21:41

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: Booting custom initrd.img: "Inconsistent filesystem structure"

Ooooh, that actually did the trick!  However, due to the initrd being fairly large, an lzma2-compressed image takes about 5 minutes to extract.  I would like to have a raw cpio archive, but can't get that to work.  Does this look okay?

bsdcpio -0oH newc -v < <(find . -print0) > "../$dest.img"

Offline

#4 2011-06-22 03:48:59

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Booting custom initrd.img: "Inconsistent filesystem structure"

Why make this hard? Keep the pipeline that skodabenz gave you, just remove the second pipe.

find . -print0 | bsdcpio -0oH newc > initramfs

I'm not sure if the -v option writes to stderr or stdout, but if its writing to stdout, that would be a problem. Man page says stderr.

I've made plenty of uncompressed initramfs images that have worked without issue. mkinitcpio will create them if you specify COMPRESSION=cat

Last edited by falconindy (2011-06-22 04:13:35)

Offline

Board footer

Powered by FluxBB