Skip to content

init: explictly issue sync+reboot#648

Merged
slp merged 1 commit intocontainers:mainfrom
slp:init-issue-reboot
Apr 24, 2026
Merged

init: explictly issue sync+reboot#648
slp merged 1 commit intocontainers:mainfrom
slp:init-issue-reboot

Conversation

@slp
Copy link
Copy Markdown
Collaborator

@slp slp commented Apr 24, 2026

So far, we were relying on the kernel to automatically shut down the VM after init exits. This works fine with the libkrunfw kernel, but gives a pretty ugly (though harmless) panic on upstream kernels.

This can easily be avoiding by actually using the reboot() syscall to tell the kernel this is actually what we want to do. Do it after recording the exit code.

So far, we were relying on the kernel to automatically shut down
the VM after init exits. This works fine with the libkrunfw
kernel, but gives a pretty ugly (though harmless) panic on upstream
kernels.

This can easily be avoiding by actually using the reboot() syscall
to tell the kernel this is actually what we want to do. Do it after
recording the exit code.

Signed-off-by: Sergio Lopez <slp@redhat.com>
@slp slp force-pushed the init-issue-reboot branch from 537c90b to 61b2a58 Compare April 24, 2026 10:33
@dorindabassey
Copy link
Copy Markdown
Collaborator

/gemini review

Copy link
Copy Markdown
Collaborator

@mtjhrc mtjhrc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! LGTM

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces system shutdown logic to the init process by adding reboot headers and calling sync() and reboot() when a child process exits. The review feedback highlights several critical issues: the reboot call is placed inside a reaping loop which may cause premature shutdown if multiple children are present, the inclusion of redundant headers, the use of a restart command instead of power-off, and the absence of a safety loop to prevent kernel panics should the reboot syscall fail.

Comment thread init/init.c
Comment thread init/init.c
Comment thread init/init.c
Comment thread init/init.c
@slp
Copy link
Copy Markdown
Collaborator Author

slp commented Apr 24, 2026

I think we have a winner for the most useless Gemini review so far.

@slp slp merged commit 5cfd94d into containers:main Apr 24, 2026
14 checks passed
@slp slp deleted the init-issue-reboot branch April 24, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants