| Author |
Message |
pifu
Joined: 21 Dec 2011 Posts: 4 Location: Italy
|
Posted: Wed 21 Dec 2011, 15:51 Post subject:
cpio and initrd Subject description: cpio (Puppy Wary511) creates unloadable initrd |
|
[Puppy Wary 511 frugal install on hda1]
While trying to customize the init script in initrd.gz, I found cpio to be buggy. Specifically, it is unuseful for creating a valid initrd.gz file.
You can repeat my test entering these commands, which simply unpack the initial ramdisk tree and rebuild it unchanged:
cp /initrd.gz /initrd.gz.ORIG
mkdir /tmp/mydir
cd /tmp/mydir
cp /initrd.gz .
gunzip initrd.gz
cpio -ivumd initrd
rm initrd
find . -print -depth | cpio -ov -H newc > initrd
gzip -9 initrd
mv initrd.gz /
When rebooting, I got the message "Kernel panic: not syncing: no init found".
Note that using another version of cpio (in my case, cpio from "System Rescue CD" Linux distro) solved the problem.
|
|
Back to top
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 2675 Location: Kiel,Germany
|
Posted: Wed 21 Dec 2011, 16:52 Post subject:
|
|
Here we are used to do it that way :
bash-3.2# cpio -id <initrd
4186 blocks
bash-3.2# rm initrd
bash-3.2# find . | cpio -o -H newc >initrd
cpio: File ./initrd grew, 5120 new bytes not copied
4197 blocks
bash-3.2# cpio -id <initrd
cpio: initrd not created: newer or same age version exists
4197 blocks
bash-3.2# | Code: | mkdir ./new-initrd
cd ./new-initrd/
zcat ../initrd.gz |cpio -id |
4186 blocks
bash-3.2# | Code: | mv ../initrd.gz ../initrd.gz.orig
find . |cpio -o -H newc |gzip -9 > ../initrd.gz.new |
4186 blocks
|
|
Back to top
|
|
 |
pifu
Joined: 21 Dec 2011 Posts: 4 Location: Italy
|
Posted: Thu 22 Dec 2011, 16:16 Post subject:
|
|
| Karl Godt wrote: | Here we are used to do it that way :
--- 8< ---
|
Ok.
But I still obtain an unloadable initrd.gz.
Can you confirm that?
|
|
Back to top
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 2675 Location: Kiel,Germany
|
Posted: Fri 23 Dec 2011, 07:33 Post subject:
|
|
What do you want to do ?
If your are so clever to alter the initrd.gz you should also have detected the pfix=rdsh parameters .
There are two init : /sbin/init inside the sfs and /init inside the initrd.gz
What happens when booting ?
Why do you want to change something inside the initrd ?
How does your bootloader line looks like ?
for q in `seq 1 1 $RANDOM`, I have Q and Q and Q;ME had
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3843
|
Posted: Fri 23 Dec 2011, 09:45 Post subject:
|
|
last time I got that error, it was a typo in my menu.lst
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
pifu
Joined: 21 Dec 2011 Posts: 4 Location: Italy
|
Posted: Fri 23 Dec 2011, 11:12 Post subject:
|
|
| Karl Godt wrote: | | What do you want to do ? |
Hi Karl,
I already did what I need: as I wrote in my first post, I customized /init inside the initrd.gz using *another* version of cpio.
(BTW, the change in /init was made to avoid the use of tmpfs for /tmp dir: I still prefer to have it on hda1. But this is NOT the point of this thread).
What I cannot understand is why an initrd.gz built using my Wary511's cpio DOES cause the "Kernel panic: not syncing: no init found" error, whilst using another cpio version DOES NOT.
Strange, huh.
|
|
Back to top
|
|
 |
technosaurus

Joined: 18 May 2008 Posts: 3843
|
Posted: Fri 23 Dec 2011, 11:44 Post subject:
|
|
Perhaps the other version is patched to use the newc option by default (it is required iirc)
_________________ Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
|
|
Back to top
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 2675 Location: Kiel,Germany
|
Posted: Fri 23 Dec 2011, 15:39 Post subject:
|
|
I am still uncertain about the error msg .
Does /init of the initrd.gz still gets executed but after switch_root /sbin/init not found ?
This would indicate wrong adjustments to the code .
There are actually some scripts to work with /tmp and hopefully everything is OK is this case .
If /init in /initrd.gz is not found i suspect that
cpio creates some folder like initrd/initrd and the files get put on another level of the directory hierarchy ( 1 deeper )
OR cpio does not put the files on top level into the initrd
OR the obscure find parameters are doing something not right
OR cpio OR gzip had changed permissions ie made /init non-executable
OR you are working on a win-fs vfat/ntfs which might confuse permissions
OR you did not pack the initrd.gz correctly the first time and cannot remember the tzpo ..
OR your USB is not plugged tight into the port sometimes
OR
bash-3.00# busybox-orig cpio
BusyBox v1.16.2 (2010-06-19 18:02:46 GMT- multi-call binary.
Usage: cpio [-dmvu] [-F FILE] [-H newc] [-tio] [-p DIR]
Extract or list files from a cpio archive, or
create an archive (-o) or copy files (-p) using file list on stdin
Main operation mode:
-t List
-i Extract
-o Create (requires -H newc)
-p DIR Copy files to DIR
Options:
-d Make leading directories
-m Preserve mtime
-v Verbose
-u Overwrite
-F FILE Input (-t,-i,-p) or output (-o) file
-H newc Archive format
OR file `which cpio`
/bin/cpio: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.15, dynamically linked (uses shared libs), stripped
OR OR OR .
I am booting my USB pen ext3 formatted also the save file .
No probs . USB flash is so cheap that i don't fear these wear out fairy tales .
You should attach a non-functioning initrd.gz plus a tail $HOME/.history ...
I am using wary 07 with its many kernels sometimes but wary 511 is newer .
|
|
Back to top
|
|
 |
pifu
Joined: 21 Dec 2011 Posts: 4 Location: Italy
|
Posted: Sat 24 Dec 2011, 14:43 Post subject:
|
|
| Karl Godt wrote: | | Does /init of the initrd.gz still gets executed but after switch_root /sbin/init not found ? |
Hi Karl.
The kernel cannot load /init from initrd.gz. The error msg is clear enough.
I also tried other tests:
1) starting from a new, fresh, fully functional Wary 511 frugal install on /dev/hda1:
| Code: |
# cp /initrd.gz /initrd.gz.ORIG
# mkdir /mytmp
# cd /mytmp
# zcat /initrd.gz | cpio -iud
7588 blocks
# find . -depth -print | cpio -o -H newc | gzip -9 > /initrd.gz
7588 blocks
|
(i.e., simply un- and re-packing original initrd.gz file).
Then reboot.
Then: Kernel panic: not syncing: no init found. Try passing init= option to kernel.
2) The counter-check:
boot from a Linux System Rescue CD, then:
| Code: |
# mkdir /mnt/hd
# mount /dev/hda1 /mnt/hd
# cd /mnt/hd
# rm -fr mytmp
# mkdir mytmp
# cd mytmp
# zcat ../initrd.gz.ORIG | cpio -iud
7588 blocks
# find . -depth -print | cpio -o -H newc | gzip -9 > ../initrd.gz
7588 blocks
|
Now reboot from hard disk...
...et voila! Wary Puppy is up and running again!
1) AND 2) ==> buggy Wary's cpio OR buggy Wary's gzip.
3) Last test:
From new, fresh, Wary install:
| Code: |
# cd /
# gunzip initrd.gz
# gzip -9 initrd
|
Then reboot, with no errors.
1) AND 2) AND 3) ==> buggy Wary's cpio (IMHO).
Bye & Merry Xmas[/code]
|
|
Back to top
|
|
 |
|