Unable to modify VirtualBox.xml

Discussions related to using VirtualBox on Linux hosts.

Unable to modify VirtualBox.xml

Postby jonzilla » 7. Dec 2021, 17:48

VirtualBox 6.024

Hi, I manually moved a virtual machine and modified the Machine Entry source location the VirtualBox.xml file (also the VirtualBox.xml-prev file) to reflect this. Unfortunately, when I start up VirtualBox again, the same virtual machine is still being listed in the old location, and not the new location. Re-opening the VirtualBox.xml file shows that it has been reverted to the previous location as well.

How is the VirtualBox.xml file being reverted back to the previous information, and where is that (previous) information coming from?
jonzilla
 
Posts: 4
Joined: 25. Jun 2019, 00:30

Re: Unable to modify VirtualBox.xml

Postby scottgus1 » 7. Dec 2021, 18:32

Did you notice the first lines in Virtualbox.xml?
<?xml version="1.0"?>
<!--
** DO NOT EDIT THIS FILE.
** If you make changes to this file while any VirtualBox related application
** is running, your changes will be overwritten later, without taking effect.
** Use VBoxManage or the VirtualBox Manager GUI to make changes.
-->

:wink:

jonzilla wrote:How is the VirtualBox.xml file being reverted

There is a service 'VboxSVC' which runs when any Virtualbox process is running, and which stays running for a short period of time after all Virtualbox processes have stopped.

While VboxSVC is running, the contents of Virtualbox.xml and all registered VM .vbox files are kept in Virtualbox's memory, and can be written back to disk at any time without regard for manual edits, thus that sticky wicket in the warning message: "If you make changes to this file while any VirtualBox related application is running, your changes will be overwritten later, without taking effect."

Making manual edits to Virtualbox.xml or a .vbox file is possible if VboxSVC is not running. Making sure you have no VMs set to run as a service, etc, then rebooting the host and not starting any Virtualbox processes usually ensures that VboxSVC will not be running. You can check the Task Manager to be sure. Then you can manually edit Virtualbox.xml etc.

Note that manual edits to Virtualbox.xml or the .vbox's are not error-checked in Virtualbox like changes made by Vboxmanage or the main Virtualbox window. So you could really bung up the plumbing majorly. Adding VMs can cause duplicated UUIDs which would cause trouble and which would be caught when using the supported methods.

jonzilla wrote:I manually moved a virtual machine

How about the Move command? (see the VM's right-click menu in the VM list.)
scottgus1
Site Moderator
 
Posts: 14347
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Unable to modify VirtualBox.xml

Postby jonzilla » 7. Dec 2021, 19:37

scottgus1 wrote:There is a service 'VboxSVC' which runs when any Virtualbox process is running, and which stays running for a short period of time after all Virtualbox processes have stopped.

While VboxSVC is running, the contents of Virtualbox.xml and all registered VM .vbox files are kept in Virtualbox's memory, and can be written back to disk at any time without regard for manual edits...


Thanks Scott, that was the little bugger indeed; once I stopped it I was able to effect the change and have it stick. Cheers!
jonzilla
 
Posts: 4
Joined: 25. Jun 2019, 00:30

Re: Unable to modify VirtualBox.xml

Postby scottgus1 » 7. Dec 2021, 19:38

Great! Glad you're up and running.
scottgus1
Site Moderator
 
Posts: 14347
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux


Return to VirtualBox on Linux Hosts

Who is online

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