1

I've recently transferred my VM from an old Win10 laptop to a new Win11 one and encountered very annoying issue: If I close my laptop, making it go to sleep, and when wake it up after some time, my guest VM (Rocky Linux 8) resets its state to the login screen (as if after reboot). In the logs I see that the session has been killed via watchdog: systemd-logind.service: Watchdog timeout (limit 3min)! (and several others like that).

One suspicious thing I've noticed in my VBox logs is that it doesn't seem to actually suspend when my laptop goes to sleep. At least I haven't found the corresponding message. However, there is a suspend event coinciding with the guest vm log about watchdog/crash:

<lots of similar events>
120:25:23.134650 TM: Giving up catch-up attempt at a 60 001 385 790 ns lag; new total: 168 754 705 406 043 ns
120:33:47.416772 TM: Giving up catch-up attempt at a 60 005 808 341 ns lag; new total: 168 814 711 214 384 ns
120:54:28.968325 TM: Giving up catch-up attempt at a 60 005 322 909 ns lag; new total: 168 874 716 537 293 ns
121:06:30.694374 VMMDev: vmmDevHeartbeatFlatlinedTimer: Guest seems to be unresponsive. Last heartbeat received 5 seconds ago
121:06:30.782830 VMMDev: GuestHeartBeat: Guest is alive (gone 5 212 364 421 ns)
127:35:15.487887 TM: Giving up catch-up attempt at a 23 374 472 159 396 ns lag; new total: 192 249 188 696 689 ns
127:35:15.487905 VMMDev: vmmDevHeartbeatFlatlinedTimer: Guest seems to be unresponsive. Last heartbeat received 23319 seconds ago
127:35:15.504476 TMR3UtcNow: nsNow=1 700 525 178 297 266 738 nsPrev=1 700 501 801 965 273 179 -> cNsDelta=23 376 331 993 559 (offLag=5 100 562 offVirtualSync=192 249 193 797 251 offVirtualSyncGivenUp=192 249 188 696 689, NowAgain=1 700 525 178 302 367 300)
127:35:15.505000 VMMDev: Guest Log: 00:06:17.742079 timesync vgsvcTimeSyncWorker: Radical host time change: 23 376 332 000 000ns (HostNow=1 700 525 178 297 000 000 ns HostLast=1 700 501 801 965 000 000 ns)
127:35:15.505035 VMMDev: Guest Log: 00:06:17.742589 timesync vgsvcTimeSyncWorker: Radical guest time change: 23 321 082 671 000ns (GuestNow=1 700 525 177 742 065 000 ns GuestLast=1 700 501 856 659 394 000 ns fSetTimeLastLoop=false)
127:35:15.656748 VMMDev: GuestHeartBeat: Guest is alive (gone 23 319 851 039 698 ns)
127:35:17.548800 Pausing VM execution, reason 'HostSuspend'
127:35:17.548841 Changing the VM state from 'RUNNING' to 'SUSPENDING'
127:35:17.555491 AIOMgr: Endpoint for file '***.vdi' (flags 000c0781) created successfully
127:35:17.561655 AIOMgr: Endpoint for file '***.vdi' (flags 000c0781) created successfully
127:35:17.563252 PDMR3Suspend: 14 370 022 ns run time
127:35:17.563261 Changing the VM state from 'SUSPENDING' to 'SUSPENDED'
127:35:17.563269 Console: Machine state changed to 'Paused'

I've generated a sleepstudy report in windows and it shows that at this exact point in time windows changed its state from sleep to hibernate. So it seems like VM went to sleep but not really, then woke up and died on a watchdog timer when PC was switching from sleep to hibernate (likely because it needs to briefly wake up during this) and then was properly suspended.

Manually pausing the VM before initiating sleep seems to work, but it's really annoying (I can try forcing hibernate instead of sleep, but I'd rather avoid that).

Is there a way to fix that? Is it possible to either disable watchdog in guest OS or make VBox detect sleep properly (or make windows automatically pause vm before sleep)?

7
  • FWIW I suspend virtual machines before suspending or shutting down the main host machine
    – anon
    Commented Nov 21, 2023 at 14:46
  • @John well, it's never been an issue in almost 10 years of using other laptops for me (previous five were thinkpads, now it's dell xps). It's always extra annoying to lose your work/context because you forgot to do something you shouldn't really care about in the first place. Also, sometimes I can get distracted by something else, then comeback to find my laptop in a sleep (which is completely fine and expected, if not for this annoying issue).
    – Dan M.
    Commented Nov 21, 2023 at 14:49
  • 1
    Purely out of curiosity, 1) What CPU manufacturer, and 2) Does the VirtualBox log show WHP (Windows Hypervisor Platform) being in use as opposed to VirtualBox's own engine? (is there a turtle icon in the VM's status bar) Commented Nov 21, 2023 at 14:54
  • I like to keep virtual and host machines in an orderly way so I do what I suggest to avoid issue
    – anon
    Commented Nov 21, 2023 at 14:54
  • @u1686_grawity 1) it's on Dell XPS 15 9530, so Intel 13th gen. (previous laptop was 8th gen intel, but also on win10 which might have different sleep/hibernate settings) 2) no turtle.
    – Dan M.
    Commented Nov 21, 2023 at 15:16

1 Answer 1

1

It appears to be a bug in how VirtualBox detects the sleep state (it misses hooks to properly detect "Modern Standby" sleep mode pushed by Microsoft). https://www.virtualbox.org/ticket/21917

As a workaround, I was able to create a schedule task triggered by modern standby event that would pause my VM automatically.

To do that, go to events, find event from Kernel-Power with Event ID of 506 - this is event Windows sends before initiating modern standby. Now use "Attach Task To This Event", and chose run program as an action. The action should be to run Path\To\Oracle\VirtualBox\VBoxManage.exe with controlvm "Your VM Name(s)" pause parameters. Don't forget to ucheck "Start the task only if the computer is on AC power" (and possibly set the option to run it whether you logged in or not) in the task properties (can be accessed via Task Scheduler).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .