Ubuntu and Vagrant guests fail to start while robocopy is running

Discussions related to using VirtualBox on Windows hosts.
Post Reply
wla2000
Posts: 2
Joined: 19. May 2017, 15:01

Ubuntu and Vagrant guests fail to start while robocopy is running

Post by wla2000 »

Each morning when I turn on my Windows 10 workstation I run a batch script that copies new or changed files from my home directory to an external hard drive. I use robocopy with these options:

Code: Select all

robocopy c:<home directory> d:home /MIR /FFT /Z /NP /NDL /XJD /MT:4 /w:10 /r:0 /e /xd <directory names to skip> /xf <specific files to skip> 
While this backup is running (which takes about 10 minutes or so), I cannot start my Ubuntu guest. I get the following message in a little dialog box:
Failed to open a session for the virtual machine Ubuntu2017Version.

Failed to open image 'C:\Users\<my name>\VirtualBox VMs\Ubuntu2017Version\Ubuntu2017Version.vdi' for writing due to wrong permissions (VERR_VD_IMAGE_READ_ONLY).

AHCI: Failed to attach drive to Port0 (VERR_VD_IMAGE_READ_ONLY).

Result Code: E_FAIL (0x80004005)
Component: ConsoleWrap
Interface: IConsole {872da645-4a9b-1727-bee2-5585105b9eed}
The problem is not limited to Ubuntu. I also have a Centos 6 Vagrant guest that I cannot start while my backup is running. Its log follows:
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/centos-6.8' is up to date...
==> default: A newer version of the box 'bento/centos-6.8' is available! You currently
==> default: have version '2.3.1'. The latest is version '2.3.4'. Run
==> default: `vagrant box update` to update.
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 8081 (guest) => 8081 (host) (adapter 1)
default: 8000 (guest) => 8000 (host) (adapter 1)
default: 8001 (guest) => 8001 (host) (adapter 1)
default: 9091 (guest) => 9091 (host) (adapter 1)
default: 3306 (guest) => 1234 (host) (adapter 1)
default: 9090 (guest) => 9090 (host) (adapter 1)
default: 5015 (guest) => 5015 (host) (adapter 1)
default: 22 (guest) => 2223 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["startvm", "7262f19d-5dcb-447a-9a3d-17b847eace96", "--type", "headless"]

Stderr: VBoxManage.exe: error: Failed to open image 'C:\Users\<my name>\VirtualBox VMs\toysdk-spacewalk\centos-6.8-x86_64-disk1.
vmdk' for writing due to wrong permissions (VERR_VD_IMAGE_READ_ONLY).
VBoxManage.exe: error: AHCI: Failed to attach drive to Port0 (VERR_VD_IMAGE_READ_ONLY)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
Any ideas how I can start these guests while the backup is running? Not that I have tried excluding .vmdk files in the C:\Users\<my name>\VirtualBox VMs directory and this hasn't helped.

Thanks.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Ubuntu and Vagrant guests fail to start while robocopy is running

Post by socratis »

To me it sounds like Robocopy is putting a lock on every file that it wants to copy, which is a good thing™, because you don't want files to change in the middle of your copy. I would look at the documentation of robocopy, but if it was me, I'd go for a smoke/coffee and come back in 10 minutes, after a proper backup was done.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
wla2000
Posts: 2
Joined: 19. May 2017, 15:01

Re: Ubuntu and Vagrant guests fail to start while robocopy is running

Post by wla2000 »

Thank you @socratis for your rapid reply. I hadn't thought to check the robocopy the documentation (and wouldn't have known what to check if you hadn't replied) for information on locked files. I found recommendations to run robocopy in backup mode (with the /B command line option). That worked, so now I can start my virtual box guests right away. Thanks again.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Ubuntu and Vagrant guests fail to start while robocopy is running

Post by socratis »

Another happy customer user ;)
Glad you got it working.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply