-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shutdown: several fixlets #28648
shutdown: several fixlets #28648
Conversation
uhm doesn't this undo the fix that I did before the release? Where stuff under /run was lost in the transition to initrd? |
IIUC, the previous issue is on initramfs -> host transition on boot. But this is for shutting down, and host -> initramfs transition. |
At least, v253 did not mount /run/ recursively. @@ -162,17 +163,15 @@ static int parse_argv(int argc, char *argv[]) {
}
static int switch_root_initramfs(void) {
- if (mount("/run/initramfs", "/run/initramfs", NULL, MS_BIND, NULL) < 0)
- return log_error_errno(errno, "Failed to mount bind /run/initramfs on /run/initramfs: %m");
-
- if (mount(NULL, "/run/initramfs", NULL, MS_PRIVATE, NULL) < 0)
- return log_error_errno(errno, "Failed to make /run/initramfs private mount: %m");
-
- /* switch_root with MS_BIND, because there might still be processes lurking around, which have open file descriptors.
- * /run/initramfs/shutdown will take care of these.
- * Also do not detach the old root, because /run/initramfs/shutdown needs to access it.
- */
- return switch_root("/run/initramfs", "/oldroot", false, MS_BIND);
+ /* Do not detach the old root, because /run/initramfs/shutdown needs to access it.
+ *
+ * Disable sync() during switch-root, we after all sync'ed here plenty, and a dumb sync (as opposed
+ * to the "smart" sync() we did here that looks at progress parameters) would defeat much of our
+ * efforts here. */
+ return switch_root(
+ /* new_root= */ "/run/initramfs",
+ /* old_root_after= */ "/oldroot",
+ /* flags= */ SWITCH_ROOT_DONT_SYNC);
}
/* Read the following fields from /proc/meminfo:
@@ -341,6 +340,12 @@ int main(int argc, char *argv[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's give it a shot
I'd like to wait for reporter feedback for a while, as I have not tested it. |
Follow-up for 268d124. Hopefully fixes systemd#28648.
722a35e
to
af4a2f4
Compare
@mrc0mmand Could you test again? |
|
@mrc0mmand Does v253 work fine? |
Yep |
It seems so, I don't see any errors even with some debug output sprinkled around: |
af4a2f4
to
b9436d3
Compare
@mrc0mmand @Freyon77 Could you test again? |
This looks promising:
|
Thank you! |
Still looks good!
|
@mrc0mmand what about pivoting root file system failed? |
That's just me setting r to -1 to test the fallback branch, probably should've dropped that from the output. |
Thank you for testing so many times! @bluca Could you take a look again? |
I queued up all three commits for v254.1. |
So I am pretty sure the 2nd commit is not right. It's not load-bearing for the bugfix this PR is supposed to be, is it? I prepped #28793 that reverts that part. Please take a look for an explanation. |
This should provide coverage for shutdown initrd related issues, see: - systemd#28645 - systemd#28648 - systemd#28793
This should provide coverage for shutdown initrd related issues, see: - systemd#28645 - systemd#28648 - systemd#28793
This should provide coverage for shutdown initrd related issues, see: - systemd#28645 - systemd#28648 - systemd#28793
And move the initrd related tests from TEST-01-BASIC there. Additionally, this should provide coverage for recemt shutdown initrd related issues, see: - systemd#28645 - systemd#28648 - systemd#28793
And move the initrd related tests from TEST-01-BASIC there. Additionally, this should provide coverage for recemt shutdown initrd related issues, see: - systemd#28645 - systemd#28648 - systemd#28793
And move the initrd related tests from TEST-01-BASIC there. Additionally, this should provide coverage for recemt shutdown initrd related issues, see: - systemd#28645 - systemd#28648 - systemd#28793
And move the initrd related tests from TEST-01-BASIC there. Additionally, this should provide coverage for recemt shutdown initrd related issues, see: - systemd#28645 - systemd#28648 - systemd#28793
And move the initrd related tests from TEST-01-BASIC there. Additionally, this should provide coverage for recemt shutdown initrd related issues, see: - systemd#28645 - systemd#28648 - systemd#28793
Issue: We cannot perform BMC FW update due to systemd-shutdown error. systemd/systemd#28645 systemd-shutdown: Failed to move /run/initramfs to /: invalid argument systemd-shutdown: Failed to switch root to "run/initramfs" invalid argument Fix: systemd/systemd#28648 The systemd upstream already fix this issue, but poky not merge it. So we need manual cherry-pick the fix patches into our repository, and remove it once poky merge these changes. Signed-off-by: Brian Ma <chma0@nuvoton.com>
Issue: We cannot perform BMC FW update due to systemd-shutdown error. systemd/systemd#28645 systemd-shutdown: Failed to move /run/initramfs to /: invalid argument systemd-shutdown: Failed to switch root to "run/initramfs" invalid argument Fix: systemd/systemd#28648 The systemd upstream already fix this issue, but poky not merge it. So we need manual cherry-pick the fix patches into our repository, and remove it once poky merge these changes. Signed-off-by: Brian Ma <chma0@nuvoton.com>
Hopefully fixes #28645.