LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-23-2014, 01:22 AM   #1
pumoritech
LQ Newbie
 
Registered: Jul 2014
Posts: 3

Rep: Reputation: Disabled
kernel panic: init not found (problem with custom built initrd.img) cpio command


I have this python script which builds bootable usb drive with SysLinux based minimal Linux with linux kernel(bzimage), syslinux.cfg, ldlinux.sys and initrd.img. The script also builds initrd.img (a cpio archive) from various files (a linux file structure bin, dev, etc, proc, user, var) init program etc.
But the problem is when i try to boot my x86 machine with this usb driver. Kernel gets loaded then initrd.img but then it errors out saying - kernel panic, init not found.
But I actually also have access to initrd.img that is working (ie. machine is booting without any issues). If I replace my initrd.img with working initrd.img it works so problem is with my initrd.img. I tried to see the contents of initrd.img and compare. I did:
sudo cp initrd.img initrd.gz
sudo gunzip initrd.gz
cpio -i -t < initrd
both of them seem to be same. except for few python libraries in /usr/lib.
I am not sure why my initrd.img is not working. Since I need to modify files in the filesystem I need to run python script to archive and build initrd.img. Is there any way to modify/add or delete files from cpio archive. I tried to do cpio -i initrd. It tries to replace files and directories in my Linux system such as /usr /bin init etc.
 
Old 07-23-2014, 02:28 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,289

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
The two initrds could be the same, but the kernel configs different. Itś defficult to provide the details of a fix when we don have the details of a problem. Trace through are yopur chipset/hard disk and filesystems all supported. Thatś the usual issue.
 
Old 07-23-2014, 01:15 PM   #3
pumoritech
LQ Newbie
 
Registered: Jul 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Everything else is same. Besides initrd.img, bootable usb driver has
efi bzImage ldlinux.sys startup.nsh and syslinux.cfg. If I replace my initrd.img with working initrd.img and make a bootable USB driver, it works too. so the problem is initrd.img. that is why I want to use cpio tool to modify just one or two files in working initrd.img and try to boot.
My syslinux.cfg looks like this:
default Linux

prompt 1

label Linux

timeout 50

kernel bzImage
append console=tty1 vga=773
initrd initrd.img
 
Old 07-23-2014, 02:10 PM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,289

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
Quote:
Everything else is same.
Kernel .config (and version) identical?
 
Old 07-23-2014, 02:26 PM   #5
pumoritech
LQ Newbie
 
Registered: Jul 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
yes. btw i actually compiled init from init.c
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] cpio complains when unpacking initrd.img PeterSteele Red Hat 4 09-26-2012 04:03 PM
[SOLVED] Diskless: Kernel panic-not syncing: No init found. Try passing init= option to kernel Pier Gentoo 6 10-10-2011 06:17 AM
Red Hat 3.0 Enterprise kernel panic: no init found. try pasing init= option to kernel ytd Linux - Newbie 2 04-01-2010 11:45 PM
again.. kernel panic & no init found problem VertX Linux - Software 1 02-20-2005 08:54 AM
Custom Kernel / No INIT / initrd? azl Linux - Newbie 2 11-01-2003 09:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:47 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
Open Source Consulting | Domain Registration