OPNsense Forum

Archive => 21.7 Legacy Series => Topic started by: sesquipedality on November 05, 2021, 12:19:11 PM

Title: "hardware" watchdog not working when running OpnSense under QEMU
Post by: sesquipedality on November 05, 2021, 12:19:11 PM
I have been experiencing some problems with the router becoming unresponsive overnight due to some sort of leak which I have found impossible to diagnose.   As such I have been trying to enable FreeBSD's built in watchdog functionality to qemu to reboot my OpnSense VM if it becomes unresponsive.   Unfortunately I cannot get it to work at all.

I am running a couple of OpnSense (based on FreeBSD 12.1) routers in qemu virtual machines in Proxmox 6.4. 

Promox has its own non-libvert way of configuring VMs, but to add a watchdog device, one adds the following line to the VM config file:


    watchdog: model=i6300esb,action=reset

I can see that this is working and the virtual device is present in the VM because pciconf -l -v in the guest includes the following output:

    none0@pci0:0:4:0:       class=0x088000 card=0x11001af4 chip=0x25ab8086 rev=0x00 hdr=0x00
        vendor     = 'Intel Corporation'
        device     = '6300ESB Watchdog Timer'
        class      = base peripheral


Unfortunately, although the ichwd driver supports the emulated chipset, it is not being detected, and there are is nothing in the dmesg logs about it.

I have enabled watchdogd by adding the line watchdog_enable=yes to /etc/rc.conf.  This is working, but it will default to using a software watchdog, and appears to produce no debugging information, so is not helpful.

I can also force the kernel to load the ichwd driver by adding ichwd_load="YES" to boot/loader.conf (actually in OpnSense this is done by adding it to System -> Settings -> Tuneables in the GUI, but the final effect is identical).  Output from 'kldstat` shows

    Id Refs Address                Size Name
    12    1 0xffffffff82959000     70c8 ichwd.ko


I am thus reasonably certain that the virtual device is present on the system and the correct device driver loaded, but am unable to coax any further debugging information out of qemu, ichwd, or watchdogd.  What should I try next?
Title: Re: "hardware" watchdog not working when running OpnSense under QEMU
Post by: sesquipedality on January 03, 2022, 01:34:20 PM
So the FreeBSD people tell me that there are in fact two different watchdogs on the emulated chip, and the one that Qemu emulates is not supported by BSD.  Apparently it would not be a particularly hard driver to write, but having looked at the kernel sources, I don't have the faintest idea what is going on or the desire to work it out.

The upshot is that external watchdog monitoring when running under qemu is not possible, and is likely to remain unsupported for the foreseeable future.