Bug 212489 - emulators/hyperv-is doesn't work on FreeBSD 10.3
Summary: emulators/hyperv-is doesn't work on FreeBSD 10.3
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Rene Ladan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-08 16:18 UTC by Michael Faklis
Modified: 2017-03-03 18:53 UTC (History)
8 users (show)

See Also:
bugzilla: maintainer-feedback? (bsdic)


Attachments
FreeBSD 10.3 VM on HyperV (Windows Server 2012 R2) (791.12 KB, image/png)
2016-09-09 07:18 UTC, Dexuan Cui
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Faklis 2016-09-08 16:18:33 UTC
I have tested FreeBSD 10.3 as a Hyper-V client on both Server 2012 R2 and Windows 10 Pro.  There are many annoying problems.  

The mouse integration between the client (FreeBSD) and the Hyper-V host does not work, requiring a CNTL-ALT-Leftarrow salute to get back to the host session.

DHCP is not getting an IP address.  Even when explicitly assigning IP attributes with ifconfig, they are not in effect until entering network manager and restarting the network service.

Does not resync the monitor when entering the X session, or when returning to the 
X session when switching back from another virtual terminal session.  The virtual machine reboots (usually) three times before the X session resyncs to the virtual monitor.  This means all work in progress is terminated.
Comment 1 Hongjiang 2016-09-09 01:55:26 UTC
Could you please show more information about issues you encountered?

1. What is your OS version? Could you please run "systeminfo | findstr OS" on command console to get it?
2. For mouse does not work, do you run FreeBSD VM in your local windows host or remote host? In other words, if you login remote host through RDP, you will find mouse does not work. It is a known issue.
3. For DHCP failed to get IP address, did you use wireless network?
4. Could you please attach the dmesg dump for reboot caused by "resync"?

Thanks for your reporting issues.
Comment 2 Dexuan Cui 2016-09-09 04:08:05 UTC
And some more questions to Michael,

About the DHCP-not-working issue: 
DHCP should work in 10.3 VM. All that we need to do is adding the line in /etc/rc.conf:

ifconfig_hn0="DHCP"

How did you configure DHCP in the VM? It looks you're running gnome and use the Network Manager in gome to configure the network? I didn't try gnome and will try it today.

BTW, when DHCP doesn't work in your side, can you please try running "dhclient hn0" manually and see if it works or not?
Comment 3 Dexuan Cui 2016-09-09 06:24:31 UTC
(In reply to Michael Faklis from comment #0)
> The mouse integration between the client (FreeBSD) and the Hyper-V host does not work,

Can you please describe how the mouse doesn't work?
Are you using text mode console or X when it doesn't work?
Is your "Virtual Machine Connection" program running on local machine, or a remote server (e.g., by RDP)?

In my test, the (legacy PS/2) mouse can work in the VM's texe mode and X.

> requiring a CNTL-ALT-Leftarrow salute to get back to the host session.
Yes. This is a known issue.
To resolve it, we need to add a Hyper-V mouse driver, which is in our TODO list.
Comment 4 Dexuan Cui 2016-09-09 07:17:54 UTC
(In reply to Michael Faklis from comment #0)
> Does not resync the monitor when entering the X session, or when returning to 
> the X session when switching back from another virtual terminal session.  The
> virtual machine reboots (usually) three times before the X session resyncs to
> the virtual monitor.  This means all work in progress is terminated.

I don't have the "no resync" or "reboot" issues.
I can switch between X (gnome) and ttyv0~ttyv7 without any issue. The only issue is: the swtich is a little slow -- it takes about 3 seconds: this is a known issue (we need to add a Hyper-V framebuffer driver which is also in our TODO list).

BTW, by saying "the virtual machine reboots", do you mean the VM crashes?
Comment 5 Dexuan Cui 2016-09-09 07:18:58 UTC
Created attachment 174571 [details]
FreeBSD 10.3 VM on HyperV (Windows Server 2012 R2)
Comment 6 Dexuan Cui 2016-09-09 07:29:15 UTC
(In reply to Dexuan Cui from comment #5)
To prove what I said, I uploaded this screenshot:
I installed gnome-3 in my 10.3 VM, and installed Chromium browser. Everything works fine.

Note: there is a mouse cursor on the left side, so you can see the mouse does work for me.

BTW, if you run the "Virtual Machine Connection" program in a remote RDP session, the mouse doesn't work for now, due to the lackness of Hyper-V mouse driver.
Comment 7 Michael Faklis 2016-09-11 18:59:35 UTC
(In reply to Hongjiang from comment #1)

C:\Users\MFaklis.EvolSwSys>systeminfo | findstr os
Host Name:                 WIN10P64HV
OS Name:                   Microsoft Windows 10 Pro
OS Manufacturer:           Microsoft Corporation
                                 Connection Name: Ethernet for Host

Mouse:  From the Hyper-V Manager on the Hyper-V host, doing a "connect", so local.  The mouse works if you click into the client windows, but I must do a CNTL-ALT-leftarrow to release the mouse back to the host session.

DHCP:  No wireless NIC on the Hyper-V client or host.

Question about dmesg:  dmesg is the log from the boot which works.  The logs from the boots where X resync causes a reboot are not in dmesg.  If you tell me how to capture those logs so they are preserved after the reboot, I will do that.  If you really want the dmesg from the reboot which works, let me know and I will do that.
Comment 8 Michael Faklis 2016-09-11 19:09:12 UTC
(In reply to Dexuan Cui from comment #2)

I do have the ifconfig in the rc.conf.

The host and Hyper-v both have separate real NICs.  In Hyoer-v manager I have an external virtual switch.  The DHCP server is on the Windows Server 2012 R2 domain controller virtual machine.  When FreeBSD as a Hyper-V client starts it does not seem to get an IP address until I go to Network Manager and restart the network service.  Even when I explititly give the FreeBSD virtual client an explicit ipv4 ip address, gateway, DNS...  I still have to go into network Manager and restart the network service bewfore the IP address is functional.

DHCP otherwise works on my domain and on my Windows and Linux virtual clients.
Comment 9 Michael Faklis 2016-09-11 19:58:09 UTC
(In reply to Dexuan Cui from comment #2)

Unable to cut & past, so

DHCPDISCOVER pn de0 to 255.255.255.266 port 67
.
.
.
.
No DHCPPFFERS received
Tryind recorded lease 192.168.2.112
bound: immediate renewal
DHCPREQUEST on de0 to 192.168.2.142 port 67

Pings to domain contoller; 
ping: sentto: No route to host
.
.
.
.
.
Comment 10 Michael Faklis 2016-09-11 20:02:12 UTC
(In reply to Dexuan Cui from comment #3)
Requires a click within the client windows fror the client to see the mouse.
Requires CNTL-ALT-leftarrow to release the mouse back to the host session,

I'm using X with KDE4
Comment 11 Michael Faklis 2016-09-11 20:04:57 UTC
(In reply to Dexuan Cui from comment #4)
It appears that X crashes and then remaining withing the hyper-V client session, FreeBSD boots from the GRUB menu.
Comment 12 Sepherosa Ziehau 2016-09-12 01:53:25 UTC
My suggestion for the X stuffs is to use VNC, e.g. tigervnc, which works quite well for me (I used Hyper-V + tigerVNC to do all of the Hyper-V FreeBSD development work).
Comment 13 Sepherosa Ziehau 2016-09-12 01:55:52 UTC
(In reply to Michael Faklis from comment #9)

What's the kernel configure do you use?  It looks like you commented out the 'options HYPERV' and 'device hyperv'.
Comment 14 Dexuan Cui 2016-09-12 05:39:06 UTC
(In reply to Michael Faklis from comment #9)
Hi Michael,
So please let me summarize the issues:

1) The mouse doesn't work.
Actually it works, though there is small but annoying thing:  we must press Control-Alt-LeftArraw to return the mouse back to the host and we have to click into the VM window to give the mouse to the VM. This is a known issue, which can be resolved by adding Hyper-V synthetic mouse driver. It's in our TODO.

2) DHCP can't work.
You're using "de0" (the Legacy Network Adapter) somehow.
When we create a Hyper-V VM, by default a Hyper-V Synthetic NIC (the "Network Adapter" in the VM's "Settings")  is created for the VM. I guess you removed the synthetic NIC and added a Legacy NIC somehow?

By default when we install FreeBSD 10.3 VM from the official .iso file, the built-in BIS drivers support the Synthetic NIC well (the NIC name is "hn0") and DHCP should work fine. 

If you do want use the legacy NIC ("de0"),please be noted there are known issues:
a) the NIC can't work properly in SMP VM. It looks something is wrong here in Hyper-V's IOAPIC emulation.
b) Even for UP VM, it looks adding 
ifconfig_de0="DHCP"
in /etc/rc.conf doesn't work reliably. If I replace the "DHCP" with "SYNCDHCP", it looks the NIC can work, but I don't why.

Considering the poor performance and instability of "de0", we do recommend the default synthetic NIC ("hn0") should be used.

3) VNC can't work?
In my 10.3 VM,  after I did "pkg install tightvnc" and ran "vncserver" to set up a VNC password, my VNC-Viewer could connect to the VM without any issue. 

4) Xorg triggered VM panic/reboot?
Gnome3 works fine for me.
I'll try KDE4.
Comment 15 Dexuan Cui 2016-09-12 06:12:20 UTC
After I followed https://www.freebsd.org/doc/handbook/x11-wm.html to install KDE4 in my 10.3 VM, it also worked fine for me.
Comment 16 Michael Faklis 2016-09-13 18:52:33 UTC
(In reply to Dexuan Cui from comment #14)

2) DHCP can't work.

When I was studying documents for using the BIS for Linux and FreeBSD, I thought I read that I should use the legacy network NIC.  That was obviusly wrong for FreeBSD or I was mistaken.  I revised rc.conf references from de0 to hn0, shutdown, revised the Hyper-V client settings to use the synthetic NIC, and started it back up.  Upon the first boot, the hn0 NIC was disabled, so I re-enabled it. It now comes up with DHCP giving hn0 an IP address.  By the way, I had revised rc.conf from DHCP to SYNCDHCP when I first encountered de0 not having an IP address.  Thank you.

4) Xorg triggered VM panic/reboot?

I have found if I do not "connect" to the FreeBSD hyper-v client when I start it from the hyper-v manager, it starts up the X login screen without problems.  I can then connect to the hyper-v client and log into KDE (in my case).  However, it I switch to another virtual terminal (text mode), X comes up showing garbage and forcing the panic/reboot three times to get to a clean X logon screen.

I wonder if I screwed up with xorg.conf?  I reading that the xorg.conf.d directory is the current preferred definition over xorg.conf.  Not seeing how this was done, I looked at a linux virtual machine and saw how it constructed the xorg.conf.d, so I took my xorg.conf, broke it up by section and placed each in a text file in xorg.conf.d.  Can you show me how xorg.conf should be defined for running FreeBSD 10.3 as a hyper-V client?
Comment 17 Michael Faklis 2016-09-13 19:40:09 UTC
(In reply to Sepherosa Ziehau from comment #13)

I'm running the default unaltered kernel.  In dmesg I see messages for Hyper-V Heartbeat, KVP, Shutdown, and time Sync services.  
Where to you see commenting out options HYPERV and device HYPERV?  How might I add these dynamically at startup without rebuilding the kernel?

I think I have the flu, so I'm going to rest for a short while.  I truely appreciate all of the wonderful questions and solutions that have been offered to me.
Comment 18 Dexuan Cui 2016-09-14 00:14:09 UTC
(In reply to Michael Faklis from comment #16)
(In reply to Michael Faklis from comment #17)

When KDE4 worked in my 10.3 VM, I didn't manually make any configuraiton change to Xorg -- I just ran "pkg install kde4", added the /proc line into /etc/fstab, and added the dbus/hald/kdm4_enable="YES" lines into /etc/rc.conf, just as the handbook page described.

So, to debug the issue, I think we have to check the logs in your side.
Can you please get the logs? e.g,  /var/log/Xorg*.log, /var/log/message, dmesg > dmesg.log.

> "X comes up showing garbage and forcing the panic/reboot three times to get to a clean X logon screen."
It looks the reboot/panic happened to Xorg rather than the VM? 


BTW, it looks very strange to me that Xorg worked in your side if you didn't "Connect" to the VM. I can't explain this.

> Where to you see commenting out options HYPERV and device HYPERV?
We guessed you might be using a customized kernel with the options disabled.
Since you clarified you were using the default 10.3 installation, which did enable the options, please ignore the questions related to the options.

And do you mean you want to disable heartbeat, kvp, shutdown and time sync without rebuilding the kernel? If yes, there are some tunables, but I'm not sure why you need to do this. :-)

Sorry to hear you got a flu. Have some rest and we can come back with the issues later.
Comment 19 Michael Faklis 2016-09-19 15:29:20 UTC
(In reply to Dexuan Cui from comment #18)
Faced with the fact that you are having no problems with Xorg and DHCP, I decided to make a fresh install of FreeBSD 10.3 "by the book" following the instructions in the handbook.  On the fresh install, I have no problems with Xorg or DHCP.

I've been building FreeBSD since sometime before v6.  I winged it on the problematic install, so I must have made mistake.

As a result of this new install, the only problem still existing from my original problem report is the annoyance of not having a synthetic mouse, which you already planned to address.

Thank you to everyone who provided assistance on my problem report.
Comment 20 Dexuan Cui 2016-12-08 01:28:00 UTC
(In reply to Michael Faklis from comment #19)

Hi Michael,
Since you don't have the Xorg/DHCP issues with fresh installation, now, can we close the bug?
I suppose VNC should work for you too.

We're tracking the synthetic mouse issue internally, or we can also open a new bug here to track it.
Comment 21 Rene Ladan freebsd_committer freebsd_triage 2017-03-01 18:02:11 UTC
Currently the port has expired because it states to only claim FreeBSD versions 8.4, 9.1, 9.2, 9.3 and 10.0, all of which are end-of-life.

Does this software run on FreeBSD 10.3, 11.0 or HEAD or does it need to be updated first?
Comment 22 Michael Faklis 2017-03-01 18:23:03 UTC
The source has tests for the version of FreeBSD, but does not test for 10.3.  I don't believe that means it's obsolete.  I believe the source code needs to be updated.
Comment 23 Michael Faklis 2017-03-01 18:24:22 UTC
The version test may have been in the make.
Comment 24 Sepherosa Ziehau 2017-03-02 01:22:43 UTC
(In reply to Rene Ladan from comment #21)

We have _no_ plan to keep the emulator/hyperv-is ports supported anymore.

I believe you should nuke it from 10.3/11.0/stable-10/stable-11/current ports tree to avoid further confusion.

Thanks,
sephe
Comment 25 Michael Faklis 2017-03-02 17:34:23 UTC
Microsoft has promised full hyper-V support for FreeBSD.  How does FreeBSD support Hyper-V without this module?  It appears to me that this module is the FreeBSD/Hyper-V compatibility.
Comment 26 Sepherosa Ziehau 2017-03-03 01:30:47 UTC
(In reply to Michael Faklis from comment #25)

It has been in the src/ for tree yeasr on 10-stable, 11-stable and current. And it is in amd64 GENERIC kernel.  It does _not_ make any sense to keep the ports modules supported any more.  We do _not_ want to have more confusion about which modules should be used.

Please nuke the emulation/hyperv-is ports on branches I mentioned.
Comment 27 Dexuan Cui 2017-03-03 03:33:55 UTC
(In reply to Sepherosa Ziehau from comment #26)

To make it more clearer: we don't need the emulation/hyperv-is port for all officially-supported FreeBSD versions (10.3, 11) and the HEAD, because we have integrated the code of the port into the source code of FreeBSD. If you install a 10.3 or 11 VM, the Hyper-V drivers/daemons in the VM should work just out of box.

The port was made to support old FreeBSD 8.x, 9.x and 10.0, which are obsolete now, so the port is obsolete too.
Comment 28 Rene Ladan freebsd_committer freebsd_triage 2017-03-03 18:53:27 UTC
OK, port has been removed.