1

Overview: I have a device with multiple operating systems installed, and I use VirtualBox to run virtual machines on each operating system. I often switch between the different operating systems, and I'm looking for a way to automatically load a virtual machine in VirtualBox on each operating system without having to repeat the steps of adding the virtual machine.

Setup: My device is running Windows 10 (the main one, which is used more often) and Zorin 16, each installed on a separate partition. I use VirtualBox v6.1.38 on both operating systems to run virtual machines. Both VBox programs have correctly configured the path to wherever those vms are stored.

Problem: As I already mentioned, I run VirtualBox more often on Windows, so whenever I want to run a vm, I must manually add the virtual machine to VirtualBox and point to the location of the virtual hard disk file. This can be time-consuming and repetitive, especially if I have multiple virtual machines.

Question: Is there a way to configure VirtualBox to automatically load a virtual machine on a different operating systems without having to repeat the steps of adding the virtual machine? For example, can I set a default location for VirtualBox to look for vms?

Any help or suggestions would be greatly appreciated. Thank you.

7
  • Why do you do that, mr Ninja?
    – Gantendo
    Commented May 10, 2023 at 16:55
  • I prefer using Windows rather than Linux, but sometimes I may need to use Linux for, I don't know, modifying (and creating) a grub menu. There's probably other ways to do that, but why not?
    – MarcZX10
    Commented May 10, 2023 at 17:06
  • Hi, so are you saying that both VBs point to the same directory, yet machines aren't automatically loaded if directory content changes?
    – Destroy666
    Commented May 10, 2023 at 17:16
  • @Destroy666 Yes, exactly
    – MarcZX10
    Commented May 10, 2023 at 17:34
  • How do you do it manually? In Virtual Box Manager you click Add and simply select the .vbox file? Commented May 10, 2023 at 20:16

1 Answer 1

1

You are going to need to write some code to make this happen I think.

That list of VMs are stored in an xml file called "VirtualBox.xml". I think that is all you need.

In windows, it is stored in %UserProfile%\.virtualbox .. in Linux, it is stored in $HOME/.VirtualBox.

Once you look in this file, you will know immediately why it can't be shared as the path information is specific to the operating system. It is possible that you might be able to use relative paths and forward slashes to share the file but I cannot confirm this without more effort than I have time to apply.

The VirtualBox.xml file I speak of is documented here.

There is a tool called VBoxManage that comes with virtualbox that might allow you to manage these configurations without writing the code yourself. :) Any programmer could do this "by hand" but WHY? when there is a nifty tool to handle it??

You will still need some script but this task becomes easier. The command VBoxManage --registervm <file> should allow you to import existing VMs to the list. You will need script to discover what there is and import each item. On the Linux side, you might try blowing away the VirtualBox.xml and creating it from scratch. This is assuming that you don't need any of the settings in there (look at the settings).

You can see the tool mentioned in the link I provided above.

Good luck.

1
  • Thank you so much!! I guess the windows script is going to be easy to make with that tool, but I may need to search further about the linux way. Gracias de todas formas jeje
    – MarcZX10
    Commented May 11, 2023 at 15:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .