Page 1 of 3

Cannot get an ip address from the guest VM

Posted: 30. May 2013, 21:01
by Naga
This is the problem I am running into.
I have a MAC book pro laptop on which I am running Virtualbox. Using only cli, I did these

1. import a ova file into the virtualbox. This ova file is to start a custom build Ubuntu.
VBoxManage import xyz.ova --vsys 0 --memory 4096
2. Add a NIC as bridged to the newly imported VM
VBoxManage modifyvm "XYZ" --nic1 bridged --nictype1 82540EM --bridgeadapter1 en2
Note: Before running all this with CLI, I tried this once in the UI and checked how my NIC is mapped, in the UI, it shows like this
Settings->Network->
On Adapter 1
Enable Network Adapter - checked
Attached to: Bridge adapter
Name: en2: Thunderbolt Ethernet
Advanced
Adapter Type: Intel pro/1000 MT Desktop (82540EM)
MAC address: <MAC address>
Cable connected - checked
3. VBoxManage startvm XYZ --type headless
In the Virtualbox preview, I see that the system (VM) seems to come up fine.

Problem: Now, after about 5 mins, when I do
VBoxManage guestproperty enumerate XYZ,
it does not show me any NIC, V4, IP or any such entry, does it mean it did not get any IP address?.
If not, why?.

Some things that I observed.

If I do the same in the UI, everything comes up fine (my en2: is DHCP).
when I do manually(as listed in steps on top), and for the last step, I try to start the VM in the UI(or through a python code), the UI appears and displays

"Could not start the machine XYZ because the following physical network interfaces were not found:

en2 (adapter 1)

You can either change the machine's network settings or stop the machine."

Out of curiosity, I did click on "change machine's network settings" and when I did go through all the setting, the "ok" button is highlighted. I did not need to change anything except,
click on the "ok" button and everything goes through fine. When I poweroff this VM and then start the VM through CLI this time, it comes up fine.

I suspected that there maybe a wrong entry in the /etc/udev/rules/70-persistent-net file so

my question is
is that true and if yes, how can I delete this file before starting the VM (through CLI ONLY).

if not, why does (though all the NIC configs are correct), it says, physical network interfaces not found.

Re: Cannot get an ip address from the guest VM

Posted: 30. May 2013, 21:10
by noteirak
I don't understand your issue. You tell us that the VM runs all fine, and that the configuration is good.
It only doesn't work if you do something in the GUI but also via CLI at the same time which would only mean you did not save the settings properly before.
I do not think the file has anything to do with it, and you definitly don't want to delete it.

Or am I missing something?

Re: Cannot get an ip address from the guest VM

Posted: 30. May 2013, 21:22
by Perryg
The problem could be due to the guests network configuration. Using someone else's OS usually has to have the network fixed due to a Linux feature where it sees a different MAC address it sets up a new eth*

You would need to be able to actually access the guest direct to fix this since the network is down.

Is there any way to actually run the guest local?

Re: Cannot get an ip address from the guest VM

Posted: 31. May 2013, 21:09
by Naga
To respond to "noteirak" question.
I repeat, yes, the problem is strange and is difficult to explain.

Scenario 1. I have a Virtualbox UI where I can import a .ova file and upon entering correct network settings, start the VM, comes up fine.

Now, starting once again with clean slate

Scenario2. I do not want to use the UI(for the purpose of inclusion of starting the VM through automation), using VBoxManage, I import the same .ova file (With VBoxManage) and
then attach the NIC and then when I start the VM(through CLI), the VM starts but when I check for the ip address it does not display anything. Please find the output for it below.

Naga-MacBook-Pro:$ VBoxManage guestproperty enumerate XYZName: /VirtualBox/HostInfo/GUI/LanguageID, value: en_US, timestamp: 1370025031611303000, flags:
Name: /VirtualBox/HostInfo/VBoxVerExt, value: 4.2.12, timestamp: 1370025031301760000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostGuest/SysprepExec, value: , timestamp: 1370025031301197000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostGuest/SysprepArgs, value: , timestamp: 1370025031301255000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxRev, value: 84980, timestamp: 1370025031301778000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxVer, value: 4.2.12, timestamp: 1370025031301739000, flags: TRANSIENT, RDONLYGUEST

I expected it to show me V4/IP fields as well.

Naga-MacBook-Pro:$ VBoxManage guestproperty get XYZ "/VirtualBox/GuestInfo/Net/0/V4/IP"
No value set!

Re: Cannot get an ip address from the guest VM

Posted: 31. May 2013, 21:17
by Naga
Hi Perryg

Thanks for your response. What do you mean by running the guest local. This is the setup I have. I have the VirtualBox installed on MACBook and I am installing(importing .ova) for
Ubuntu in that. I assume then it is local, am I right?. or did you mean something else?.

You are right, everytime I import the .ova file, it get's a different mac address so that was the reason to delete the 70-persistent-net file. Well, what I do not uderstand is, when
this all works well when I use UI, I wonder why it does not work with CLI.

Another point I want to bring to your notice is

I used a small python script to bring up a UI. Now what I did was, configure everything (from scratch) using CLI and for start (ONLY) I use this python script.

1. Before running the start script, I noted down the configuration on /Virtualbox/XYZ/XYZ.vbox file. One of the lines where the NIC is configured where it says name: it was showing
en2(which is my Thunderbolt ethernet)

2. Now, before starting the script, I ran the UI, started the VM and then noted down the configuration of the same file XYZ.vbox, there I saw the entry as "en2: Thunderbolt ethernet"

3. Now, on the CLI, I edited the bridgeadpter1(which I had entered before as bridgeadapter1 en2) to bridgeadapter1 "en2 Thunderbolt ethernet"(Just as how the UI had configured it) and
then started through the CLI, still no luck.

At this point, I feel that, when I do with CLI, it is not saving some information for networking.


The problem could be due to the guests network configuration. Using someone else's OS usually has to have the network fixed due to a Linux feature where it sees a different MAC address it sets up a new eth*

You would need to be able to actually access the guest direct to fix this since the network is down.

Is there any way to actually run the guest local?

Re: Cannot get an ip address from the guest VM

Posted: 31. May 2013, 21:30
by Naga
These are the steps I ran.

1. VBoxManage import XYZ.ova --vsys 0 --memory 4096
2. VBoxManage modifyvm XYZ --bridgeadapter1 "en2: Thunderbolt Ethernet"
3. VBoxManage modifyvm XYZ --nic1 bridged

VBoxManage startvm XYZ --type headless
Waiting for VM "XYZ" to power on...
VM "XYZ" has been successfully started.

======

Naga$ VBoxManage guestproperty enumerate XYZ
Name: /VirtualBox/HostInfo/GUI/LanguageID, value: en_US, timestamp: 1370028298549722000, flags:
Name: /VirtualBox/HostInfo/VBoxVerExt, value: 4.2.12, timestamp: 1370028298395366000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostGuest/SysprepExec, value: , timestamp: 1370028298395123000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostGuest/SysprepArgs, value: , timestamp: 1370028298395151000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxRev, value: 84980, timestamp: 1370028298395386000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxVer, value: 4.2.12, timestamp: 1370028298395334000, flags: TRANSIENT, RDONLYGUEST

==========

Code: Select all

Naga$ VBoxManage showvminfo XYZ
Name:            XYZ
Groups:          /
Guest OS:        Ubuntu (64 bit)
UUID:            04c3a16b-7890-4015-8a2d-606ad6b012cb
Config file:     <Path to my folder>/VirtualBox VMs/XYZ/XYZ.vbox
Snapshot folder: <Path to my folder>/VirtualBox VMs/XYZ/Snapshots
Log folder:      <Path to my folder>/VirtualBox VMs/XYZ/Logs
Hardware UUID:   04c3a16b-7890-4015-8a2d-606ad6b012cb
Memory size:     4096MB
Page Fusion:     off
VRAM size:       12MB
CPU exec cap:    100%
HPET:            off
Chipset:         piix3
Firmware:        BIOS
Number of CPUs:  1
Synthetic Cpu:   off
CPUID overrides: None
Boot menu mode:  message and menu
Boot Device (1): Floppy
Boot Device (2): DVD
Boot Device (3): HardDisk
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          on
PAE:             on
Time offset:     0ms
RTC:             local time
Hardw. virt.ext: on
Hardw. virt.ext exclusive: off
Nested Paging:   on
Large Pages:     on
VT-x VPID:       on
State:           running (since 2013-05-31T19:24:58.495000000)
Monitor count:   1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address:
Teleporter Password:
Tracing Enabled: off
Allow Tracing to Access VM: off
Tracing Configuration:
Autostart Enabled: off
Autostart Delay: 0
Storage Controller Name (0):            IDE Controller
Storage Controller Type (0):            PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  2
Storage Controller Port Count (0):      2
Storage Controller Bootable (0):        on
Storage Controller Name (1):            SCSI Controller
Storage Controller Type (1):            LsiLogic
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1):  16
Storage Controller Port Count (1):      16
Storage Controller Bootable (1):        on
SCSI Controller (0, 0): <Path to my folder>/VirtualBox VMs/XYZ/XYZ-disk1.vmdk (UUID: 418b1b7f-2a19-4711-8efc-62184f563f1b)
NIC 1:           MAC: 08002716A5AC, Attachment: Bridged Interface 'en2: Thunderbolt Ethernet', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
Pointing Device: PS/2 Mouse
Keyboard Device: PS/2 Keyboard
UART 1:          disabled
UART 2:          disabled
LPT 1:           disabled
LPT 2:           disabled
Audio:           disabled
Clipboard Mode:  disabled
Drag'n'drop Mode:  disabled
Video mode:      640x480x32
VRDE:            disabled
USB:             disabled
EHCI:            disabled

USB Device Filters:

<none>

Available remote USB devices:

<none>

Currently Attached USB Devices:

<none>

Bandwidth groups:  <none>

Shared folders:  <none>

VRDE Connection:    not active
Clients so far:     0

Guest:

Configured memory balloon size:      0 MB
OS type:                             Ubuntu_64
Additions run level:                 0

Guest Facilities:

No active facilities.

Re: Cannot get an ip address from the guest VM

Posted: 31. May 2013, 22:27
by Perryg
What I am talking about is working on the guest locally and not via vrdp or ssh because the network is down.

You mention the " delete70-persistent-net file", so I assume you must be able to work in the guest.

Server OSes don't have a network manager and you need to set them up manually. They do configure themselves during install but this is a transplant and you need to configure the network yourself. How is the guest setup now? Can it see your network adapter? Do you know how to do this kind of setup in Linux?

Re: Cannot get an ip address from the guest VM

Posted: 31. May 2013, 22:54
by Naga
Hi Perryg,
Thanks for responding back so soon. A little bit of history on how it works here for me.

the .ova file I get is actually a custom build file from an other team where, we take a stock ubuntu and then build a whole lot of our product into it. So I get a new .ova everytime we
have bug fixes(in our product) or new features.. anyway... so.. the base line OS will be a same snapshot of Ubuntu. What I have requested our build team was to remove the /udev/70-persistent-net file and then take a snapshot for the base OS. That is what I meant by "I have deleted the file". As such, without the ip address assigned now, I do not have access to this VM at all when I try to install from commandline.

As for as it can detect the network adapter, yes, I mean, as a check, alternatively, I installed the same using UI and when I logged in, I do see the NIC and it is tied to the host(my laptop)
thunderbolt ethernet and have got ip address. As I mentioned earlier, that was the main reason I ran my little python script to catch, at what point I am running into the problem. Because, when I run in the CLI as headless mode, I cannot catch any UI errors, so I configured from scratch using CLI and started the VM using the python(which basically starts the UI)
where it brings up a VM window installation but halfway through, it shows some error, probably I will find it and paste it here sometime. This lead me to think that, after the NIC
is configured, the "ok" button is not pressed, from the command line perspective, it translates to not saving the edits into the file.

Re: Cannot get an ip address from the guest VM

Posted: 31. May 2013, 23:01
by Naga
By the way, one more reason to support what I suspect "maybe" right about the setting not saved into the file. Say, when I run the python script to bring up the UI, it stops halfway through
with error(asking me to edit the adapter setting), I do actually edit it (in the sense, open the network tab and then click "ok" button), then the installation continues and succesfull.
Now, the interesting part is, anytime after this initial(first time) intervention of clicking the "ok" button(or rather saving all my settings), I can stop the VM and start it many many times
USING CLI and everytime it comes up fine and there are no errors(after the first time when it got edited and saved). Everytime, I turn it off from CLI and turn it back on from CLI, I do
get different IP addresses (from dhcp) so I am sure, it works everytime.

Re: Cannot get an ip address from the guest VM

Posted: 31. May 2013, 23:12
by Perryg
I don't know what your python script is trying to do but the VBoxManage commands write to the guests control file from a terminal and once the enter key is pressed the text is loaded. You can verify all commands as soon as you hit the enter key with VBoxManage showvminfo <guest>. It sounds to me like you script may be getting in the way of proper configuration, and that we would not be able to do anything about. It would be the same as editing the *.vbox file manually and not only not suggested but not supported.

The best way to automate this is to create a bash script to run from terminal.

Re: Cannot get an ip address from the guest VM

Posted: 31. May 2013, 23:29
by Naga
Hi Perry,
Thanks once again for responding, python script aside, do you think is there any reason why the VBoxManage showinfo or VBoxManage enumerate commands not showing the ip
address?. I will paste the NIC, ip address info here to you. Can you please help me with the set of commands, you think, should and would make my VM come up fine with an ip address
and does display the ipaddress when I check.

On my laptop running Virtualbox application.

Code: Select all

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
	options=3<RXCSUM,TXCSUM>
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
	inet 127.0.0.1 netmask 0xff000000
	inet6 ::1 prefixlen 128
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500              <<<<Laptop Wireless
	ether 28:cf:e9:12:a8:49
	inet6 fe80::2acf:e9ff:fe12:a849%en0 prefixlen 64 scopeid 0x4
	inet 172.16.4.27 netmask 0xffff0000 broadcast 172.16.255.255
	media: autoselect
	status: active
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
	ether 0a:cf:e9:12:a8:49
	media: autoselect
	status: inactive
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500   <<< Thunderbolt ethernet
	options=b<RXCSUM,TXCSUM,VLAN_HWTAGGING>
	ether 40:6c:8f:43:59:0d
	inet6 fe80::426c:8fff:fe43:590d%en2 prefixlen 64 scopeid 0x6
	inet 172.16.5.131 netmask 0xffff0000 broadcast 172.16.255.255
	media: autoselect (1000baseT <full-duplex,flow-control,energy-efficient-ethernet>)
	status: active
vboxnet0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500                          <<< Virtual box dhcp server
	ether 0a:00:27:00:00:00

Re: Cannot get an ip address from the guest VM

Posted: 31. May 2013, 23:44
by Perryg
VBoxManage guestproperty enumerate <guest>
tells me the IP address and more. Does this not work for you?

Code: Select all

perry@perry-desktop:~$ VBoxManage guestproperty enumerate Mint-15-64
Name: /VirtualBox/GuestInfo/OS/Product, value: Linux, timestamp: 1370009149222639000, flags: 
Name: /VirtualBox/GuestInfo/Net/0/V4/IP, value: 192.168.1.104, timestamp: 1370009149227994000, flags: 
Name: /VirtualBox/HostInfo/GUI/LanguageID, value: en_US, timestamp: 1370009146380884000, flags: 
Name: /VirtualBox/GuestInfo/Net/0/MAC, value: 0800270C0D2E, timestamp: 1370009149229092000, flags: 
Name: /VirtualBox/GuestInfo/OS/ServicePack, value: , timestamp: 1370009149224510000, flags: 
Name: /VirtualBox/HostInfo/VBoxVerExt, value: 4.2.51_OSE, timestamp: 1370009126635988000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestInfo/Net/1/Status, value: Up, timestamp: 1369953184685184000, flags: 
Name: /VirtualBox/GuestAdd/Vbgl/Video/SavedMode, value: 1280x1024x32, timestamp: 1369964084012969000, flags: 
Name: /VirtualBox/GuestInfo/Net/1/V4/Broadcast, value: 192.168.56.255, timestamp: 1369953184683930000, flags: 
Name: /VirtualBox/GuestInfo/Net/0/V4/Netmask, value: 255.255.255.0, timestamp: 1370009149228716000, flags: 
Name: /VirtualBox/GuestInfo/Net/1/V4/Netmask, value: 255.255.255.0, timestamp: 1369953184684351000, flags: 
Name: /VirtualBox/GuestInfo/Net/1/MAC, value: 0A0027000000, timestamp: 1369953184684787000, flags: 
Name: /VirtualBox/GuestInfo/OS/Version, value: #33-Ubuntu SMP Thu May 16 15:17:14 UTC 2013, timestamp: 1370009149224109000, flags: 
Name: /VirtualBox/GuestAdd/VersionExt, value: 4.2.51_OSE, timestamp: 1370009149225618000, flags: 
Name: /VirtualBox/GuestAdd/Revision, value: 46096, timestamp: 1370009149226034000, flags: 
Name: /VirtualBox/HostGuest/SysprepExec, value: , timestamp: 1370009126635621000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestInfo/OS/LoggedInUsers, value: 1, timestamp: 1370009149226849000, flags: TRANSIENT, TRANSRESET
Name: /VirtualBox/GuestInfo/Net/0/Status, value: Up, timestamp: 1370009149229449000, flags: 
Name: /VirtualBox/HostGuest/SysprepArgs, value: , timestamp: 1370009126635647000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestAdd/Version, value: 4.2.51, timestamp: 1370009149225198000, flags: 
Name: /VirtualBox/HostInfo/VBoxRev, value: 46335, timestamp: 1370009126636002000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestInfo/Net/0/V4/Broadcast, value: 192.168.1.255, timestamp: 1370009149228349000, flags: 
Name: /VirtualBox/HostInfo/VBoxVer, value: 4.2.51, timestamp: 1370009126635974000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/GuestInfo/OS/LoggedInUsersList, value: mint, timestamp: 1370009149226477000, flags: TRANSIENT, TRANSRESET
Name: /VirtualBox/GuestInfo/Net/1/V4/IP, value: 192.168.56.1, timestamp: 1369953184683504000, flags: 
Name: /VirtualBox/GuestInfo/Net/Count, value: 1, timestamp: 1370036532250998000, flags: 
Name: /VirtualBox/GuestInfo/OS/Release, value: 3.8.0-22-generic, timestamp: 1370009149223609000, flags: 
Name: /VirtualBox/GuestInfo/OS/NoLoggedInUsers, value: false, timestamp: 1370009149227209000, flags: TRANSIENT, TRANSRESET
Name: /VirtualBox/GuestAdd/HostVerLastChecked, value: 4.2.51, timestamp: 1369964122673525000, flags: 
perry@perry-desktop:~$ 



Re: Cannot get an ip address from the guest VM

Posted: 1. Jun 2013, 01:04
by Naga
That's all I got.

Naga$ VBoxManage guestproperty enumerate XYZ
Name: /VirtualBox/HostInfo/GUI/LanguageID, value: en_US, timestamp: 1370036854141750000, flags:
Name: /VirtualBox/HostInfo/VBoxVerExt, value: 4.2.12, timestamp: 1370036854004696000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostGuest/SysprepExec, value: , timestamp: 1370036854004326000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostGuest/SysprepArgs, value: , timestamp: 1370036854004372000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxRev, value: 84980, timestamp: 1370036854004739000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxVer, value: 4.2.12, timestamp: 1370036854004651000, flags: TRANSIENT, RDONLYGUEST

Re: Cannot get an ip address from the guest VM

Posted: 1. Jun 2013, 01:08
by Perryg
Is the guest running when you run the command?

While I am using a version of VirtualBox from the future I am fairly certain that the feature was enabled in current versions.

Re: Cannot get an ip address from the guest VM

Posted: 1. Jun 2013, 01:13
by Naga
Hi Perry,
Yes, the guest is running, infact, if the guest is not running, when I issue the command, this is the output I get

Naga$ VBoxManage guestproperty enumerate XYZ
No properties found.