Change location of virtual machines doesn't work

This is for discussing general topics about how to use VirtualBox.
nandayo
Posts: 17
Joined: 8. Sep 2008, 20:37

Change location of virtual machines doesn't work

Post by nandayo »

Hi,

I want my virtual HDD and machines not to be in the standard path C:/users/.... . Then, I copy-pasted all the ./Virtualbox folder elsewhere, and I specified the new path to VB. However, when I started VB, he didn't found any machine nor any HDD. I can add the HDD using the "media" menu, but the machines still absent.

The last thing I tried was to copy-paste the files VirtualBox.xml and VirtualBox.xml-prev in the standard folder C:/users...., and launched VB ; the machines were, of course, present, but not working, due to error looking like

Code: Select all

Runtime error opening 'C:\Users\toto\.VirtualBox\Machines\Kubuntu\Kubuntu.xml' for reading: -103 (Path not found.).
D:\tinderbox\win-3.2\src\VBox\Main\MachineImpl.cpp[667] (Machine::registeredInit).
Code d'erreur : 
E_FAIL (0x80004005)
Composant : 
VirtualBox
Interface : 
IVirtualBox {3f36e024-7fed-4f20-a02c-9158a82b44e6}
I don't understand... VB should only need the paths I gave him to work properly, why doesn't it work ?

Thx !
Last edited by nandayo on 28. Aug 2010, 19:43, edited 5 times in total.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Specification of location of HDD and machines : problem

Post by Perryg »

Did you also change the location information in the preferences of VirtualBox? Located under file in the main VirtualBox program.
If you also have snapshots this can cause them to fail to work. You would need to also change the location of the snapshot folder in each guests settings.
You will need to make sure that you leave the VirtualBox.xml file in its original location or VBox will fail.
nandayo
Posts: 17
Joined: 8. Sep 2008, 20:37

Re: Specification of location of HDD and machines : problem

Post by nandayo »

When I said I changed the location path of HDD and machines, it was of course in the preferences -> general settings (is there something else ?). I don't have any snapshots.

As I said, I already tried :

- to copy-paste the original VirtualBox.xml and VirtualBox.xml-prev files in C:\Users\toto\.VirtualBox : I had the above mentionned errors.

- delete those files, but in that case there is no way to display the machines located in my new path, VB seems to just ignore the paths I specified...


Finally, I just tried to create a new virtual machine, and... VB created it in C:\Users\toto\.VirtualBox !

Then, specification of machines folder definitly doesn't work, this is a bug.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Change location of virtual machines doesn't work

Post by Perryg »

No it is not a bug. You are changing the way VirtualBox stores its file locations and do not have the pointer right.
If you have copied and pasted the folders from their original location to a different location you must tell VirtualBox where to find them. If you can not do this with the preference section then you must manually do it by editing the VirtualBox.xml file.
Make a backup copy and edit it to point all references for the virtual machines to state the full path to the files.
nandayo
Posts: 17
Joined: 8. Sep 2008, 20:37

Re: Change location of virtual machines doesn't work

Post by nandayo »

I'm sorry but this is a bug, I'm pretty sure of it. All path in the XML files are relative, so VB just need to know the new paths in the preferences (and I said I did it in each of my posts, are you sure you read what I write ? :? ), no need to make anything more if everything was OK.

If you don't think this is a bug, just do this : change your path of HDD and machines in the preferences, and then create a new machine and a new HDD. Then, go in your new location and see that the machine are not here : VB created them in the original path C:/Users/...

How do you explain that if no bug ? ;)
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Change location of virtual machines doesn't work

Post by Perryg »

Then you have the only copy of VirtualBox that does this. I have never had this problem and have my guests stored to a different location on all of the computers that I use. Creating a new VM stores it where it is told to and where I told it to put them.

Windows machine have my user space as the main and stores to a completely different drive.
Linux machines also have the main file in the user space and guests are stored to an external drive.

Close down the VirtualBox program completely if you have changed the location in preferences and see if it picks it up properly when you start it again. Allow a few seconds between stopping and starting.
nandayo
Posts: 17
Joined: 8. Sep 2008, 20:37

Re: Change location of virtual machines doesn't work

Post by nandayo »

Well, this time you're right, sorry ; I don't understand, I tried the manipulation 2 or 3 times and it was created in C:/ ; I guess it is an obligation to close VB and restart it to make the new path operational (this should be said !).

However, VB is still not seeing my machines in the new location. The new paths are entered in the preferences, and I checked manually in the VirtualBox.xml and VirtualBox.xml-prev files, the path are good :

Code: Select all

<SystemProperties defaultMachineFolder="E:\Virtualisation\.VirtualBox\Machines" defaultHardDiskFolder="E:\Virtualisation\.VirtualBox\HardDisks"
In E:\Virtualisation\.VirtualBox\Machines , I have my 3 machines (I used copy paste of the above adress in the file browser to be sure of what I say), but none is shown by VB.

I definitively don't understand why :?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Change location of virtual machines doesn't work

Post by Sasquatch »

If you moved the entire .VirtualBox folder, then just set the system variable VBOX_USER_HOME to that new location. Should work. If it doesn't (meaning the VMs are still inaccessible), then you need to edit all the XML files to make the paths absolute.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
nandayo
Posts: 17
Joined: 8. Sep 2008, 20:37

Re: Change location of virtual machines doesn't work

Post by nandayo »

This worked perfectly, thanks, but this env variable didn't existed, I had to create it, I don't know if this is normal (I'm under w7). Each time I will reinstall my exploitation system and then reinstall virtualbox (and, consequently, specifly to VB the path where my VM and HDD are stored), I guess I will have to make this (non standard...) operation ? This is rather strange... I guess it works because VB read the old VirtualBox.xml and VirtualBox.xml-prev files, but this is not a natural operation...

According to you, after a reinstallation of VB, what is the proprer way to say him "my VM and HDD are stored here" ? (because specifying the path in the preferences is not enougth... :? )
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Change location of virtual machines doesn't work

Post by Sasquatch »

I have a W7 Host (work laptop) and with that, I created the VBOX_USER_HOME variable for both users (local user and domain user) that is set to the location I want to use. Whenever you reinstall Windows or go back to a point where the variable didn't exist, you indeed have to recreate it and at least log out and back in (if you set it as user variable, else reboot when set as system variable). This setting is saved in the system registry, so you can even export it to a .reg file and import it when needed.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Change location of virtual machines doesn't work

Post by mpack »

nandayo wrote:I had to create it, I don't know if this is normal (I'm under w7)
It's normal. The VBOX_USER_HOME variable overrides the default location for VirtualBox.xml. If you don't need to override the default then you don't need the environment variable.
nandayo
Posts: 17
Joined: 8. Sep 2008, 20:37

Re: Change location of virtual machines doesn't work

Post by nandayo »

Ok ; however, there's one thing I don't really understand : what's the goal of the options in the "preferences" that allow us to change the location of HDD and VM ? I mean: it is clear that without the knowloedge (and the creation !) of this environment variable, those options are actually useless because VB is unable to retrieve VM and HDD after the next installation, even by specifying those path in the preferences ! So, by specifying the path, you can create your HDD and VM elsewhere, but after next installation you'll be unable to read it ? What's the point in that doing ?... :?

Then, I wonder why don't the dev make VM to be able to read the VM and HDD in another location witout having to also change the default location for VirtualBox.xml ? (this is not obvious that it is so necessary...). Why wouldn't it be possible to have the default location for VirtualBox.xml in C:/Users/... , and the VM and HDD path specified in the preferences ? After an installation, I go to preferences, I specify the path for HDD and VM, virtualbox reads it and that's all, I'm done ! It would be so intuitive and so more simple ! :wink:

Thx.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Change location of virtual machines doesn't work

Post by Sasquatch »

That is already what is implemented and how the preferences work. When you create a VM and VDI first, then change the location, all new VMs and VDIs will be in that new location. If you move the existing one, it won't be picked up because the paths for the corresponding files haven't changed. So if you want to keep the VirtualBox.xml file in the default location (\users\<user>\.VirtualBox), but have the rest somewhere else, you set the location first before you create a VM or anything. Nothing is forgotten or lost after a reinstallation, unless of course you remove the main XML file that holds these settings.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Change location of virtual machines doesn't work

Post by mpack »

The preferences inside the GUI do indeed allow you to change the location of your VM xmls, plus the default folder for hard disk images. However that information is read (by the GUI) from VirtualBox.xml, so it's quite obvious that there must be a separate mechanism to locate VirtualBox.xml. The steps are :-

1. GUI starts up.
2. GUI reads VirtualBox.xml from VBOX_USER_HOME (if defined) or from default location (if not defined).
3. GUI parses VirtualBox.xml and extracts list of VM names, and default home folders for VMs and hard disk images.

Since VirtualBox.xml is tiny I feel no strong desire to move it from its default location. I do however locate the hard disk images on a second drive.
nandayo
Posts: 17
Joined: 8. Sep 2008, 20:37

Re: Change location of virtual machines doesn't work

Post by nandayo »

mpack wrote:Since VirtualBox.xml is tiny I feel no strong desire to move it from its default location.
Exactly, that's the way I think too, I don't care about where the VirtualBox.xml file is located, the default location is ok for me !
Sasquatch wrote: Nothing is forgotten or lost after a reinstallation, unless of course you remove the main XML file that holds these settings.
mpack wrote:The preferences inside the GUI do indeed allow you to change the location of your VM xmls, plus the default folder for hard disk images. However that information is read (by the GUI) from VirtualBox.xml, so it's quite obvious that there must be a separate mechanism to locate VirtualBox.xml.
Sure, I understand well that the mechanism are separated, no problem with that. What I really don't understand is why, starting from a new and empty installation of VB, if I specify the paths for HDD and VM, why by god virtualbox don't say to himself "ok, here are the VM and the HDD paths, there are VM and HDD in those paths, I can read them, so let's generate (in the default place, it's ok !) the good VirtualBox.xml for the VM + HDD I found in those path !".

I really don't understand why it is not done in this way : in my (maybe naive) opinion it would not be necessary to save the VirtualBox.xml file, VB should be able to generate it by himself if I give him the paths of VM and HDD ! Saving the VirtualBox.xml file sounds just redoundant for me... or there's is something I really don't understand !
Last edited by nandayo on 29. Aug 2010, 16:12, edited 1 time in total.
Post Reply