Page 1 of 3

[Solved] Linux host with 2 user accounts sharing one Guest

Posted: 24. Apr 2009, 05:56
by vboxmember
System Specs:
CPU: Intel Core 2 Extreme X9650, 3GHz
MEM: 4GB
Host OS: Kubuntu (Hardy Haron v.8.04)
Guest OS: WinXP

Description and background:
Kubuntu has two user accounts that both need access to the same WinXP guest on the same computer. VirtualBox was successfully installed on the first user account. As that same first user, a successful install of a Guest WinXP was created inside that install of VirtualBox. The file permissions for all the VM files (.VirtualBox/ and all of its subdirectories... Mahcine, HardDisks, etc.) were set with the first user as the principle owner of the files, and "vboxusers" as the group the files belong to. Also the Group was set to have read write permissions on those files as well as the principle owner. Both the first and second user accounts were added the the "vboxusers" group. This allowed the second user to have access to the VirtualBox files created by the first user.

When logged in as the second user, Virtual Box starts up and runs fine. I can load the "vxp_pro32_20GB.vdi" file from the second user account via the "Virtual Media Manager" (CTRL+D) (located in the file menu) ok, but it said this VDI file was "unattached". So I attempted to create a new VDI, and gave it the same name the first user gave to this file "vxp_pro32_20GB". Then the Virtual Media Manager asked me if I wanted to create a new VDI or use an existing one. I told it to use the existing file created by the first user "vxp_pro32_20GB.vdi". I selected the same amount of memory for the file that the first user chose 1750MB, and at this point we are on the final screen with the "finish" button located at the bottom.

Problem:
When I click "Finish" (see description above, last sentence of 2nd paragraph), I receive the following error message:
-------- Error Message Begins --------
Failed to create a new virtual machine.

Machine settings file '/media/ic3_1/.VirtualBox/Machines/vxp_pro32_20GB/vxp_pro32_20GB.xml' already exists.

Result Code:
VBOX_E_FILE_ERROR (0x80BB0004)
Component:
Machine
Interface:
IMachine {13420cbb-175a-4456-85d0-301126dfdec7}
Callee:
IVirtualBox {779264f4-65ed-48ed-be39-518ca549e296}
-------- Error Message Ends --------

Comment:
Of course the file already exists, thats the file I want VirtualBox to "atatch" and use via the second user account on the host. :roll:

Question:
What the heck? :? Am I going about this the wrong way? Is there another way to accomplish what I'm attempting to do or did I just miss some configuration option along the way?

Please respond if you have any requests for clarification or have helpful productive advice.
Thank you for your time and patients.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 24. Apr 2009, 12:44
by Sasquatch
This has been asked, and explained in full detail at least two times on the forums already. Please use the search trick from the Forum Posting Guide to find the topics. It involves putting the VM settings in a generic location where both users can access the VM, and point to the same settings file. More details in the other topics you can find with the search.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 24. Apr 2009, 17:42
by vboxmember
Could you clarify exactly which file or files your referring to with the "settings" file?

Also note, that I've done searches for "multiple accounts" "multiple users" "user account" "WinXP Guest" "Linux Host" and more, and every combination of these that I could think of. Also just now I did a search using [+VM +settings +user +accounts], all of which turned up no helpful information. So clearly searching for the answer doesn't work, which is exactly why I have no choice but to post the question. You might be able to find the answer, but that also isn't helpful to me unless 1 of 3 things happen. 1) you give the answer to me, or 2) you point me exactly to the information I'm looking for or 3) you suggest the un-guessable magic search query that by some miracle actually returns a solution.

Thanks.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 24. Apr 2009, 19:13
by Sasquatch
Google can find almost everything.
http://www.google.com/search?client=ope ... 8&oe=utf-8
http://forums.virtualbox.org/viewtopic.php?p=53418
That's about it from what I could find. There is a better topic than the one I linked to, but I can't find it. And digging through my 7k+ posts is a hell :P.

The "magic" is in the .VirtualBox folder in your Home folder. If you put that in a generic location, like /home/virtualbox and have the vboxusers group be full owner and read/write permissions. Then you change the location for where VB looks for the settings and VMs by either symlinking to that folder, or simply set the VBOX_USER_HOME variable to that folder.

Good luck.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 24. Apr 2009, 20:42
by vboxmember
Here is a re-emphasis of the setup and how all users do have access:
All users have read write access to the .VirtualBox directory (which by the way is on its own physical hard drive) and all reads and writes from and to that directory and all of its subdirectories have been tested as successful under each user account in Kubuntu. This proves that all applicable users do have read write access to the .VirtualBox directories.

Here is a more detailed clarification of the problem:
Also note that the second user can start up VirtualBox, the program runs fine under there account. The Virtual Media Manager can recognize the vdi file and it can be added to the virtual hard disk list without any errors or complaints. The problem is that this disk is "unattached". What this means is, in the Virtual Media Manager screen on the "Hard Disks" tab, down at the bottom of this tab there is information about the loaded vdi file. 3 Points of information are given. Location, Type (Format), and Attached to. In the first user account, the "Attached to" information returns "vxp_pro32_20GB". In the second user account this simply reads "unattached", and there doesn't seem to be a way to force Vbox to attach the file.
Note: This can't be a file access problem in terms of file permissions because I already solved that problem earlier when the second user couldn't add the vdi file via the Virtual Media Manager due to file restrictions. Now that I have that part solved and the file can be added, we have now graduated to a whole new problem. "Attaching" the vdi file.

Questions:
Why doesn't Vbox have a way to "attach" this file? Is there a way to force VBox to attach a file under a second user account? Does that file have to be closed or "released" under the first user account before it can be attached by the second user account?

Next Steps to take:
However, seeing as how there is no button or selectable item in the Virtual Media Manager to "attach" a file after its been released via the "release" button or option, this is a little bit freaky to try and test. However I am just that freaky.
I will test this out and post the results.

Sasquatch,
Thank you for taking the time to help me search for an answer. I really needed some help, because every search I was trying returned either zero results or my own post which is still unanswered. Before I had posted my original question on this topic I had already taken the steps suggested by the first result obtained by your google search. In other words, the first search result did not address the issue I'm having. The second result doesn't have an answer. The third result is for a Macintosh. Search results 4 through 7 aren't even in the ball park. The 8th result is kinda cool and interesting but still doesn't address this issue. On and on it goes without anything that sheds any light on the problem at hand.

"...There is a better topic than the one I linked to, but I can't find it...."
If searching for the answer is this impossible then why do you always tell me to do it again even though it didn't work for me the first, (second, third, forth, and fifth etc.) times I've tried it, especially if you know the answer or can point me in the right direction? Thanks for your attempts to help me though, I mean your brand of helping is better than no help at all, so thank you for making an effort to be patient with me. After all I'm trying my best to be patient with you as well and I hope you can appreciate that.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 24. Apr 2009, 21:07
by vboxmember
[UPDATE]

releasing the vdi file via the Virtual Media Manager did not work and compounded the problem, because now both users can not "attach" the vdi file as I suspected would happen.
The main complaint by the system is that the xml file already exists. I'll try moving or renaming the xml file to something else to see if that helps any.

If that doesn't work then I guess I'll have to pass this torch to someone else because so far there is just no solution to this problem.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 24. Apr 2009, 21:29
by vboxmember
[UPDATE]

Moving or renaming the xml file in the Machines folder did the trick. However, this is an unreasonable method for switching user accounts because what it would entail is:
1. Unattaching the vdi from the Virtual Media Manager in the first user account via the release button,
2. then moving or renaming the associated xml file in the Machines folder,
3. then creating a New vdi file via the "New" button in the main program window or by pressing "CTRL+N",
4. Then selecting a name for it and choosing the vdi file already created previously, selecting memory allocation (probably should all be the same as the original file).
5. Then going into the settings and resetting everything to match the original file....

...this works but is just flat out retarded
There should be a one step solution to this problem that doesn't involve having the second user know how to do all these steps in order to boot an XP VM. In fact this defeats the whole purpose of even having a VM in the first place because it would be faster to reboot the computer into a real XP install.

So unless any one has has any idea's on how to make this work I guess we can chalk this one up to unsolvable or impossible.
If this is true then the only real solution is to fork out the big bucks and add an extra physical HD for the second users install of XP, but that sort of defeats the purpose of having multiple user accounts in XP.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 24. Apr 2009, 21:57
by vbox4me2
Your making a rod for your own back, itsa quite simple.
There is one master virtualbox.xml file, this file has references to the machine.xml files and thats it, make them all available to all user at one central location, use the VBOX_USER_HOME variable for all users to point to the location of the master.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 24. Apr 2009, 22:07
by Sasquatch
I've tried to reproduce your first error, by executing virtualbox from a terminal with sudo, so it's as root. But I could not get that to behave like your issue. I think this is the reason why. When I started VB from CLI, I used this command:

Code: Select all

sudo VBOX_USER_HOME="/extern/Virtual Machines/" VirtualBox
Where VBOX_USER_HOME is the location of my VM storage location, including the VirtualBox.xml file. When checking the manual, chapter 9.1 Advanced Topics - VirtualBox Configuration data, this is explained as this:
VirtualBox creates this configuration directory automatically, if necessary. Op-
tionally, you can supply an alternate configuration directory by setting the
VBOX_USER_HOME environment variable.
As how I've said before, but you probably missed it, setting that variable will solve your problem. You found the work around by copying that file from one user to the other, while you could have done this. Now, this variable is set in your .bashrc file, or any other place that's read by your system for envitomental variables.
The solution I have for my laptop and PC, as they share the same VMs which are stored on my external hard drive, is symlinking ~/.VirtualBox/VirtualBox.xml to the VirtualBox.xml file on the external drive. Every change I make on my PC, is available on my laptop and the other way around.

I hope this helps you to get it fixed properly.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 25. Apr 2009, 05:48
by vboxmember
This doesn't work and as I've already stated I already did this stuff.

In the first users .bashrc file, in the second users .bashrc file, and even in the system wide /etc/bash.bashrc file are the following lines at the end of each file:
VBOX_USER_HOME=/media/ic3_1/.VirtualBox/
export VBOX_USER_HOME

The same exact problem is still occurring on the second users account. When I start VirtualBox there are no VM's listed in the left hand panel, and even though I can load the VDI file created by the first user via the Virtual Media Manager option in the file menu, it can not be "attached" by any means. This also does not solve the problem of the VM not being listed in the first place. Also ,if I attempt to create a new VM and tell it to use the existing VDI file created by the first user, I get the same error message about the xml file already exists as listed in my first post of this thread.

As I've stated I read the manuals, I've searched for a solution, I've tried everything I could think of and nothing seems to fix this problem.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 25. Apr 2009, 06:01
by vboxmember
As a side note:
When activating VB as root from the CLI to simulate a different user using the same methodology sasquatch used:
sudo VBOX_USER_HOME=/media/ic3_1/.VirtualBox/ VirtualBox

This results in the same exact problems the second user account is having with VirtualBox.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 25. Apr 2009, 09:57
by Sasquatch
First of all, if you use enviromental variables, you can set them in two different ways. You have them both. All nice, but if you use export, you have to give it a value too. Just echo it from a terminal and see what value you get.
Now, did you also try my own method, by symlinking the file? I must state that my VMs are stored on an NTFS drive and my user on both my PC and Laptop have the same UID etc. So if there is anything about permissions, I'm not having an issue with it.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 25. Apr 2009, 12:52
by vbox4me2
To be sure things are centralized, run VB and make a small change (add a new VM) then exit and check which files and where they are changed, repeat for other users until they all are changing in the same place.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 26. Apr 2009, 00:14
by vboxmember
vbox4me2,

When you say "in the same place" do you mean the exact same place because when I make a new VM VirtualBox creates a new folder for each VM of the same name as the file being created.
So for example:
user1 has a VDI file called vxp_pro32_20GB.vdi and this was placed in a folder created by VirtualBox called vxp_pro32_20GB. (Full path: /media/ic3_1/.VirtualBox/HardDisks/vxp_pro32_20GB/)
I logged into user2's account and did created a new VM called tempVM.
user2 has a VDI file called tempVM.vdi and this was placed in a folder created by VirtualBox called tempVM. (Full path: /media/ic3_1/.VirtualBox/HardDisks/tempVM).

So, since VirtualBox is creating folders this makes it difficult to place everything in the same folder, but I'm not sure if thats what you meant. (Also note that xml files for the respective VM's are going into folders of the respective VM name under: /media/ic3_1/.VirtualBox/Machines/) This also means that the only way to make a new VM go into the same folder is if it has the same name as an already created VM, and then it complains that the xml file already exists, but we've already gone down that road.

Sasquatch,
Thanks for correcting my errors with the environment variables. References on how to do simple basic things such as environment variables or setting the path in Linux are difficult to find and are often very unclear or vague at best. So thanks for the clarification. The echo command just echo's whatever I type after echo so I used the "export -p" command instead to see if the environment variables were set after fixing them.

export -p returns the following in both user1 and user2 accounts:
declare -x VBOX_USER_HOME="/media/ic3_1/.VirtualBox/"
(Note: the declare -x part has something to do with the export function as all the environment variables returned from that command had that at the beginning of the line.)

I haven't tried the symlink example you gave because I don't have anything to symlink too (or maybe from depending on what you mean). There is only the one xml file in use.

Note: In VirtualBox under the file menu under the permissions submenu, I have the following settings set in both VirtualBoxes on both user accounts:
General:
Default Hard Disk Folder: /media/ic3_1/.VirtualBox/HardDisks
Default Machine Folder: /media/ic3_1/.VirtualBox/Machines

The rest of the settings were left at there default values.

Re: Linux host with 2 user accounts sharing the same WinXP Guest

Posted: 26. Apr 2009, 00:23
by vboxmember
[CORRECTION]
I was mistaken in my previous post.

vbox4me2,
VirtualBox is making folders for the xml files but NOT the vdi files.

Simplified example: user1 creates a VM called tempVM1, and user2 creates a VM called tempVM2
tempVM1.vdi, and tempVM2.vdi are both ending up in /media/ic3_1/.VirtualBox/HardDisks/
but, tempVM1.xml is ending up in /media/ic3_1/.VirtualBox/Machines/tempVM1/
and, tempVM2.xml is ending up in /media/ic3_1/.VirtualBox/Machines/tempVM2/

I hope this clarifies the error I made in the previous post.
Thanks again for taking the time to help me figure this out.