#209·xhyve

Best way to shutdown VM?

Author: kanav99Created Jan 13, 2021Updated Aug 3, 2021

I am writing a wrapper over xhyve in swift, where I have given setuid to the xhyve binary (!!) and run the Ubuntu VM on a button click. Now I want to shut down the VM. Options -

  1. Make a root user and set its ssh shell to poweroff. But this can be exploited by any other applications.
  2. Run kill - nope, because I don't want to give setuid to a binary that can kill
  3. SIGINT - Not graceful
  4. Simulating Ctrl + SysRq + o - how do I do this?

I want to do a safe shutdown - what should be the best way?