Skip to content

[Bug]: Stop commands don't work after kernel panic #946

Closed as duplicate
Closed as duplicate

Description

@theAnuragMishra

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

  1. Install container with homebrew
    brew install container
  2. start container
    container system start
  3. set build.rosetta to false
    container system property set build.rosetta false
  4. follow the official tutorial to build and run a web server.
  5. 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

Activity

  1. Montana commented on Dec 10, 2025

    @Montana

    Sometimes container system stop hangs because there’s still something attached (shell, dev server, etc.) in the Linux VM.

    Try:

    container system status
    container list

    If anything is still listed as running, try stopping that first:

    container stop <name>

    If that also hangs, open a second terminal and look at the processes:

    ps aux | grep container
    ps aux | grep qemu

    If you see a container-*-linux qemu process still alive while container system stop hangs, that’s a good clue it’s stuck waiting for that VM to exit.

  2. theAnuragMishra commented on Dec 10, 2025

    @theAnuragMishra
    Author

    @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.

  3. katiewasnothere commented on Dec 10, 2025

    @katiewasnothere
    Contributor

    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 :)

  4. theAnuragMishra commented on Dec 10, 2025

    @theAnuragMishra
    Author

    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 :)

  5. Montana commented on Dec 10, 2025

    @Montana

    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 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.

    Michael

  6. dcantah commented on Dec 11, 2025

    @dcantah
    Contributor

    @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?

  7. theAnuragMishra commented on Dec 11, 2025

    @theAnuragMishra
    Author

    this is not easily reproducible i guess. it's related to kernel and probably happens only sometimes.

  8. theAnuragMishra commented on Dec 11, 2025

    @theAnuragMishra
    Author

    @Montana is container system kill really a command? I don't see it in container system --help

    here's the log output (with unnecessary info removed) of container logs --boot buildkit

    // lines beginning with `debug vminitd`
    2025-12-09T17:50:45+0000 debug vminitd : containerID=buildkit id=buildkit signal=15 [vminitd] killProcess
    2025-12-09T17:50:45+0000 info vminitd : id=buildkit [vminitd] sending signal 15 to process 78
    2025-12-09T17:50:45+0000 debug vminitd : containerID=buildkit id=buildkit [vminitd] waitProcess
    2025-12-09T17:50:45+0000 debug vminitd : id=buildkit [vminitd] received EPOLLHUP with no EPOLLIN
    2025-12-09T17:50:45+0000 debug vminitd : [vminitd] received SIGCHLD, reaping processes
    2025-12-09T17:50:45+0000 debug vminitd : [vminitd] finished wait4 of 1 processes
    2025-12-09T17:50:45+0000 debug vminitd : exits=[78: 1] processes=1 [vminitd] checking for exit of managed process
    2025-12-09T17:50:45+0000 debug vminitd : id=buildkit [vminitd] received EPOLLHUP with no EPOLLIN
    2025-12-09T17:50:45+0000 debug vminitd : count=0 pid=78 status=1 [vminitd] managed process exited
    2025-12-09T17:50:45+0000 info vminitd : id=buildkit status=1 [vminitd] managed process exit
    2025-12-09T17:50:45+0000 info vminitd : id=buildkit [vminitd] closing relay for StandardIO stdout
    2025-12-09T17:50:45+0000 info vminitd : id=buildkit [vminitd] closing relay for StandardIO stderr
    2025-12-09T17:50:45+0000 debug vminitd : id=buildkit [vminitd] 2 managed process waiters signaled
    2025-12-09T17:50:45+0000 debug vminitd : pid=-1 signal=9 [vminitd] kill
    2025-12-09T17:50:45+0000 debug vminitd : containerID=buildkit id=buildkit [vminitd] waitProcess
    2025-12-09T17:50:45+0000 debug vminitd : flags=0 path=/run/container/buildkit/rootfs [vminitd] umount
    2025-12-09T17:50:45+0000 warning vminitd : current_bytes=78200832 high_events_total=34 threshold_bytes=78643200 [vminitd] vminitd memory threshold exceeded
    [14173.697095] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
    [14173.697344] Mem abort info:
    [14173.697369]   ESR = 0x0000000096000046
    [14173.697400]   EC = 0x25: DABT (current EL), IL = 32 bits
    [14173.697457]   SET = 0, FnV = 0
    [14173.697494]   EA = 0, S1PTW = 0
    [14173.697517]   FSC = 0x06: level 2 translation fault
    [14173.697549] Data abort info:
    [14173.697573]   ISV = 0, ISS = 0x00000046, ISS2 = 0x00000000
    [14173.697616]   CM = 0, WnR = 1, TnD = 0, TagAccess = 0
    [14173.697674]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
    [14173.697727] user pgtable: 4k pages, 48-bit VAs, pgdp=000000007217e000
    [14173.697759] [0000000000000000] pgd=0800000071e41003, p4d=0800000071e41003, pud=0800000071e45003, pmd=0000000000000000
    [14173.697872] Internal error: Oops: 0000000096000046 [#1] SMP
    [14173.697932] CPU: 1 UID: 0 PID: 651 Comm: NIO-ELT-0-#0 Not tainted 6.12.28 #1
    [14173.698011] pstate: 21400005 (nzCv daif +PAN -UAO -TCO +DIT -SSBS BTYPE=--)
    [14173.698043] pc : selinux_inode_free_security+0x7c/0xbc
    [14173.698233] lr : security_inode_free+0x58/0x74
    [14173.698324] sp : ffff80008129bb60
    [14173.698339] x29: ffff80008129bb60 x28: ffff6fd7b21b5548 x27: ffff6fd7b2422000
    [14173.698410] x26: ffff6fd7b18d24a8 x25: 00000000000000c1 x24: ffffad7b7e75ac68
    [14173.698464] x23: ffff80008129bcf8 x22: 0000000000000000 x21: ffff6fd7b5385018
    [14173.698512] x20: ffff6fd7b26c2540 x19: ffff6fd7b5385010 x18: 0000000000000001
    [14173.698563] x17: 0000000000000004 x16: 0000000000000003 x15: 0000a2e9da331f24
    [14173.698613] x14: ffff6fd7b2422080 x13: 00000000000752a8 x12: 0000000000000005
    [14173.698662] x11: 0000000000000001 x10: 0000000000000001 x9 : 0000000000000000
    [14173.698715] x8 : 00000000fffffffc x7 : 0000000000000000 x6 : 0000000000660037
    [14173.698768] x5 : 0000000000660036 x4 : 0000000000000000 x3 : 0000000000000001
    [14173.698819] x2 : 0000000000000000 x1 : ffff6fd7b26c2570 x0 : 0000000000000000
    [14173.698868] Call trace:
    [14173.698896]  selinux_inode_free_security+0x7c/0xbc
    [14173.698918]  security_inode_free+0x58/0x74
    [14173.698954]  __destroy_inode+0x74/0x1ec
    [14173.699061]  destroy_inode+0x2c/0x70
    [14173.699081]  evict+0x180/0x2d4
    [14173.699122]  evict_inodes+0x164/0x210
    [14173.699151]  generic_shutdown_super+0x44/0x15c
    [14173.699260]  kill_block_super+0x18/0x38
    [14173.699309]  ext4_kill_sb+0x1c/0x48
    [14173.699396]  deactivate_locked_super+0x50/0x160
    [14173.699435]  deactivate_super+0x68/0x7c
    [14173.699472]  cleanup_mnt+0x94/0x11c
    [14173.699501]  __cleanup_mnt+0x10/0x18
    [14173.699544]  task_work_run+0xb0/0x118
    [14173.699617]  do_notify_resume+0x138/0x13c
    [14173.699665]  el0_svc+0x100/0x1b8
    [14173.699796]  el0t_64_sync_handler+0x134/0x150
    [14173.699829]  el0t_64_sync+0x160/0x164
    [14173.699890] Code: 35ffff84 35000221 a9408261 f9000420 (f9000001) 
    [14173.699935] ---[ end trace 0000000000000000 ]---
    
    //many many lines (like 1k+) beggining with `debug vminitd`
    
    025-12-10T17:09:03+0000 info vminitd : [vminitd] child process exited with code: 133
    [48910.194816] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000000
    [48910.195266] SMP: stopping secondary CPUs
    
  9. changed the title [-][Bug]: stop commands dont work[/-] [+][Bug]: Stop commands don't work after kernel panic[/+] on Dec 11, 2025
  10. theAnuragMishra commented on Dec 11, 2025

    @theAnuragMishra
    Author

    Edit: included some lines that may be important

  11. theAnuragMishra commented on Dec 11, 2025

    @theAnuragMishra
    Author

    @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.

  12. dcantah commented on Dec 11, 2025

    @dcantah
    Contributor

    @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?

  13. Montana commented on Dec 11, 2025

    @Montana

    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:

    selinux_inode_free_security
    security_inode_free
    __destroy_inode
    ext4_kill_sb
    deactivate_super

    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.

    Michael

  14. theAnuragMishra commented on Dec 11, 2025

    @theAnuragMishra
    Author

    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?

  15. 13 remaining items

  16. dcantah commented on Dec 18, 2025

    @dcantah
    Contributor

    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).

  17. vsarunas commented on Dec 20, 2025

    @vsarunas

    @dcantah - kernel panics occur during runtime, see #614 (comment) for the reproducer.

  18. astahlman commented on Jan 6, 2026

    @astahlman

    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:

    2026-01-06T19:49:58+0000 info vminitd : status=0 [vminitd] managed process exit
    2026-01-06T19:49:58+0000 info vminitd : [vminitd] closing relay for TerminalIO stdin
    2026-01-06T19:49:58+0000 info vminitd : [vminitd] closing relay for TerminalIO stdout
    2026-01-06T19:49:58+0000 debug vminitd : [vminitd] 1 managed process waiters signaled
    2026-01-06T19:49:58+0000 debug vminitd : pid=-1 signal=9 [vminitd] kill
    2026-01-06T19:49:58+0000 debug vminitd : [vminitd] waitProcess
    2026-01-06T19:49:58+0000 debug vminitd : flags=0 path=/run/container/<id>/rootfs [vminitd] umount
    

    The crash happens immediately on that umount call after a clean process exit
    (status=0).

    Full kernel panic:

    [13796.181622] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
    [13796.182206] Mem abort info:
    [13796.182239]   ESR = 0x0000000096000046
    [13796.182264]   EC = 0x25: DABT (current EL), IL = 32 bits
    [13796.182352]   FSC = 0x06: level 2 translation fault
    [13796.182578] Internal error: Oops: 0000000096000046 [#1] SMP
    [13796.182607] CPU: 2 UID: 0 PID: 17166 Comm: vminitd Not tainted 6.12.28 #1
    [13796.182716] pc : selinux_inode_free_security+0x7c/0xbc
    [13796.183827] lr : security_inode_free+0x58/0x74
    [13796.184672] Call trace:
    [13796.184688]  selinux_inode_free_security+0x7c/0xbc
    [13796.184721]  security_inode_free+0x58/0x74
    [13796.184748]  __destroy_inode+0x74/0x1ec
    [13796.185121]  destroy_inode+0x2c/0x70
    [13796.185181]  evict+0x180/0x2d4
    [13796.185212]  evict_inodes+0x164/0x210
    [13796.185258]  generic_shutdown_super+0x44/0x15c
    [13796.185291]  kill_block_super+0x18/0x38
    [13796.185333]  ext4_kill_sb+0x1c/0x48
    [13796.185365]  deactivate_locked_super+0x50/0x160
    [13796.185386]  deactivate_super+0x68/0x7c
    [13796.185411]  cleanup_mnt+0x94/0x11c
    [13796.185432]  __cleanup_mnt+0x10/0x18
    [13796.185455]  task_work_run+0xb0/0x118
    [13796.185534]  do_notify_resume+0x138/0x13c
    [13796.185555]  el0_svc+0x100/0x1b8
    [13796.185740]  el0t_64_sync_handler+0x134/0x150
    [13796.185754]  el0t_64_sync+0x160/0x164
    

    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.

  19. Montana commented on Jan 6, 2026

    @Montana

    Thank you @astahlman

  20. jglogan commented on Jan 7, 2026

    @jglogan
    Contributor

    Possibly related: #861

  21. JaewonHur commented on Jan 14, 2026

    @JaewonHur
    Contributor

    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).

  22. finagolfin commented on Jan 24, 2026

    @finagolfin

    @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.

  23. jglogan commented on Jan 24, 2026

    @jglogan
    Contributor

    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.

  24. jglogan commented on Jan 25, 2026

    @jglogan
    Contributor

    Closing as a duplicate of #576.

  25. jglogan commented on Jan 25, 2026

    @jglogan
    Contributor

    Using #576 to track this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions