LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 03-04-2003, 01:30 PM   #16
echan4
LQ Newbie
 
Registered: Mar 2003
Posts: 5

Rep: Reputation: 0
initrd, pivot_root and chroot


Hello nxny,

I use GRUB as bootloader and the kernel used is 2.4.19-mdk.

The line in GRUB bootloader reads:

title Test pivot_root
root (hd0,0)
kernel /boot/vmlinuz-2.4.19-mdk root=/dev/ram0 rw init=/linuxrc vga=4
initrd /boot/r2initrd.img

As far as I know, GRUB doesn't have a config file like Lilo ( which I know little of )

When I removed the command line entries

root=/dev/ram0 rw init=/linuxrc

linuxrc gets PID != 1 ( it gets 8, after kswapper etc,etc ).

Then /sbin/init would not behave....

You can use a copy of init ( such as /sbin/init2 ) as has been previously suggested by others and then kernel ? doesn't care if it does not run with PID==1.

Thanks for your advice regarding abiity to edit the post - very handy indeed..

regards,

edc
 
Old 03-04-2003, 02:13 PM   #17
nxny
Member
 
Registered: May 2002
Location: AK - The last frontier.
Distribution: Red Hat 8.0, Slackware 8.1, Knoppix 3.7, Lunar 1.3, Sorcerer
Posts: 771

Rep: Reputation: 30
You kick a**, buddy. Here's to a hero.

GRUB does have a bootloader conf file and it is usually /boot/grub/menu.lst Some distros symlink this file to /etc/grub.conf. The advantage with GRUB is that you dont have to _remember_ to run the map installer to 'apply' your changes.. not to mention the fact that it is filesystem aware and lets you choose your kernel at runtime.

Quote:
You can use a copy of init ( such as /sbin/init2 ) as has been previously suggested by others and then kernel ? doesn't care if it does not run with PID==1.
Would you elaborate on what you've said there? Are you saying that the copy of init doesn't care if it is PID 1?
 
Old 03-04-2003, 03:23 PM   #18
echan4
LQ Newbie
 
Registered: Mar 2003
Posts: 5

Rep: Reputation: 0
initrd, pivot_root , chroot

Ok,

What I understand is:

if you use /sbin/init , the PID ( of linuxrc) must be 1, and since it is going to be 'exec'ed , the PID will be passed to the chroot process.

But if you named /sbin/init as /sbin/ini2 < or whatever> , then ( for reasons unkown to me ) , it ( linuxrc) doesn't have be PID == 1 , the only proviso is that you have to pass /sbin/init2 < orr whatever > the "Q" or "q" paramater.

the kernel command line root=/dev/ram0 rw init=/linuxrc has the effect of setting the PID linuxrc to 1., according to the forum posts.

Regards,

edc
 
Old 03-04-2003, 04:15 PM   #19
nxny
Member
 
Registered: May 2002
Location: AK - The last frontier.
Distribution: Red Hat 8.0, Slackware 8.1, Knoppix 3.7, Lunar 1.3, Sorcerer
Posts: 771

Rep: Reputation: 30
AHA. That clears it up a bit. I still have questions, but I'll have to dig in to the sources of sysvinit to clear them up, I guess.

/sbin/telinit is a symlink to /sbin/init . They are calling the same binary which behaves one way or the other depending on
1) the command line ( argv[0])
2) $pid of the process

When you name the binary a third name other than 'init' or 'telinit' ( init2 or similar ), it disregards the condition 2 above is my blind conclusion. As I said, the source should answer it for sure.

Thanks, echan4.
 
Old 10-06-2003, 11:16 AM   #20
Hans Zarkoff
Member
 
Registered: Apr 2002
Location: Canada
Distribution: Slackware
Posts: 58

Original Poster
Rep: Reputation: 15
I took a break from this and have fiddled with it for the last week.

Actually, the latest kernel (2.4.22) has support for Linux software RAID for the highpoint cards. So I just included it in the kernel and I didn't have to deal with pivot_root. Unfortunately, it doesn't support RAID 5, which is what I wanted it to do. So I was back to where I started... Grrr...

I didn't want to use GRUB because I'm old and fear change. I found a link that completely skips the pivot_root call and it worked 100% for me!

http://www.tldp.org/HOWTO/Kernel-HOW...e_initrd.html. There are instructions at the bottom for those of us that don't have mkinitrd.

I'm surprised it worked, actually. You specify initrd=/path/to/initrd.gz but you specify root=/dev/sda1 (your actual root drive) rather than /dev/ram0. LILO is smart enough to mount your initrd and then pivot(?) to the real drive. Problem solved.

This was nice and easy and rather anti-climactic.

This thread worked out rather well. Anyone with pivot_root problems can pretty much come here and their problems will be fixed. If not, we're all a lot more experienced now and can help them out!

I'm using LILO 22.5.7.2. I recommend upgrading if you use this solution.
 
Old 10-23-2007, 12:45 AM   #21
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Rep: Reputation: 39
I need some help in modifying the initrd on installation DVD of one of the distributions it does not have the linuxrc script by the same name rather it has linuxrc.conf file
and an init script which I guess is the same as the linuxrc because without it I can not start installation ,I would like to know how to create a initrd file that has linuxrc also if some one can point to sample linuxrc
and any documentation for making initrd from scratch (ex busybox etc) not from the mkinitrd script that works that would be great.
 
Old 10-23-2007, 10:35 PM   #22
Hans Zarkoff
Member
 
Registered: Apr 2002
Location: Canada
Distribution: Slackware
Posts: 58

Original Poster
Rep: Reputation: 15
Errr, wow, this is an old thread. I've had three kids since my last post in '03!

Honestly, I can't remember much about the initrd. I typed initrd into google and got a bazillion hits. If nothing there suits you, post again and we'll take a look at your specific problem.

Hans
 
Old 10-24-2007, 01:06 PM   #23
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Rep: Reputation: 39
Quote:
Originally Posted by Hans Zarkoff View Post
Errr, wow, this is an old thread. I've had three kids since my last post in '03!

Honestly, I can't remember much about the initrd. I typed initrd into google and got a bazillion hits. If nothing there suits you, post again and we'll take a look at your specific problem.

Hans
Actually I do not want to waste time of a lot of people in reading a new thread which had already been answered as per my requirements and what I asked is similar to this one now coming the point

I was trying to modify the init script inside the initrd that is present on ISO of linux distros which invokes the linuxrc to mount the CDROM and does a pivot_root for installation since I am trying to learn from my experiments so I needed some link where I can get a sample init which invokes linuxrc that I actually wanted as reference material to study I had done a good amount of googling this is the reason why I posted on such an old thread and searched on forums might be I went in some wrong direction.
http://www.mjmwired.net/kernel/Docum...tramfs.txt#252
I read this link and want to proceed accordingly so a sample linuxrc or init would help.
 
  


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
I got a error flag "init: /dev/initctl: no such file" mst700 Linux - Newbie 4 10-28-2007 08:00 AM
Boot failure at pivot_root jcspray Linux - Software 1 10-20-2005 11:51 AM
Pivot_root: No such file or directory LinuxChristian Debian 3 07-22-2005 06:35 AM
pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed: 2 5150 Red Hat 2 04-17-2004 02:41 PM
Kernel Panic: pivot_root (/sysroot, /sysroot/initrd) Faild: 2 Help Needed KingofBLASH Linux - General 8 12-20-2003 09:43 AM

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

All times are GMT -5. The time now is 06:05 AM.

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