Windows-Sandbox icon indicating copy to clipboard operation
Windows-Sandbox copied to clipboard

[Bug]: Sandbox does not prevent Windows Update from rebooting PC

Open theuargb opened this issue 9 months ago • 7 comments

Windows Sandbox version

No response

Windows build number

No response

Other software

No response

Steps to reproduce the bug

Run task in the Sandbox. Await for the results. Actively refuse to reboot PC to apply downloaded update by pressing corresponding button. Windows Update decides it is time to apply the cumulative Windows 11 update and reboots the PC.

Expected result

Sandbox does not allow Windows Update to reboot, preventing ephemeral data loss

Actual result

All the progress that is not synced somehow to the outer scope is lost overnight

Included System Information

No response

theuargb avatar Mar 13 '25 08:03 theuargb

I am not sure that I understand your ask here. It seems like you would like for Windows Update to NOT happen while Sandbox is running. Ideally, it should wait for Sandbox to be closed before restarting your machine. Is that correct?

kvega005 avatar Mar 18 '25 23:03 kvega005

Many applications either "save state" (even if the data is temporary, such as notepad.exe) or create a modal dialog (save as / "are you sure?") when there is an request to close them. This has the added benefit that when Windows attempts to shutdown/restart, apps with Unsaved data will usually cause Windows to offer to cancel (or force) the shutdown.

I think OP is referring to a modal dialog when they say it should refuse to boot the PC. Unfortunately, Sandbox probably doesn't know when you've got important stuff happening. It sounds like OP uses sandbox as a semi-permanent VM.

realJoshByrnes avatar Mar 19 '25 03:03 realJoshByrnes

@realJoshByrnes thank you for your reply. while I am not using Sandbox as a semi-permanent VM, rather as a... sandbox - an environment where I manually start apps and review their output in a secure way, you did get my point right:

since Sndbox can not know if it is running valuable app rn or not, it should never allow automatic systems (especially rolling updates) to destroy the data it operates with

theuargb avatar Mar 19 '25 07:03 theuargb

@kvega005 thank you for your interest in this behavior.

I do want the Sandbox to prevent Windows (especially Update services) from rebooting, as it is implemented in many other software working with ephemeral data (eg. video rendering, computations, even Microsoft Word has ways to prevent data losses on unintended reboots including both exit-preventing and auto-save).

In my case, the Sandbox DO shows notice regarding data loss when I want to close it manually and does not close before I accept that. On the other hand, Windows Update did not respect these exit-blocking behavior and rebooted my PC with the Sandbox running, stopping applications and deleting all the data they had produced so far

theuargb avatar Mar 19 '25 07:03 theuargb

There are several programs that will prevent Windows from rebooting. I use "Don't Sleep" (currently v. 9.73).

I run several VMs, several WSL's (and Docker), and Sandbox on the same machine, and having som boot prevent mechanism in one or all of them, or some other apps/progs, would be frustrating. I don't mind a blocking feature as long as it can be disabled.

oligocene avatar Mar 21 '25 21:03 oligocene

@oligocene thank you for your reply. i do use PowerToys Awake as well to prevent Windows from sleeping, but the original question is more about rebooting. WSL or any other VMs do not destroy any data when shut down - therefore they are safer to reboot.

in my particular case, Awake did a great job while app in the sandbox was active. when app completed its job - i disabled awake, kept sandbox running “as is”, and closed the lid.

in the next morning i opened the lid and found Windows rebooted and the data inside the Sandbox destroyed without any way to move forward

theuargb avatar Mar 22 '25 04:03 theuargb

Since Sandbox is transient and throwaway, I don’t think supporting this scenario makes any sense. This would only make sense if it were possible to checkpoint and restore sandboxes, which also sounds like another feature which Sandbox wouldn’t be able to support over a Windows Update cycle (given how it uses the host OS as the base image).

Sandbox already provides its own tools and mechanisms to support persisting and restoring state: file shares and startup scripts.

If anything, it would perhaps be nice for an application within a sandbox to be able to react to and interrupt a reboot request in the same way that any application can request cancellation of a shutdown. However, Windows Update normally ignores those prompts anyway, so that would not solve the OP’s issue.

binki avatar May 18 '25 18:05 binki