How to log what causes HA to restart?

About a week ago HA started to restart with no apparent reason maybe a couple of times a day. This obviously causes problems, so I am trying to find out why it happens. When i look into the log, it only shows what happens after the restart, which isn’t that useful. How can i get it to log what happend/caused it to restart?

You always have the log before the restart…and a fault log

Thanks, i found them, but the fault log is empty, and the other log has no info on the restart, do you know what log level i would have to set for restarts to be logged?

What OS are you running? Is it possible the entire host rebooted? I just had an unexpected reboot the other night but haven’t yet looked into it. It appeared my entire system rebooted. I am running Debian 11 so I would normally check /var/log/syslog, I’m not sure what the equivalent would be if running HAOS, but if the regular HA logs look clear that would be where I would look next myself.

whats it installed on? Rpi with Memory Card? If so this is a typical feature of when the memory card is getting corrupted.

I am running it on a virtual machine (Hyper-V) on windows, so i am running it on windows. But i don’t think the host has rebooted. I don’t know exactly how it is counted, but the “uptime” on the virtual machine is many days, but HA rebooted 6 hours ago.

It is a computer with a virtual machine.

Did you ever find a solution to this? I’m experiencing the same behaviour, and i’ve tried a complete new install, on a new VM in Hyper-V. And i’m pretty sure the problem startet some time after the new VM was initiated (maybe a month or more). I also have a sneaky suspicion this only affect the few of us, that runs HA on a VM…

On another note, how are you guys that are using Hyper-V, passing through the USB port for your zigbee controller ? I heard this was difficult with Hyper-V which is why I used VirtualBox on Windows instead.

I use Samsung Smartthings HUB to connect Zwave and Zigbee devices, i have no USB devices attached. I have other external devices for other type of connections/devices, like Tasmota, IR and such. Don’t have anything for Bluetooth though…

What Windows OS are you using? Server OSs, as of 2016, have supported PCI device pass through. And that PCI device can be a USB card. If you go this route, you might need to experiment with which USB card to use. I have a FebSmart 2 port card that works perfectly, but I wanted more ports, so tried a few other 5 & 7 port cards, all a bit flakey (typically, I’d reboot the host & the VM wouldn’t find the device - and wouldn’t boot). So got a 2nd 2-port card, all is well! 1 Z-Wave, 1 Zigbee, 1 Blutooth & a spare to initialize ESPHome devices.
I’m not sure if Win 10/11 support this PCI passthrough.

Without wanting to hijack the original thread, thanks for the update @blaal02.
I’m using windows 11 pro edition, currently running virtualbox, which has been rock solid.
I was tempted initially to look at Hyper-V as it seemed the obvious choice, but the USB thing put me off.

The only use of a USB device I have is the USB zigbee coordinator (Sonoff Dongle-E) that I use for my zigbee network. It also works perfectly via USB passthrough on VirtualBox.

The one downside to Virtualbox, is that there appears to be a bug that doesn’t always let you see the HASS command line when you select the ‘show’ (VM) option, but its not a biggy and rarely needed.

I can’t do PCI passthrough, I’d need USB passthrough as I’m running on a Dell Optiplex 3050 Micro with no PCI-E expansion slots available.