public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* PID of init != 1 when initrd with pivot_root
@ 2001-06-01  2:06 Ivan
  2001-06-01  4:11 ` H. Peter Anvin
  2001-06-02 20:02 ` Ivan
  0 siblings, 2 replies; 6+ messages in thread
From: Ivan @ 2001-06-01  2:06 UTC (permalink / raw)
  To: linux-kernel

Well, I upgraded and found pivot_root and the problem is that how do I make init
run with PID 1. My linuxrc gets PID 7.

    1 ?        00:03:05 swapper
    2 ?        00:00:00 keventd
    3 ?        00:00:00 kswapd
    4 ?        00:00:00 kreclaimd
    5 ?        00:00:00 bdflush
    6 ?        00:00:00 kupdated
    7 ?        00:00:00 linuxrc

init doesn't like running with any other PID than 1. I could probably revert to
the not so old way of doing things and exit linuxrc and let the kernel change
root. But then I wouldn't be able to mount root over samba :-(. ( not that I
have any samba shares :-)

Ivan Vadovic

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PID of init != 1 when initrd with pivot_root
  2001-06-01  2:06 PID of init != 1 when initrd with pivot_root Ivan
@ 2001-06-01  4:11 ` H. Peter Anvin
  2001-06-02 20:02 ` Ivan
  1 sibling, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2001-06-01  4:11 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <20010601040627.A1335@ivan.doma>
By author:    Ivan <pivo@pobox.sk>
In newsgroup: linux.dev.kernel
>
> Well, I upgraded and found pivot_root and the problem is that how do I make init
> run with PID 1. My linuxrc gets PID 7.
> 
>     1 ?        00:03:05 swapper
>     2 ?        00:00:00 keventd
>     3 ?        00:00:00 kswapd
>     4 ?        00:00:00 kreclaimd
>     5 ?        00:00:00 bdflush
>     6 ?        00:00:00 kupdated
>     7 ?        00:00:00 linuxrc
> 
> init doesn't like running with any other PID than 1. I could probably revert to
> the not so old way of doing things and exit linuxrc and let the kernel change
> root. But then I wouldn't be able to mount root over samba :-(. ( not that I
> have any samba shares :-)
> 

This is this way for backwards bug compatibility.  Use the following
command line options to make it behave properly:

	ram=/dev/ram0 init=/linuxrc

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PID of init != 1 when initrd with pivot_root
  2001-06-01  2:06 PID of init != 1 when initrd with pivot_root Ivan
  2001-06-01  4:11 ` H. Peter Anvin
@ 2001-06-02 20:02 ` Ivan
  2001-06-05 15:56   ` W. Michael Petullo
  1 sibling, 1 reply; 6+ messages in thread
From: Ivan @ 2001-06-02 20:02 UTC (permalink / raw)
  To: linux-kernel

> > Well, I upgraded and found pivot_root and the problem is that how do I make init
> > run with PID 1. My linuxrc gets PID 7.
> > 
> >     1 ?        00:03:05 swapper
> >     2 ?        00:00:00 keventd
> >     3 ?        00:00:00 kswapd
> >     4 ?        00:00:00 kreclaimd
> >     5 ?        00:00:00 bdflush
> >     6 ?        00:00:00 kupdated
> >     7 ?        00:00:00 linuxrc
> > 
> > init doesn't like running with any other PID than 1. I could probably revert to
> > the not so old way of doing things and exit linuxrc and let the kernel change
> > root. But then I wouldn't be able to mount root over samba :-(. ( not that I
> > have any samba shares :-)
>
> This is this way for backwards bug compatibility.  Use the following
> command line options to make it behave properly:
>
>         ram=/dev/ram0 init=/linuxrc

That's what I did, almost. I think you meant root=/dev/rd/0 init=/linuxrc ( with
devfs) though init parameter is made redundant by the new "root change
mechanism" pivot_root.

But the problem still remains. How do I make my /sbin/init run with PID 1 using
initial ramdisk under the new root change mechanism? I don't want to use the old
change_root mechanism since the Documentation/initrd.txt says:

Obsolete root change mechanism
------------------------------

The following mechanism was used before the introduction of pivot_root.
Current kernels still support it, but you should _not_ rely on its
continued availability.
...
This old, deprecated mechanism is commonly called "change_root", while
the new, supported mechanism is called "pivot_root".

--
Ivan Vadovic

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PID of init != 1 when initrd with pivot_root
  2001-06-02 20:02 ` Ivan
@ 2001-06-05 15:56   ` W. Michael Petullo
  2001-06-05 19:36     ` Ivan Vadovic
  2001-06-05 19:45     ` Kai Germaschewski
  0 siblings, 2 replies; 6+ messages in thread
From: W. Michael Petullo @ 2001-06-05 15:56 UTC (permalink / raw)
  To: Ivan; +Cc: linux-kernel

>>> Well, I upgraded and found pivot_root and the problem is that how do I make
>>> init run with PID 1. My linuxrc gets PID 7.
>>> 
>>>     1 ?        00:03:05 swapper
>>> ...
>>>     7 ?        00:00:00 linuxrc
>>> 
>>> init doesn't like running with any other PID than 1. I could probably revert
>>> to the not so old way of doing things and exit linuxrc and let the kernel 
>>> change root. But then I wouldn't be able to mount root over samba :-(.
>>>
>>> ...

>> This is this way for backwards bug compatibility.  Use the following
>> command line options to make it behave properly:
>>
>>         ram=/dev/ram0 init=/linuxrc

> ...
>
> But the problem still remains. How do I make my /sbin/init run with PID 1 
> using initial ramdisk under the new root change mechanism? I don't want to 
> use the old change_root mechanism...

I had the same problem when doing some development for mkCDrec.
This project uses busybox, whose init does not run if its PID != 1.
I asked the busybox folks same question you did and never got a response.

As a kludge, and after looking at the busybox source code, I renamed init
to linuxrc.  In this case the program is functionally equivalent to init,
except that it does not do the PID == 1 check.

An excerpt from my real linuxrc:

echo Pivot_root: my PID is $$
# exec /usr/sbin/chroot . /sbin/init < dev/console > dev/console 2>&1
# Okay, try this:
exec /usr/sbin/chroot . /sbin/linuxrc < /dev/console > /dev/console 2>&1

/sbin/linuxrc is actually init, renamed.

I am sure this is not the preferred method.  Please let me know if you
find the correct solution.

-- 
W. Michael Petullo

:wq

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PID of init != 1 when initrd with pivot_root
  2001-06-05 15:56   ` W. Michael Petullo
@ 2001-06-05 19:36     ` Ivan Vadovic
  2001-06-05 19:45     ` Kai Germaschewski
  1 sibling, 0 replies; 6+ messages in thread
From: Ivan Vadovic @ 2001-06-05 19:36 UTC (permalink / raw)
  To: W. Michael Petullo; +Cc: linux-kernel

> > But the problem still remains. How do I make my /sbin/init run with PID 1 
> > using initial ramdisk under the new root change mechanism? I don't want to 
> > use the old change_root mechanism...
> 
> I had the same problem when doing some development for mkCDrec.
> This project uses busybox, whose init does not run if its PID != 1.
> I asked the busybox folks same question you did and never got a response.
> 
> As a kludge, and after looking at the busybox source code, I renamed init
> to linuxrc.  In this case the program is functionally equivalent to init,
> except that it does not do the PID == 1 check.
> 
> An excerpt from my real linuxrc:
> 
> echo Pivot_root: my PID is $$
> # exec /usr/sbin/chroot . /sbin/init < dev/console > dev/console 2>&1
> # Okay, try this:
> exec /usr/sbin/chroot . /sbin/linuxrc < /dev/console > /dev/console 2>&1
> 
> /sbin/linuxrc is actually init, renamed.
> 

I fugured it out. The Documentation/initrd.txt says to use root=/dev/rd/0 with
devfs. Well, that's wrong. You should use root=/dev/ram0 even with devfs no
matter what the documentation says. And my linuxrc finaly runs with PID == 1.

Ivan Vadovic

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PID of init != 1 when initrd with pivot_root
  2001-06-05 15:56   ` W. Michael Petullo
  2001-06-05 19:36     ` Ivan Vadovic
@ 2001-06-05 19:45     ` Kai Germaschewski
  1 sibling, 0 replies; 6+ messages in thread
From: Kai Germaschewski @ 2001-06-05 19:45 UTC (permalink / raw)
  To: W. Michael Petullo; +Cc: Ivan, linux-kernel

On Tue, 5 Jun 2001, W. Michael Petullo wrote:

> > But the problem still remains. How do I make my /sbin/init run with PID 1
> > using initial ramdisk under the new root change mechanism? I don't want to
> > use the old change_root mechanism...
>
> I had the same problem when doing some development for mkCDrec.
> This project uses busybox, whose init does not run if its PID != 1.
> I asked the busybox folks same question you did and never got a response.

Maybe I'm wrong here, but I had the same problem at some point and my
solution was to rename /linuxrc (to /linux, and booting with init=/linux).
I believe the code which special cases /linuxrc might be in the way here.

Maybe you want to try this, if it helps I think Documentation/initrd.txt
needs to be updated.

--Kai




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-06-05 19:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-01  2:06 PID of init != 1 when initrd with pivot_root Ivan
2001-06-01  4:11 ` H. Peter Anvin
2001-06-02 20:02 ` Ivan
2001-06-05 15:56   ` W. Michael Petullo
2001-06-05 19:36     ` Ivan Vadovic
2001-06-05 19:45     ` Kai Germaschewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox