On 10/05/2015 20:14, Guillermo wrote:
I mostly followed the example init scripts, but I did deviate, among other things to delegate tasks to OpenRC (as a bundle of oneshot services in s6-rc terminology, hehe). And now that you remind me they were originally there, I don't have the fdclose 1 and fdclose 2 in stage 1 either. I wanted the stage 2 init to have open FDs to /dev/console, to show OpenRC's output.
Aren't you redirecting all the logs to a catch-all logger, the one I call "s6-svscan-log" in the examples/ subdirectory ? It's entirely possible to do without a catch-all logger, but if there's ever something wrong with the supervision tree (e.g. one of your services cannot start), your /dev/console will get spammed.
No kernel complaints when sysvinit is process 1 (I don't know what it does with its open FDs), no kernel complaints with the custom stage 1 init having devfs start with open FDs to /dev/console and /dev/null. There is no unmounting /dev (maybe that's specifically what would trigger an EBUSY?). The kernel has CONFIG_DEVTMPFS_MOUNT=n, so no devtmpfs is mounted after the rootfs. And when I boot with init=/bin/bash, "mount" shows nothing but / and a manually mounted /proc. However, /dev is not empty. I don't know where the device nodes came from, but they are there. I didn't create them, maybe they were put in there during Gentoo's installation, I don't know. I fact, the after boot /dev looks quite different (and I do see a devtmpfs mounted). A "mount --bind / /tmp" shows me the original boot time /dev, so I suppose the root FS has actual static device nodes.
Yeah, that must be it: static device nodes in your rootfs, but they are overriden by the ones in your devtmpfs when you mount it. But when I tried that a few years ago, mounting a new /dev when there were still fds open to it simply didn't work. They must have changed that. And if the behaviour you're observing can be consistently relied upon, that's pretty good news. -- Laurent