HAOS in VMWare on Ubuntu, how to gracefully shutdown when Ubuntu shuts down?

I can only do a bit more than copy/paste commands in Linux, so I am asking for some help to configure the HAOS running in VMWare to launch when Ubuntu boots and shutdown gracefully when Ubuntu shuts down.

I found some scripts to get the VM to start when Ubuntu starts but haven’t found a reliable way to shutdown (or suspend, if that is not going to cause problems**) the VM when Ubuntu shuts down. I would appreciate some guidance on how to do that–as much of a step-by-step would be great for both startup and shutdown.

Thanks.

** If suspend is the only way, is there a way to automate a notification from HA to send a message so I know it’s being suspended?

Sigh.

That is why you were advised in your other thread NOT to run VMWare client under another OS.
VMWare Client assumes that you know what you are doing on your PC, and so you will do whatever you need to do in the VM when you need to do it.

VMWare Server is intended for running long term applications like Home Assistant.

You mentioned you have other PCs available, so installing HAOS direct onto one of them will give you best performance and least headaches.

No need to sigh because you chose to respond. While I certainly appreciate viewpoints and advice, but I make choices that I determine that suit me best.

I, we, you know what to do by asking questions, receiving quality responses that answer the actual questions, and applying the information hands-on. Everyone learns about something for the first time somewhere. I’d imagine you too. I’ve done my research before posting here and found helpful information. I simply wanted to know what the HA community does.

That said, I’d appreciate knowing if you know how to accomplish what I asked in my op. That would be more helpful since I am not going to be loading HAOS on a dedicated machine at this time.

1 Like

In case someone else is looking for the same solution, I found an easy one:

  1. MQTT is required on HA
  2. Install MQTT client on Ubuntu
  3. Create a shutdown script that runs the MQTT command and set Ubuntu to wait (I set it to 120 seconds).
  4. Use this command: mosquitto_pub -h [IP] -t home-assistant/cmd/shutdown -m SHUTDOWN -u [user name] -p [password]

This will cause HA to shutdown as if you went to the system menu to shut it down and the vm will close. It does not matter if you are running headless or vmplayer. It works great!

I didn’t know how to do this before, but I’ve learned something new and I believe that, and sharing information is the spirit of the DYI HA ecosystem.

1 Like