Page 1 of 2

Creating VMs from VBoxManage fails to create bridged ifs

Posted: 7. Mar 2012, 00:31
by paulehoffman
Greetings again. On a Ubuntu system, creating new VMs with bridged adapters doesn't work.
VBoxManage createvm --name foo1 --register
VBoxManage modifyvm foo1 --ostype Debian --memory 512
VBoxManage modifyvm foo1 --nic1 hostonly --nictype1 82540EM --hostonlyadapter1 'vboxnet0'
VBoxManage modifyvm foo1 --nic2 bridged --nictype2 82540EM --bridgeadapter1 'eth0' 
VBoxManage startvm foo1
Results in:
Waiting for VM "foo1" to power on...
VBoxManage: error: Failed to open/create the internal network 'HostInterfaceNetworking-' (VERR_INVALID_PARAMETER).
VBoxManage: error: Failed to attach the network LUN (VERR_INVALID_PARAMETER)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component Console, interface IConsole, callee
When I look at the VM in the GUI, I see that the second adapter is not marked as being for eth0. However, if I click on the Settings button, then OK in the dialog without touching any of the settings, I can see that the second adapter is marked as eth0 and the VM starts up just fine, both from the GUI and from the command line.

Has anyone else hit this bug? If so, is there a way around it?

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 7. Mar 2012, 01:33
by Perryg
What version of VirtualBox are you using?
And is it the install from VirtualBox.org or the Ubuntu repo?

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 7. Mar 2012, 01:51
by paulehoffman
4.1.8, from virtualbox.org

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 7. Mar 2012, 02:02
by Perryg
Hummm,

I don't see this issue on my main system, but... It is a build in the future.
If you run the commands and not open the VMM can you open the guests control file and are the entries there or missing, and is the syntax right?

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 7. Mar 2012, 03:25
by paulehoffman
Perryg wrote:Hummm,

I don't see this issue on my main system, but... It is a build in the future.
If you run the commands and not open the VMM can you open the guests control file and are the entries there or missing, and is the syntax right?

Entry is missing, but syntax is right.

Before the Settings dialog box:
<Adapter slot="1" enabled="true" MACAddress="080027266D29" cable="true" speed="0" type="82540EM">
          <DisabledModes>
            <NAT>
              <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
              <Alias logging="false" proxy-only="false" use-same-ports="false"/>
            </NAT>
          </DisabledModes>
          <BridgedInterface name=""/>
        </Adapter>
After:
<Adapter slot="1" enabled="true" MACAddress="080027266D29" cable="true" speed="0" type="82540EM">
          <DisabledModes>
            <NAT>
              <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
              <Alias logging="false" proxy-only="false" use-same-ports="false"/>
            </NAT>
          </DisabledModes>
          <BridgedInterface name="eth0"/>
        </Adapter>
The name is not getting populated by VBoxManage (even though it is clearly there), but magically filled in by the Settings dialog.

Clues for a work-around?

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 7. Mar 2012, 03:31
by Perryg
I need to look into this more tomorrow. Too many things going on and my eyes are tired.

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 7. Mar 2012, 11:54
by mpack
Some delay required between modifying the settings and starting the VM? I.e. perhaps the changes are not flushed yet.

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 7. Mar 2012, 15:57
by Perryg
I ran your commands as you show with the machine = afoo1. Without opening the VMM this is the result.

Code: Select all

<Network>
        <Adapter slot="0" enabled="true" MACAddress="080027F4E1EA" cable="true" speed="0" type="82540EM">
          <DisabledModes>
            <NAT>
              <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
              <Alias logging="false" proxy-only="false" use-same-ports="false"/>
            </NAT>
            <BridgedInterface name="eth0"/>
            <HostOnlyInterface name="vboxnet0"/>
          </DisabledModes>
          <HostOnlyInterface name="vboxnet0"/>
        </Adapter>
        <Adapter slot="1" enabled="true" MACAddress="080027903DD5" cable="true" speed="0" type="82540EM">
          <DisabledModes>
Now it is possible that your version may have a bug in it as the version I am using is in the future. Only way to know is for someone with your version to test this as well.
I would but I am in the middle of a project and really can't downgrade at the moment.

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 7. Mar 2012, 17:09
by paulehoffman
mpack wrote:Some delay required between modifying the settings and starting the VM? I.e. perhaps the changes are not flushed yet.
Unlikely. I just ran the steps again with a "sleep 2" between each step, and got the same result.

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 7. Mar 2012, 17:12
by paulehoffman
Perryg wrote:I ran your commands as you show with the machine = afoo1. Without opening the VMM this is the result.

Code: Select all

<Network>
        <Adapter slot="0" enabled="true" MACAddress="080027F4E1EA" cable="true" speed="0" type="82540EM">
          <DisabledModes>
            <NAT>
              <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
              <Alias logging="false" proxy-only="false" use-same-ports="false"/>
            </NAT>
            <BridgedInterface name="eth0"/>
            <HostOnlyInterface name="vboxnet0"/>
          </DisabledModes>
          <HostOnlyInterface name="vboxnet0"/>
        </Adapter>
        <Adapter slot="1" enabled="true" MACAddress="080027903DD5" cable="true" speed="0" type="82540EM">
          <DisabledModes>
You cut off those results too early: what came ouf for the settings in adapter slot 1, which is the one that is failing?
Perryg wrote:Now it is possible that your version may have a bug in it as the version I am using is in the future. Only way to know is for someone with your version to test this as well.
I would but I am in the middle of a project and really can't downgrade at the moment.
I'd be happy if someone running the current version on a Ubuntu system would check it out. Alternately, if you tell me how to get a version for Unbuntu 11.10 for your "future version", I can try it out.

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 7. Mar 2012, 18:08
by Perryg
Yes you are right. I was looking at the wrong slot, and assuming nic1=slot1 instead of nic1=slot0, my mistake.

This is defiantly a bug in the code logic as I see it and should be reported. It's interesting that the GUI automatically fixes this though, which does nothing for the ones without X.

What threw me off was it put both in slot0 and then adds nic2 to slot1 when you open the netconfig in the gui and click OK, but does not remove it from slot0.

Do you want to report this or should I?

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 7. Mar 2012, 18:12
by paulehoffman
Perryg wrote:Yes you are right. I was looking at the wrong slot, and assuming nic1=slot1 instead of nic1=slot0, my mistake.

This is defiantly a bug in the code logic as I see it and should be reported. It's interesting that the GUI automatically fixes this though, which does nothing for the ones without X.

What threw me off was it put both in slot0 and then adds nic2 to slot1 when you open the netconfig in the gui and click OK, but does not remove it from slot0.

Do you want to report this or should I?
If you would, that would be great. I've never done an actual bug report for VirtualBox, and the learning curve for doing so is probably a waste of time, given that I will probably never find a bug again...

In the meantime, for the project I'm on, there is a simple solution: after creating the VMM, run a script that changes the one field to fill in eth0. Thanks for getting me to look in the file.

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 7. Mar 2012, 19:24
by Perryg

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 12. Mar 2012, 20:47
by klaus
I really hope that this isn't all just due to a typo in the original post - the 4th line uses
--bridgedadapter1
where it should have
--bridgedadapter2
.

Re: Creating VMs from VBoxManage fails to create bridged ifs

Posted: 12. Mar 2012, 21:28
by Perryg
Yes you are right of course, and I missed it not once but three times.