Jump to content











Photo
* * * * * 3 votes

Virtual Machine USB Boot

boot usb machine virtual

  • Please log in to reply
176 replies to this topic

#101 steve6375

steve6375

    Platinum Member

  • Developer
  • 7107 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars, www.easy2boot.com
  •  
    United Kingdom

Posted 14 December 2013 - 09:07 AM

I have noticed that on a fresh boot of my WIn7 64-bit systems (PC and Nbook) the very first time I try to run a VM from VMUB I always get an error 'Could not automatically add the drive(s) to the VirtualBox VM.' 'This is a virtual box bug.'

 

Could you not detect that this is the first time VMUB has been run and so delay a bit more or allow more time?



#102 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 14 December 2013 - 03:11 PM

It's right after Windows start? So VB Manager was never started until then in that Windows "session"...?

If you delay manually it works afterwards...? If yes, how much time it has to wait...?

 

LE: are you using the VBoxManage update method or the autodetect method...? The autodetect method is checked by default only if the cfg file is deleted...



#103 steve6375

steve6375

    Platinum Member

  • Developer
  • 7107 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars, www.easy2boot.com
  •  
    United Kingdom

Posted 14 December 2013 - 04:02 PM

Vboxmanage is ticked.

The length of time after booting does not matter.



#104 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 14 December 2013 - 04:11 PM

Try "autodetect", it should work better.

And if the length of time does not matter, a delay in VMUB won't solve the problem.

 

I think I remember us talking about the same problem a few months ago...



#105 steve6375

steve6375

    Platinum Member

  • Developer
  • 7107 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars, www.easy2boot.com
  •  
    United Kingdom

Posted 14 December 2013 - 04:24 PM

It works if Vboxmanage is disabled.

So why can't you retry as it always works the 2nd time?



#106 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 14 December 2013 - 04:56 PM

It looks that VBoxSVC.exe can't be started well the first time by VBoxManage.exe in your Win 7 x64.
Yes, I can make it retry but only after at least 30 sec (when VBoxManage process "kills" itself). I tried to kill it with an Api function but it's not helping..

 

LE: when you have some time to "kill" :D maybe you'll try to see if VBox 4.2.18 does the same...



#107 steve6375

steve6375

    Platinum Member

  • Developer
  • 7107 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars, www.easy2boot.com
  •  
    United Kingdom

Posted 14 December 2013 - 05:49 PM

 I have two Win7-64 systems (PC and NB) - both show same behaviour.

For Info: The error message appears very quickly - within a 5 seconds after clicking Start - clicking on the Start button of VMUB again quickly after quickly cancelling, causes the VM to start up within 5 seconds.



#108 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 15 December 2013 - 02:41 AM

Ok, I will install Win 7 x64 + Delphi on my computer too. I had it some time ago but I removed it because of the poor stability.

LE: I installed Win 7 Ultimate x64 SP1, VBox 4.3.4 and VMUB 1.3. I checked VBoxManage option and restarted Windows a few times. I didn't have any problems booting in VB VM with my USB drives (UAC on or off)...
Maybe it's from something your OSs have in common (application and/or setting).



#109 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 15 December 2013 - 02:30 PM

You could try to see how a VBoxManage command is carried out in a cmd:





"%VBOX_INSTALL_PATH%\VBoxManage.exe" modifyvm GUID_of_the_VM --hwvirtex off
"%VBOX_INSTALL_PATH%\VBoxManage.exe" modifyvm GUID_of_the_VM --hwvirtex on
pause

Replace GUID_of_the_VM and start it right after Windows start.

You can see if it fails or if it takes too much time to do the job...



#110 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 16 December 2013 - 09:45 AM

I think I found the cause of VBoxManage working fine the second time you press the start button so fast.
The old VBoxManage.exe session is still stuck in RAM, waiting for a valid VBoxSVC.exe session. If the new VBoxManage.exe session is started in a specific time interval it will start VboxSVC.exe and share it with the old session, which it will be unstuck, it will do its job and close.
This could be a way to make VBoxManage automatically retry instead of just notifying the user that it failed.
But there is a problem: that time interval is changing depending on hardware, software, VB version and RAM caching.
On your computer you found it (because you start VMUB so many times) but a computer program can't be that smart.



#111 steve6375

steve6375

    Platinum Member

  • Developer
  • 7107 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars, www.easy2boot.com
  •  
    United Kingdom

Posted 16 December 2013 - 10:31 AM

Does that fit with my observation that it is only the first time that VMUB is run, that it fails?

e.g.

 

Setup VMUB for Flash drive boot and test (VBoxManage.exe ticked)

Restart Win7

Run VMUB - Start  (don't use Edit or Options buttons) ---> fails

Wait 10 minutes

Run VMUB ---> OK



#112 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 16 December 2013 - 10:42 AM

I was talking about this:

 

For Info: The error message appears very quickly - within a 5 seconds after clicking Start - clicking on the Start button of VMUB again quickly after quickly cancelling, causes the VM to start up within 5 seconds.

 

 

 

 

 

But, regarding this:

 

 

 

Does that fit with my observation that it is only the first time that VMUB is run, that it fails?

e.g.

 

Setup VMUB for Flash drive boot and test (VBoxManage.exe ticked)

Restart Win7

Run VMUB - Start  (don't use Edit or Options buttons) ---> fails

Wait 10 minutes

Run VMUB ---> OK

 

In this situation VBoxManage has time to "kill" itself and the next session starts fine, because it will somehow fix the loading of VBoxSVC. But exactly how it does it, only Oracle programmers know it...

BTW, it "kills" itself in 30 sec so 45..60 sec of waiting should be more than enough.



#113 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 16 December 2013 - 10:51 AM

Btw, I mentioned VBoxSVC.exe many times but here is how VirtualBoxSDK describes it:

 

 

 

VirtualBox employs a client-server design, meaning that whenever any part of VirtualBox is running -- be it the Qt GUI, the VBoxManage command-line interface or any virtual machine --, a dedicated server process named VBoxSVC runs in the background. This allows multiple processes working with VirtualBox to cooperate without conflicts. These processes communicate to each other using inter-process communication facilities provided by the COM implementation of the host computer.

 

On Windows platforms, the VirtualBox Main API uses Microsoft COM, a native COM implementation. On all other platforms, Mozilla XPCOM, an open-source COM implementation, is used.



#114 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 16 December 2013 - 01:32 PM

Steve, I'm curious, does the "autodetect method" option is better or worse for you than "VBoxManage" option (when you test Easy2Boot for example)...?
If it's worse, why...?



#115 steve6375

steve6375

    Platinum Member

  • Developer
  • 7107 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars, www.easy2boot.com
  •  
    United Kingdom

Posted 16 December 2013 - 09:10 PM

I prefer to have VBox manager open so I can either run the VM from VBox manager (as r/o) or VMUB (as rd/wr) - however I get more problems with VBox mgr open.

Also, the .vmdk shows up as inaccessible in VBox mgr (as in the video) unless I login as user=admin so I can't run the VM from VBox in this mode. 



#116 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 17 December 2013 - 02:03 AM

I prefer to have VBox manager open so I can either run the VM from VBox manager (as r/o) or VMUB (as rd/wr) - however I get more problems with VBox mgr open.

 

Well, if the autodetect method finds the VB Manager open it will "switch" internally to using VBoxManage.exe. If it will not find it, it will "switch" to updating directly, solving your problem.

The detection code is checking every time you click on the Start button, so it will adapt if you close or restart VB Manager.

Give it a try... :)

 

 

 

Also, the .vmdk shows up as inaccessible in VBox mgr (as in the video) unless I login as user=admin so I can't run the VM from VBox in this mode. 

 

A normal user can't access a real drive directly. That's why VB and VMUB have to be started as an administrator.

Unfortunately I can't change this because Windows is made this way.

BTW, Linux is even "worst" with this  :D



#117 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15106 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 19 December 2013 - 04:33 PM

@DavidB

Found this while looking for something else:

http://sourceforge.n.../vboxvmservice/

 

Maybe it is somehow useful for your tool :unsure:

 

:cheers:

Wonko



#118 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 19 December 2013 - 07:11 PM

Thank you, Wonko.

It seems to be a way to run VirtualBox VMs like a Windows service, which is useful in some situations.
Anyway I couldn't start the VBoxVmService service on Windows XP, only in Vista\7 or above. Which is a serious limitation...

Another thing:
I'm thinking to "bypass" the VBoxManage.exe by sending directly API commands to the VB Manager using the VirtualBox COM server (VBoxSVC.exe) and the commands from VirtualBox 4.3.6 Software Developer Kit (SDK)

What I couldn't find (yet) is how to load the VBoxSVC.exe like VBoxManage.exe and VirtualBox.exe do (or perhaps even better if it's possible).

What do you think...?



#119 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 15106 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 19 December 2013 - 07:29 PM

What do you think...?

NO ideas. :(

However that page says "Supports XP, 2003, VISTA, Win7, 2008, Win8" so maybe there is *something* on your XP machine that is missing/misconfigured.  :dubbio:

Or maybe that applied to earlier release of Vbox? :unsure:

 

:cheers:

Wonko



#120 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 19 December 2013 - 09:09 PM

It works on XP too but in a strange way: when I activate or deactivate the service I have to try 2 times. One time with "Protect my computer and data from unauthorized program activity" from Run as checked, one time unchecked.
Another curious thing: once the service is started, if you try to start the VBox Manager or a VB VM directly, they don't start saying (after 30 sec) "VBox COM server failed to start".
But VBoxSVC.exe is loaded, I can see it in Processes. So, VirtualBox.exe crashes, VBoxSVC.exe needs to be closed manually and after that the service crashes too.
Anyway, using VmServiceControl.exe, I could start and close invisible VMs. That's all it can do...

In this form is not of much use for VMUB.
But it could be useful for others.

Anyway I think I can have a small chance with those API functions from VirtualBox SDK...
I will do some more "digging" in the documentation and on the internet.



#121 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 25 December 2013 - 03:07 PM

Merry Christmas to everybody!

Well, I have discovered something interesting.

First, let's review a little: the VirtualBox COM server (VBoxSVC.exe) is started and used as (only) one instance by the VBox Manager (VirtualBox.exe), by the VBox VMs (VirtualBox.exe with parameter) and by the VBoxManage.exe.
When all VirtualBox.exe and VBoxManage.exe instances are closed, VBoxSVC.exe process is waiting about 6 sec, it's "marked" for closing and in about 12 sec is closed.
If VirtualBox.exe or VBoxManage.exe instances are started in that 6..12 sec time interval, they will fail, because a new instance of the VBoxSVC.exe can't be created (as it is limited to only one) and the current one is closing.
This is the bug they introduced in VBox 4.2.20, since in VBox <= 4.2.18 you could open more than one VBoxSVC.exe instances. More, they "amplified" the problem in VBox >= 4.3.0 by increasing the time interval VBoxSvc.exe is closing from 1..2 sec to 6..7 sec.

But, if I kill the VBoxSVC.exe instance right after I use VirtualBox.exe or VBoxManage.exe (so before marking it for closing) and I start VBoxSVC.exe directly before using VirtualBox.exe or VBoxManage.exe again, there is no error anymore :)

I think it could also solve Steve's problem.
Steve, you could test it yourself by starting VBoxSVC.exe before using VMUB first time in that Windows session.

But there is a problem: killing a process is not a good idea (for good reasons). And killing it every time you start a VM is even less...

What do you think about that...?



#122 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 26 December 2013 - 12:35 PM

New version: 1.35 Beta 1

Changes:
1. Now it's adapting better to the small differences between VBox versions.
2. Before using VBoxManage.exe it waits for the current VBoxSVC.exe instance to close and it starts a new one. This way it will minimize the risk of VBoxManage.exe not doing its job.

Using the autodetect update method in the 1.3 version solved the VBoxManage errors on my computer. But now I can't see any of them even when I use the VBoxManage.exe update method.

But if you still experience problems, please let me know so I can try to fix them...

 

LE: download link removed, you can find a better version in the next posts



#123 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 27 December 2013 - 04:44 PM

A little offtopic:
That VirtualBox bug also affects the VBox Manager start and the VBox VM start. Basically, if you restart VirtualBox.exe in a 6..12 sec time interval, it will not say anything for 30 sec and then show you this error:

Screenshot.png

But, if you use this loader and restart VirtualBox.exe in that time interval, it will wait a few sec for VBoxSVC.exe to close and then it will start VirtualBox.exe.
It will adapt to different VBox versions. Also you can start it with command line parameters, set it to run as an administrator, set the window to minimized/normal/maximized and so on.

I hope someone will find it useful.

Here it is: Attached File  VBStartFix.zip   341.55KB   509 downloads

 

LE: a slightly better version was uploaded.



#124 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 28 December 2013 - 04:17 PM

New version: 1.35 Beta 2

Changes:
1. Few optimizations to the newly added code;
2. The autodetection of the update method was improved for the code which removes the drive from the VM after close.
 

LE: download link removed, you can find a better version in the next posts.



#125 DavidB

DavidB

    Silver Member

  • Developer
  • 611 posts

Posted 29 December 2013 - 05:49 AM

If you still have problems with VBoxManage.exe, a common cause could be you started the VBox Manager as a normal user.
In the VMUB description I included this for quite some time: "If you intend to use VirtualBox Manager in the same time with Virtual Machine USB Boot, it's wise to set its exe file or shortcut to be started as an administrator too."
VBoxManage.exe and VBox Manager can't work "together" if they are started by different users.
This is a limitation of VirtualBox (or maybe it was made this way intentionally, only Oracle knows).







Also tagged with one or more of these keywords: boot, usb, machine, virtual

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users