linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rene Mayrhofer <rene.mayrhofer@gibraltar.at>
To: vda@port.imtp.ilyichevsk.odessa.ua
Cc: linux-kernel@vger.kernel.org
Subject: Re: pivot_root seems to be broken in 2.4.21-ac4
Date: Tue, 22 Jul 2003 08:50:01 +0200	[thread overview]
Message-ID: <3F1CDE99.6000505@gibraltar.at> (raw)
In-Reply-To: <200307220622.h6M6MTj20460@Port.imtp.ilyichevsk.odessa.ua>

Hi Denis,

[Please CC me in replies, I am currently not subsribed to this list.]

Denis Vlasenko wrote:
>         btw you probably have to remove leading / ^^^
These calls are still within the old root, so it should IMHO be ok.

>><snip>
>>exit 0
> 
> 
> Hm... I thought you are running with pid 1 and have to do
> 
> exec chroot . /sbin/init <dev/console >/dev/console 2>&1
> 
> or the like as a final command.
I am not using pivot_root for switching from an initrd to the real root 
fs in this case, but I use it to switch roots on the fly during 
run-time. Specifically, I have defined a maintainance runlevel with the 
root fs being a harddisk partition and a normal runlevel with the rootfs 
being a (read-only) cramfs (constructed from the harddisk partition). 
This allows the machine (which basically acts as a router and does a few 
other neats things) to switch off the harddisk during normal operation 
(running completely off RAM), but also allows very simple changes in 
maintainance mode. Switching between those modes only means that the 
daemons need to be stopped for a few seconds, but all network 
connections stay alive because the kernel keeps running.

The scripts for doing the on-the-fly root fs switch are working quite 
well by now, but with 2.4.21-ac4 I have the described problem. It worked 
perfectly with 2.4.21-rc2.

> See? fd 3 is open to /dev/initctl in init AND in kernel daemons.
> I conclude that daemons simply share fd table with init.
> 
> So you might try to do the exec chroot . /sbin/init trick
> and see whether that works.
I tell init to re-execute itself (after pivot_root and thus from the new 
root fs), which causes init to close its old fds and open new ones from 
the new root fs with. This is necessary because init already runs as pid 
1 when I start the root fs switching. Maybe something changed with the 
kernel process fds from 2.4.21-rc2 to 2.4.21-ac4 ?

best regards,
Rene




  reply	other threads:[~2003-07-22  6:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-21 20:53 pivot_root seems to be broken in 2.4.21-ac4 Rene Mayrhofer
2003-07-22  6:24 ` Denis Vlasenko
2003-07-22  6:50   ` Rene Mayrhofer [this message]
2003-07-22 17:37     ` Jason Baron
2003-07-22 17:40       ` Alan Cox
2003-07-22 18:03         ` Rene Mayrhofer
2003-07-22 20:00           ` Alan Cox
2003-07-22 20:37             ` Rene Mayrhofer
2003-07-22 21:54               ` Alan Cox
2003-07-23  6:23                 ` pivot_root seems to be broken in 2.4.21-ac4 and 2.4.22-pre7 Rene Mayrhofer
2003-07-22 22:14             ` pivot_root seems to be broken in 2.4.21-ac4 Mika Penttilä
2003-07-22 23:38               ` Alan Cox
2003-07-23  6:30                 ` pivot_root seems to be broken in 2.4.21-ac4 and 2.4.22-pre7 Rene Mayrhofer
2003-07-24  2:24                   ` Jason Baron
2003-07-24  7:11                     ` Rene Mayrhofer
2003-07-22 18:25         ` pivot_root seems to be broken in 2.4.21-ac4 Mika Penttilä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F1CDE99.6000505@gibraltar.at \
    --to=rene.mayrhofer@gibraltar.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vda@port.imtp.ilyichevsk.odessa.ua \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).