Standalone backup agent for Microsoft Windows servers and workstations (formerly Veeam Endpoint Backup FREE)
Post Reply
edechamps
Lurker
Posts: 2
Liked: never
Joined: Sep 30, 2023 3:10 pm
Full Name: Etienne Dechamps
Contact:

Waking up from Modern Standy

Post by edechamps »

Hi,

I have set up Veeam Agent for Windows on a brand new Windows 11 laptop (Samsung Galaxy Book3 Pro 360) with all the latest bells and whistles.

I have configured it to run the backup every night at 2.30am. During this time the laptop is asleep but connected to AC power.

I noticed that Veeam doesn't seem to be able to wake up the laptop from sleep. As a result, the backup only starts when a human turns on the laptop.

The Veeam docs state:
If at the moment of backup a computer is in the Connected Standby power saving mode, Veeam Agent for Microsoft Windows will fail to wake it up due to limitations set by the OS itself.
This would seem to be a pretty big problem for modern laptops. Nowadays, many laptops can't even enter S3 anymore - it's either Modern Standby or fully on.

A typical usage pattern for a laptop is to use it on battery, and leave it to charge in standby during the night. With that usage pattern in mind, if Veeam can't run while the laptop is plugged in (because it's typically in standby), then the logical consequence is that it can only run while the laptop is running on battery, which is… obviously not great!

Honestly I'm a bit incredulous that Microsoft would not provide any around this.

The Microsoft docs state:
Modern Standby systems can go into maintenance mode while on AC power. If a maintenance task occurs while on AC power, updates and other activities could occur and use the network if a connection is available.
And indeed, SleepStudy does show that during the night my laptop woke up several times for "maintenance", so clearly some tasks are able to wake up the PC - just not Veeam, it seems.

The automatic maintenance docs explain that a scheduled task must abide by various rules for it to run during these "maintenance windows". Does Veeam follow these rules?

How does Veeam schedule the backup, anyway? I would have expected Veeam to create a standard Windows Task Scheduler task to run the backup, but I couldn't find it.
Mildur
Product Manager
Posts: 8735
Liked: 2294 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: Waking up from Modern Standy

Post by Mildur »

Hello Etienne

Thanks for sharing your research.
We don't use the windows task scheduler. We deploy our own service (VeeamEndpointBackupSvc) which takes care of scheduling backup job sessions.

Can you work around the limitation by starting the backup at a logoff event? You may have to configure Back up no more often than every for 12 hours to not have a backup every time you logoff.
https://helpcenter.veeam.com/docs/agent ... tml?ver=60

Best,
Fabian
Product Management Analyst @ Veeam Software
edechamps
Lurker
Posts: 2
Liked: never
Joined: Sep 30, 2023 3:10 pm
Full Name: Etienne Dechamps
Contact:

Re: Waking up from Modern Standy

Post by edechamps »

Sorry for the very long delay in replying, I got distracted by other things. I took another look at this issue.
Mildur wrote: Oct 10, 2023 9:43 amCan you work around the limitation by starting the backup at a logoff event? You may have to configure Back up no more often than every for 12 hours to not have a backup every time you logoff.
I didn't try this because it's, well, a workaround, and one that only seems marginally better than just letting Veeam run the backup as soon as the PC wakes (which is the de facto Veeam default behavior in a Modern Standby world).

I do have some good news, however: I did manage to get Veeam to run during a Modern Stanby "maintenance window" as I was alluding to in my previous post!

The way I did it is by creating a Windows Task Scheduler task that uses the Veeam Agent Command Line Interface to run a backup. The command waits for the backup job to complete before finishing, which is a good thing since it keeps the scheduled task in the "running" state thus preventing Windows from going back to sleep while the backup job is running.

I manually exported, edited and re-imported the scheduled task XML file to add the relevant configuration for an automatic maintenance task (I couldn't find a way to do this using the Task Scheduler GUI). For reference I ended up with a Scheduled Task that looks like this (note the <MaintenanceSettings> section):

Code: Select all

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2023-12-18T14:52:51.1735121</Date>
    <Author>(snip)</Author>
    <URI>\Veeam backup</URI>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <StartBoundary>2023-12-19T02:00:00</StartBoundary>
      <ExecutionTimeLimit>P1D</ExecutionTimeLimit>
      <Enabled>true</Enabled>
      <RandomDelay>PT1H</RandomDelay>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-18</UserId>
      <RunLevel>LeastPrivilege</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>StopExisting</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>true</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>
    <NetworkSettings>
      <Name>(snip)</Name>
      <Id>{2D8F33DC-614D-425E-8334-DBCDF7468BBD}</Id>
    </NetworkSettings>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
    <MaintenanceSettings>
      <Period>P1D</Period>
      <Deadline>P5D</Deadline>
      <Exclusive>false</Exclusive>
    </MaintenanceSettings>
    <WakeToRun>true</WakeToRun>
    <ExecutionTimeLimit>P1D</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>"C:\Program Files\Veeam\Endpoint Backup\Veeam.EndPoint.Manager.exe"</Command>
      <Arguments>backup 54216ddc-6733-4ef5-9e31-275ca4f7fc70</Arguments>
    </Exec>
  </Actions>
</Task>
And lo and behold, it works! `powercfg /sleepstudy` confirms the computer woke from Modern Standby because of my "Veeam Backup" scheduled task:

Image

One thing that's a bit tricky here though is that Windows will kill the task if it takes more than 1 hour to run. This is a problem if the backup takes more than 1 hour (e.g. lots of changed files, long incremental backup merge, etc.). Unfortunately that 1-hour hard deadline does not seem to be configurable. However the docs do describe a mechanism by which the task will be given more time to complete if it fails multiple times in a row. Maybe that's good enough - I don't know as I haven't seen that mechanism in action yet.

Another issue with this approach is that, as explained in the Veeam docs, when triggering a backup job from the command line some Veeam settings are ignored, such as network restrictions. Fortunately Windows makes it possible to configure a Scheduled Task to only start if a specific network is accessible. It's not as flexible (e.g. can't select multiple networks) but it's one way to work around this limitation I guess.

I think Veeam devs should seriously consider integrating more cleanly with this mechanism. Modern Standby is here to stay, so this problem will only get worse over time as more and more Windows PCs adopt this paradigm. Ideally the Veeam Agent should automatically install and enable a Windows task to run within the maintenance window. That task could either just "ping" Veeam's own scheduler so that it can take over, or it could just replace Veeam's scheduler entirely. Additionally, the Veeam agent needs to behave more gracefully when faced with the 1-hour deadline. According to Microsoft docs, the recommendation is that the task should be designed such that it can be interrupted and then resumed later - this would imply the Veeam agent needs a new feature where a backup job can be stopped and then resumed later (without having to restart it from scratch). (Honestly this would seem generally useful regardless, as backups can be interrupted for many reasons anyway, e.g. loss of network, and it would be nice if they could just gracefully resume as soon as the system has recovered) I think the ideal behavior would be for the Veeam agent to try to complete the backup within the 1-hour window, and if it can't then it can either rely on the "emergency maintenance window" (maintenance deadline option) to finish the backup job from where it was interrupted, or it could simply resume it as soon as the computer wakes up again.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 22 guests