Re: pivot_root seems to be broken in 2.4.21-ac4

From: Rene Mayrhofer (rene.mayrhofer@gibraltar.at)
Date: Tue Jul 22 2003 - 01:50:01 EST


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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jul 23 2003 - 22:00:45 EST