mirror of
https://github.com/nestriness/nestri.git
synced 2026-09-23 03:05:20 +03:00
fix(nesinit): mount what the guest needs before anything asks for it
The root arrives read-only and this process is PID 1, so until it mounts them there is no /proc and nowhere in the filesystem to put a socket. Nothing else in the guest is an init system, so nothing else was going to. The symptom was three failures that look unrelated and share one cause. On a real box the payload relay could not bind, with EROFS; whatever serves the session's address could not bind either, the same way; and this process could not make itself ineligible for the OOM killer, because /proc was not there to write to. What the caller saw was a workload that ran and published nothing, which is true and says nothing about why. /proc is mounted first and unconditionally: finding out what an image already mounted requires it, and it is therefore the one entry that cannot be checked that way itself. Everything after it is skipped when it is already present, so an image that does this properly is not mounted over. Failures warn rather than abort. Refusing to boot would replace a session that fails with a reason by a guest that never dialled out at all, and the second is harder to diagnose from the outside. The relay's directory is named by the module that owns the socket rather than spelled again here, with a test tying the two together: a rename that reached one and not the other would put the relay back exactly as it was.
This commit is contained in:
@@ -40,6 +40,11 @@ fn main() -> anyhow::Result<()> {
|
||||
)
|
||||
.init();
|
||||
|
||||
// Before everything, including the two below: the root is read-only and
|
||||
// nothing else in this guest is an init system, so until this runs there
|
||||
// is no `/proc` to score this process in and nowhere to put a socket.
|
||||
nesinit::filesystems::establish();
|
||||
|
||||
// Both before anything is started, so nothing can be orphaned or scored
|
||||
// in the window where neither is true yet.
|
||||
if let Err(error) = reap::become_subreaper() {
|
||||
|
||||
Reference in New Issue
Block a user