You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Stop commands don't work after kernel panic #946
If possible, I've reproduced the issue using the 'main' branch of this project
Steps to reproduce
Install container with homebrew brew install container
start container container system start
set build.rosetta to false container system property set build.rosetta false
follow the official tutorial to build and run a web server.
try to stop container system. container system stop
It hangs here until i ctrl c.
Not sure if this happens with everyone though.
Current behavior
commands like container system stop and container stop --all keep hanging until i ctrl c.
i just cant stop specific or all of the containers or the entire container system.
Expected behavior
container system stop should stop the container service. container stop --all should stop all running containers.
Environment
- OS: macOS 26.1
- Xcode: i dont hv Xcode installed
- Container: 0.7.1
Relevant log output
N/A
Code of Conduct
I agree to follow this project's Code of Conduct
Reacted by Florian Dreier, Freeman and Nguyen Nhu Viet
@Montana
the output of container system stats looks like:
applicaition data root: {some address path}
application install root: {address of container binary ig}
container-apiserver version: 0.7.1
container-apiserver commit: unspecified
which to me looks like just gives the details of container service itself , so it shouldn't stop me from stopping the service
container list shows a container named buildkit in the running state.
when container system stop kept hanging, i thought this might be the reason. so i tried container stop --all and container stop buildkit but all of these commands kept hanging until i ctrl c.
Hi @theAnuragMishra does this command container logs --boot buildkit work? If so, can you attach the results here? If that doesn't work, you can try to find the boot logs under ~/Library/Application\ Support/com.apple.container/containers/buildkit.
Did you have a version of container installed and/or running before you ran brew install?
There have been reports that a reboot can fix hangs on calls to the container service, so that's another option worth trying, though I know it's a big hammer :)
i assume work isn't included in the command.
yes it works. im not sure if i should just copy-paste the log output or it contaisn some sensitive info.
but i can see Unable to handle kernel NULL pointer dereference at virtual address 000000000000000 somewhere in the middle of the logs and Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000.
No I didn't hv any version of container installed before.
I'll try a reboot later but a proper fix would be great because I want apple/container to be stable for long term use, docker desktop is too much :)
Thanks for checking that, and the kernel panic you found is actually the key detail here.
A Kernel panic - not syncing: Attempted to kill init inside the VM will absolutely cause container stop and container system stop to hang, because the supervisor is waiting for a guest shutdown signal that never arrives. At that point the Linux VM is effectively wedged, so any higher-level lifecycle commands will block indefinitely.
A couple things you can try to narrow it down:
Verify whether the VM is still alive or stuck mid-panic
ps aux | grep container
ps aux | grep qemu
If the container-*-linux QEMU process is still sitting there consuming CPU or frozen, that confirms it’s the guest kernel panic causing the hang.
Force-stop the VM
(This is safe if it’s already panicked.)
container system kill
If that returns immediately while container system stop hangs, that’s further confirmation the shutdown handler is blocked waiting on the guest.
Capture the full boot log
container logs --boot buildkit
The full trace around the NULL-pointer dereference will help determine whether this is:
a buildkit kernel module issue
a QEMU device/virtio driver issue
something triggered by the workload running inside your container
If you prefer, you can redact paths and only attach the panic + stack trace and honestly that’s the meaningful portion.
A reboot will clear the wedged VM, but for a real fix upstream, the panic trace is essential. This appears to be a genuine kernel-level regression rather than a user-space hang, so getting the details posted will help move this toward a proper fix.
A reboot will get you unstuck temporarily, but the upstream team will absolutely want the panic trace so they can reproduce and fix it. This looks like a real kernel regression, not just a user-space hang.
@theAnuragMishra I'm unfortunately not seeing the same from following your instructions. You just built and ran the web server and container system stop hangs?
@Montana you mentioned it could be a "kernel-level regression" instead of a user-space hang. Paranoid me wants to confirm if it's the linux vm kernel or the macOS main kernel being mentioned.
@theAnuragMishra I wouldn't worry too much about that at least right now. On your end, something that I didn't think to have you try is that on 0.7.1 I had made a change to try and alleviate ext4 issues like you're seeing, however existing container images (like buildkits) would still have the old fs layout inside them. Can you (if this isn't a huge hassle) remove any container images used for your repro and try to get this to occur again?
First off, sorry for activating the paranoid mode in you!
There’s really no need to worry here. When I mentioned a “kernel-level regression,” I was referring only to the Linux kernel inside the container’s VM, not the macOS host kernel. The stack trace you shared makes that completely unambiguous. These functions:
Exist only in the Linux guest kernel. If this were anything related to the macOS kernel, you’d be seeing very different symptoms, things like full system freezes, reboots, or logs referencing XNU and definitely none of these Linux VFS / SELinux / ext4 teardown paths.
What’s happening is that the Linux VM kernel hits a panic while trying to tear down an inode. Once that happens, it’s unable to send a clean shutdown signal back to the container supervisor. That’s why commands like container stop and container system stop appear to hang even though the host is totally fine.
It sounds like macOS is simply waiting on a callback from the VM that’s no longer capable of responding.
So just to answer your question directly, this is entirely a guest Linux kernel panic, not anything involving the macOS kernel. Your host system isn’t affected. And the trace you posted is exactly the type of information the maintainers need to diagnose the regression.
Thank you Michael !
So from what u said I assume fixing this is not the responsibility of the maintainers of apple/container, but that of the maintainers of the Linux vm?
I have a couple hunches for how to alleviate the hanging (unrelated to actually fixing the kernel panic(s), but they only seem to occur when umounting the fs which is when we're shutting down the container anyways).
So the path is: umount -> cleanup_mnt -> deactivate_super -> ext4_kill_sb
evict_inodes -> destroy_inode -> selinux_inode_free_security -> NULL deref.
Environment:
macOS 25.1.0 (Sequoia), Apple Silicon
Linux kernel 6.12.28 in VM
Container had multiple virtiofs bind mounts
container CLI version 0.7.1 (build: release, commit: 420be74)
After the panic, the VM continues emitting setTime heartbeats but is otherwise
dead. container list still shows "running", and exec/stop/delete --force all
hang indefinitely.
Hi @theAnuragMishra@finagolfin
Could you try using main branch?
We recently merged possible fix #1041 to this issue (though not 100% sure it's the same one).
@JaewonHur, I'm happy to report that after updating to container 0.8.0, including your fix- I couldn't use main to check before because I'm not building this repo from source yet- I'm not seeing any kernel panics anymore. 😃 Thanks for fixing that bug, which made using these linux containers for anything that stressed them unusable. I'm now able to build and test a full Swift toolchain for linux in this container tech, 👍 going to try nested virtualization next.
Please keep this issue open though, as that is a separate bug, and this one may still hit if the kernel gets wedged in other ways.
Please keep this issue open though, as that is a separate bug, and this one may still hit if the kernel gets wedged in other ways.
@finagolfin Yes. I think we've addressed a big source of panics, but it's still such that should a panic occur in a container, the state gets such that stop commands for the container can hang, which also means that system stop hangs.
Activity
Montana commentedon Dec 10, 2025
Sometimes
container system stophangs because there’s still something attached (shell, dev server, etc.) in the Linux VM.Try:
If anything is still listed as running, try stopping that first:
If that also hangs, open a second terminal and look at the processes:
If you see a
container-*-linux qemuprocess still alive while container system stop hangs, that’s a good clue it’s stuck waiting for that VM to exit.theAnuragMishra commentedon Dec 10, 2025
@Montana
the output of
container system statslooks like:which to me looks like just gives the details of container service itself , so it shouldn't stop me from stopping the service
container listshows a container namedbuildkitin therunningstate.when
container system stopkept hanging, i thought this might be the reason. so i triedcontainer stop --allandcontainer stop buildkitbut all of these commands kept hanging until ictrl c.katiewasnothere commentedon Dec 10, 2025
Hi @theAnuragMishra does this command
container logs --boot buildkitwork? If so, can you attach the results here? If that doesn't work, you can try to find the boot logs under~/Library/Application\ Support/com.apple.container/containers/buildkit.Did you have a version of
containerinstalled and/or running before you ranbrew install?There have been reports that a reboot can fix hangs on calls to the
containerservice, so that's another option worth trying, though I know it's a big hammer :)theAnuragMishra commentedon Dec 10, 2025
i assume
workisn't included in the command.yes it works. im not sure if i should just copy-paste the log output or it contaisn some sensitive info.
but i can see
Unable to handle kernel NULL pointer dereference at virtual address 000000000000000somewhere in the middle of the logs andKernel panic - not syncing: Attempted to kill init! exitcode=0x00000000.No I didn't hv any version of
containerinstalled before.I'll try a reboot later but a proper fix would be great because I want
apple/containerto be stable for long term use, docker desktop is too much :)Montana commentedon Dec 10, 2025
Hey @theAnuragMishra,
Thanks for checking that, and the kernel panic you found is actually the key detail here.
A
Kernel panic - not syncing: Attempted to kill initinside the VM will absolutely causecontainer stopandcontainer system stopto hang, because the supervisor is waiting for a guest shutdown signal that never arrives. At that point the Linux VM is effectively wedged, so any higher-level lifecycle commands will block indefinitely.A couple things you can try to narrow it down:
Verify whether the VM is still alive or stuck mid-panic
If the
container-*-linuxQEMU process is still sitting there consuming CPU or frozen, that confirms it’s the guest kernel panic causing the hang.Force-stop the VM
(This is safe if it’s already panicked.)
container system killIf that returns immediately while
container system stophangs, that’s further confirmation the shutdown handler is blocked waiting on the guest.Capture the full boot log
The full trace around the NULL-pointer dereference will help determine whether this is:
If you prefer, you can redact paths and only attach the panic + stack trace and honestly that’s the meaningful portion.
A reboot will clear the wedged VM, but for a real fix upstream, the panic trace is essential. This appears to be a genuine kernel-level regression rather than a user-space hang, so getting the details posted will help move this toward a proper fix.
A reboot will get you unstuck temporarily, but the upstream team will absolutely want the panic trace so they can reproduce and fix it. This looks like a real kernel regression, not just a user-space hang.
Michael
dcantah commentedon Dec 11, 2025
@theAnuragMishra I'm unfortunately not seeing the same from following your instructions. You just built and ran the web server and
container system stophangs?theAnuragMishra commentedon Dec 11, 2025
this is not easily reproducible i guess. it's related to kernel and probably happens only sometimes.
theAnuragMishra commentedon Dec 11, 2025
@Montana is
container system killreally a command? I don't see it incontainer system --helphere's the log output (with unnecessary info removed) of
container logs --boot buildkit[-][Bug]: stop commands dont work[/-][+][Bug]: Stop commands don't work after kernel panic[/+]theAnuragMishra commentedon Dec 11, 2025
Edit: included some lines that may be important
theAnuragMishra commentedon Dec 11, 2025
@Montana you mentioned it could be a "kernel-level regression" instead of a user-space hang. Paranoid me wants to confirm if it's the linux vm kernel or the macOS main kernel being mentioned.
dcantah commentedon Dec 11, 2025
@theAnuragMishra I wouldn't worry too much about that at least right now. On your end, something that I didn't think to have you try is that on 0.7.1 I had made a change to try and alleviate ext4 issues like you're seeing, however existing container images (like buildkits) would still have the old fs layout inside them. Can you (if this isn't a huge hassle) remove any container images used for your repro and try to get this to occur again?
Montana commentedon Dec 11, 2025
Hey @theAnuragMishra,
First off, sorry for activating the paranoid mode in you!
There’s really no need to worry here. When I mentioned a “kernel-level regression,” I was referring only to the Linux kernel inside the container’s VM, not the macOS host kernel. The stack trace you shared makes that completely unambiguous. These functions:
Exist only in the Linux guest kernel. If this were anything related to the macOS kernel, you’d be seeing very different symptoms, things like full system freezes, reboots, or logs referencing XNU and definitely none of these Linux VFS / SELinux /
ext4teardown paths.What’s happening is that the Linux VM kernel hits a panic while trying to tear down an inode. Once that happens, it’s unable to send a clean shutdown signal back to the container supervisor. That’s why commands like
container stopandcontainer system stopappear to hang even though the host is totally fine.It sounds like macOS is simply waiting on a callback from the VM that’s no longer capable of responding.
So just to answer your question directly, this is entirely a guest Linux kernel panic, not anything involving the macOS kernel. Your host system isn’t affected. And the trace you posted is exactly the type of information the maintainers need to diagnose the regression.
Michael
theAnuragMishra commentedon Dec 11, 2025
Thank you Michael !
So from what u said I assume fixing this is not the responsibility of the maintainers of apple/container, but that of the maintainers of the Linux vm?
13 remaining items
dcantah commentedon Dec 18, 2025
I have a couple hunches for how to alleviate the hanging (unrelated to actually fixing the kernel panic(s), but they only seem to occur when umounting the fs which is when we're shutting down the container anyways).
vsarunas commentedon Dec 20, 2025
@dcantah - kernel panics occur during runtime, see #614 (comment) for the reproducer.
astahlman commentedon Jan 6, 2026
I hit the same kernel panic. Adding detailed logs that show the exact trigger
point in case it's helpful.
vminitd.log sequence leading to crash:
The crash happens immediately on that umount call after a clean process exit
(status=0).
Full kernel panic:
So the path is: umount -> cleanup_mnt -> deactivate_super -> ext4_kill_sb
evict_inodes -> destroy_inode -> selinux_inode_free_security -> NULL deref.
Environment:
After the panic, the VM continues emitting setTime heartbeats but is otherwise
dead. container list still shows "running", and exec/stop/delete --force all
hang indefinitely.
Montana commentedon Jan 6, 2026
Thank you @astahlman
jglogan commentedon Jan 7, 2026
Possibly related: #861
JaewonHur commentedon Jan 14, 2026
Hi @theAnuragMishra @finagolfin
Could you try using main branch?
We recently merged possible fix #1041 to this issue (though not 100% sure it's the same one).
finagolfin commentedon Jan 24, 2026
@JaewonHur, I'm happy to report that after updating to container 0.8.0, including your fix- I couldn't use main to check before because I'm not building this repo from source yet- I'm not seeing any kernel panics anymore. 😃 Thanks for fixing that bug, which made using these linux containers for anything that stressed them unusable. I'm now able to build and test a full Swift toolchain for linux in this container tech, 👍 going to try nested virtualization next.
Please keep this issue open though, as that is a separate bug, and this one may still hit if the kernel gets wedged in other ways.
jglogan commentedon Jan 24, 2026
@finagolfin Yes. I think we've addressed a big source of panics, but it's still such that should a panic occur in a container, the state gets such that
stopcommands for the container can hang, which also means thatsystem stophangs.jglogan commentedon Jan 25, 2026
Closing as a duplicate of #576.
jglogan commentedon Jan 25, 2026
Using #576 to track this.