IP Address Using GuestProperty

Discussion about using the VirtualBox API, Tutorials, Samples.
shrikane
Posts: 17
Joined: 12. Mar 2015, 01:40

IP Address Using GuestProperty

Post by shrikane »

I have question related to getting IP address, I referred to this answer already but I was not able to still fix it,
viewtopic.php?f=34&t=65910

Host Machine : Windows 8
Guest : Slitaz 4.0
VirtualBox : 4.3.24
VirtualBox Java API : 4.3
Adapter in VM : Host Only Adapter

I have created a Java program using API and I can basically connect, clone and start a VM in VirtualBox. But what I was not able to do is get the IP address of machine. (Why I need IP is because I want to SSH into that machine, using JSCH java library and execute some processes)

This is what I tried so far,

1. Based on the link, I tried

Code: Select all

machine.getGuestPropertyValue("/VirtualBox/GuestInfo/Net/<nicid>/V4/IP") - returns empty result
machine.getGuestPropertyValue("/VirtualBox/GuestInfo/Net/Count") - returns empty result
machine.getGuestPropertyValue("/VirtualBox/GuestInfo/Net/<nicid>/MAC") - return empty result
machine.getGuestPropertyValue("/VirtualBox/GuestInfo/OS/Release") - this gives me release version of linux - which is ok
2. I tried this one more thing, how many properties are exactly available

Code: Select all

org.virtualbox_4_3.Holder<List<String>> tempList = new Holder<List<String>>();
org.virtualbox_4_3.Holder<List<String>> tempList1 = new Holder<List<String>>();
Holder<List<Long>> tempList2 = new Holder<List<Long>>();
org.virtualbox_4_3.Holder<List<String>> tempList3 = new Holder<List<String>>();
machine.enumerateGuestProperties("",tempList, tempList1,tempList2,tempList3);
Now in templist, I get name of all properties available and in tempList1 it's values.

[/VirtualBox/GuestInfo/OS/Product, /VirtualBox/HostInfo/GUI/LanguageID, /VirtualBox/HostInfo/VBoxVerExt, /VirtualBox/GuestAdd/Vbgl/Video/SavedMode, /VirtualBox/GuestInfo/OS/Version, /VirtualBox/GuestAdd/VersionExt, /VirtualBox/GuestAdd/Revision, /VirtualBox/HostGuest/SysprepExec, /VirtualBox/GuestAdd/Vbgl/Video/0, /VirtualBox/HostGuest/SysprepArgs, /VirtualBox/GuestAdd/Version, /VirtualBox/HostInfo/VBoxRev, /VirtualBox/HostInfo/VBoxVer, /VirtualBox/GuestInfo/OS/Release, /VirtualBox/GuestAdd/HostVerLastChecked]

3. That is the reason, I think this works

Code: Select all

machine.getGuestPropertyValue("/VirtualBox/GuestInfo/OS/Release") - this gives me release version of linux - which is ok
Now in this list, there is no property related to IP address.

Code: Select all

machine.getGuestPropertyValue("/VirtualBox/GuestInfo/Net/<nicid>/V4/IP")
Also I am not sure what exactly here is nicid and how to get this using API, is it mac address of adapter in VM, or something else.

Can somebody please help me out here or guide in appropriate direction.
shrikane
Posts: 17
Joined: 12. Mar 2015, 01:40

Re: IP Address Using GuestProperty

Post by shrikane »

One more point to mention, GuestAdditions for Slitaz are already installed
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: IP Address Using GuestProperty

Post by noteirak »

Double check that:
- The guest additions are installed inside the VM
- Are running
- Are the ones that come with your VirtualBox installation and not from your linux distro repositories <-- most common error
- Match the version of VirtualBox you are uing

If all this is the case:
- Attach a ziped log file of a VM session (VBox.log)
- Give the output of the following commands (replace <vmname>) while the VM is running and is supposed to give you the info :

Code: Select all

vboxmanage showvminfo <vmname> --details
vboxmanage guestproperty enumerate <vmname>
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
shrikane
Posts: 17
Joined: 12. Mar 2015, 01:40

Re: IP Address Using GuestProperty

Post by shrikane »

Thank you for the prompt reply, I will check the details and get back to you immediately.

Really appreciate your help.
shrikane
Posts: 17
Joined: 12. Mar 2015, 01:40

Re: IP Address Using GuestProperty

Post by shrikane »

So, regarding the guest additions you asked me to check,
1. First I installed them using this link,viewtopic.php?f=7&t=43286
now when I fire command in my guest Slitaz -
lsmod | grep vbox
vboxvideo
drm
vboxsf
vboxguest
(I am not sure if there is some other way to check if vbox guest additions in guest are installed and what version is it?, please let me know)
2. This is the guest addition iso, I downloaded : VBoxGuestAdditions_4.3.24.iso , download link : http://download.virtualbox.org/virtualbox/4.3.24/
I used this one because, Virtual Box I have is of version 4.3.24r98716

Attached the zip containing logs and output of two commands.
Attachments
vbox_logs.zip
Logs and Command Outputs
(94.34 KiB) Downloaded 145 times
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: IP Address Using GuestProperty

Post by noteirak »

The log files gave the guest additions version, so it is fine. Everything is matching as it should.
what is the output of the following commands in the guest, all as root :

Code: Select all

ifconfig -a
lsmod | grep vbox
VBoxControl -v
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
shrikane
Posts: 17
Joined: 12. Mar 2015, 01:40

Re: IP Address Using GuestProperty

Post by shrikane »

Here is the output of the commands u asked,
Image

sry for image, somehow irrespective for having guest additions copy pasting is not working

Thanks again
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: IP Address Using GuestProperty

Post by noteirak »

Well, I'm out of ideas - every requirement that I am aware of is fulfilled, your installation doesn't seem damaged, you're doing things right. I will try to ask a dev and post back in a bit (hours or days).
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
shrikane
Posts: 17
Joined: 12. Mar 2015, 01:40

Re: IP Address Using GuestProperty

Post by shrikane »

Thank you, I appreciate that, in the mean time I will try with Ubuntu as Guest, lets see how things goes.
I will keep you posted, tc
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: IP Address Using GuestProperty

Post by noteirak »

Few more checks for you :
- Is the time in the host and in the guest in sync?
- What is the output of this in the guest

Code: Select all

sudo /etc/init.d/vboxadd-service status
sudo ps aux | grep -i vbox | grep -v grep
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
shrikane
Posts: 17
Joined: 12. Mar 2015, 01:40

Re: IP Address Using GuestProperty

Post by shrikane »

No time is not in sync, guest is one hour behind than host. I will sync it and try again and get back to you.

And here is the output of commands you asked for
Image
shrikane
Posts: 17
Joined: 12. Mar 2015, 01:40

Re: IP Address Using GuestProperty

Post by shrikane »

Nope Syncing time doesn't help as well, I am not sure if you wanted me to do that :) , but neways I still did that just to see if anything happens but nope still no luck.
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: IP Address Using GuestProperty

Post by noteirak »

Yes I did wanted you to sync :)
About the previous command, could you run it as root too? I am not sure you're getting all the processes, even those running as root
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
shrikane
Posts: 17
Joined: 12. Mar 2015, 01:40

Re: IP Address Using GuestProperty

Post by shrikane »

I did run them as root now, but at least I see no difference,
Image
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: IP Address Using GuestProperty

Post by noteirak »

The process responsible for setting the guest properties about NIC is called VBoxService, which you don't seem to have running. What is the output of this :

Code: Select all

which VBoxService
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply