2

In Windows 10 Pro PC (Win10ProPC#1) I have a Ubuntu 18.04.02 LTS VM, created quite some time ago. I have also been using ever since, the following command, as part of a script. So running the following command in Win10ProPC#1

Get-vm -Name Ubuntu18.04.2LTS | Select -ExpandProperty NetworkAdapters

Returns

VMName           IPAddresses
------           ----------- 
Ubuntu18.04.2LTS {172.17.199.244, ffff::ffff:ffff:ffff:ffff}

I recently recreated the same environment in another PC, with similar specs (Win10ProPC#2). There is a small change, the Ubuntu VM is now Ubuntu18.04.3LTS. However running the following command in Win10ProPC#2

Get-vm -Name Ubuntu18.04.3LTS | Select -ExpandProperty NetworkAdapters

Returns

VMName           IPAddresses
------           ----------- 
Ubuntu18.04.3LTS {}

In both cases the VM(Guest) has internet access and I can find out the ip address from inside the guest operating system. (While this confirms that there is an IP it is not what is desired. I need to get the IP from the above command.)

The problem is that there are no IPAddresses reported in NetworkAdapters in Win10ProPC#2 while there are some in Win10ProPC#1. I need to make Win10ProPC#2 able to get the IPAddresses of the VM.

The two computers use the latest Windows 10 Pro version (64bit). Also both VMs have a dynamic IP and use the "Default Switch" network configuration. The scripts run by Powershell "as Administrator" in both cases.

I fear that I miss a setting or configuration, but a have already scrutinized all settings of the HyperV and are identical. Any thoughts?

Spyros K
  • 223
  • 1
  • 3
  • 11
  • 1
    Is there a difference in the Windows 10 versions between the two computers? Does the VM have a static IP address? – harrymc Nov 26 '19 at 21:29
  • The two computers use the latest Windows 10 Pro version (64bit). Also both VMs have a dynamic IP and use the "Default Switch". I will also edit the question to include this info. – Spyros K Nov 27 '19 at 08:12

1 Answers1

5

To get full use of Hyper-V, install the appropriate linux-tools and linux-cloud-tools packages to install tools and daemons for use with your Ubuntu virtual machines.

sudo apt-get update 
sudo apt-get install linux-image-virtual linux-tools-virtual linux-cloud-tools-virtual
sudo reboot now

The hv-kvp-daemon is responsible for sharing the IP information from the guest to the hypervisor, so be sure that's running

sudo systemctl status hv-kvp-daemon

This article provides information about the checking the status of hv-kvp-daemon. Try to determine if hv-kvp-daemon is running. It is possible that linux-image-virtual linux-tools-virtual linux-cloud-tools-virtual are installed but the service is not active. For instance when trying to start the hv-kvp-daemon I got the following response.

ubuntu@LinuxVM:~$ sudo hv_kvp_daemon
WARNING: hv_kvp_daemon not found for kernel 5.0.0-36

  You may need to install the following packages for this specific kernel:
    linux-tools-5.0.0-36-generic
    linux-cloud-tools-5.0.0-36-generic

  You may also want to install one of the following packages to keep up to date:
    linux-tools-generic
    linux-cloud-tools-generic

Installing the correct versions solved the issue for me.

$ sudo apt-get install linux-tools-5.0.0-36-generic linux-cloud-tools-5.0.0-36-generic linux-tools-generic linux-cloud-tools-generic

After that it was possible to start the hv_kvp_daemon as follows.

sudo hv_kvp_daemon

Afterwards the IP was available from the powershell.

Spyros K
  • 223
  • 1
  • 3
  • 11
jfrmilner
  • 1,917
  • 18
  • 16
  • Thank you for your suggestion. Indeed I have already installed these tools in both VMs but I still observe the same behaviour. – Spyros K Nov 28 '19 at 08:20
  • After checking the addition of @jfrmilner with the information about the `hv_kvp_daemon` I was able to find the solution to my problem. I added the additional steps that I followed for reference. Thank you very much for the information provided! – Spyros K Dec 02 '19 at 09:04