Open kanav99 opened 3 years ago
I'm also wondering how to do this. I usually use halt
when I was successful in booting the machine. But for machines that are broken, I always have to shut down the process manually somehow.
Inside a VM I use halt. Outside the VM, you can use SIGTERM. That gets translated into a "power button" press, and that typically triggers an OS shutdown.
https://github.com/machyve/xhyve/blob/83516a009c692ea5d2993d1071e68d05d359b11e/src/pm.c#L273
Note that if the xhyve
process runs as root
, you need to also send SIGTERM as root
.
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 -poweroff
. But this can be exploited by any other applications.kill
- nope, because I don't want to give setuid to a binary that can killI want to do a safe shutdown - what should be the best way?