Sunday, November 13, 2005

Problems with FreeBSD 6.0 as VMware Workstation Guest

I've encountered a problem running FreeBSD 6.0 as a guest OS in VMware Workstation 5.0. I discovered the FreeBSD VM runs at half speed, such that 10 seconds of real time appears to be 5 or so seconds within the VM. I tried installing the vmware-guestd port but that had no effect, even though it is running in the VM.

After reading this post, I tried changing this sysctl:

gruden:/root# sysctl -a kern.timecounter.hardware
kern.timecounter.hardware: ACPI-fast
gruden:/root# sysctl kern.timecounter.hardware=TSC
kern.timecounter.hardware: ACPI-fast -> TSC

That had no effect. This is my freebsd.vmx file:

config.version = "8"
virtualHW.version = "4"
scsi0.present = "TRUE"
scsi0.virtualDev = "lsilogic"
memsize = "128"
ide0:0.present = "TRUE"
ide0:0.fileName = "FreeBSD-000003.vmdk"
ide1:0.present = "TRUE"
ide1:0.fileName = "auto detect"
ide1:0.deviceType = "cdrom-raw"
floppy0.fileName = "A:"
ethernet0.present = "TRUE"
usb.present = "FALSE"
sound.present = "FALSE"
sound.virtualDev = "es1371"
displayName = "freebsd6-0_a"
guestOS = "freebsd"
nvram = "freebsd.nvram"

sound.startConnected = "FALSE"

usb.generic.autoconnect = "FALSE"

floppy0.startConnected = "FALSE"

ide0:0.redo = ""
ethernet0.addressType = "generated"
uuid.location = "56 4d 1e 0b c0 77 f6 f2-55 f3 38 5f 3a 47 3e b3"
uuid.bios = "56 4d 1e 0b c0 77 f6 f2-55 f3 38 5f 3a 47 3e b3"
tools.remindInstall = "FALSE"
ethernet0.generatedAddress = "00:0c:29:47:3e:b3"
ethernet0.generatedAddressOffset = "0"

ide1:0.startConnected = "FALSE"

tools.syncTime = "TRUE"

Originally the file had the last variable appear thus:

tools.syncTime = "FALSE"

Either setting had no effect. The host OS is Windows Server 2003 Enterprise x64 Edition SP1. The weird part of this is that a FreeBSD 5.4 VM running within exactly the same parameters has no problem on this system. This does not appear to be an isolated problem.

Is anyone successfully running FreeBSD 6.0 within VMware Workstation?

Update: I just copied a complete clone of this VM to my Windows 2000 Professional laptop running the same version of VMware Workstation. (Yes, I have two licenses!) :) It made no difference. The 5.5 RC2, VMware Workstation 5.5.0 build-18007, was no better with FreeBSD 6.0 as far as time goes. However, the excessive beeping that I saw with FreeBSD 6.0 on VMware WS 5.0 was shortened considerable on WS 5.5.

I just posted this story as a question to the VMTN forums. I also posted to freebsd-emulation.

17 comments:

John Ward said...

The link for the VMWare forums is bunk.

I have tried it with GSX, but not Workstation. I didn't check the timing however since its apparent speed was fine.

Anonymous said...

I am running it successfully, few issues:

1) When the boot loader comes up the machine beeps for something like 5 seconds, drives me mad.
2) Sometimes I get errors on the console about processes having some timeshift or a few micro seconds

VMWare workstation, XP, AMD 2800 32bit machine

other than that it works a charm.

Joao Barros said...

Try sysctl kern.timecounter.hardware=i8254

There was a thread on stable@ around this subject and the topic was: 6.0 on VMWare 5.0: `calcru: negative runtime of -12728437 usec for pid 28 (irq17: lnc0)'

Richard Bejtlich said...

FYI -- the suggested sysctl had no effect.

Anonymous said...

Not much help but.. I tried 6.0 pre-release a few weeks ago but had too much trouble (known issue with host CD on install). I stepped down to 5.4 on Gentoo Linux host and have minimal problems.

Anonymous said...

Have you tried adding this to /boot/loader.conf?

kern.hz="100"

The default was raised to 1000 in FreeBSD 6. IIRC, it has been 100 in previous versions.

Richard Bejtlich said...

Thank you, but that good suggestion had no positive effect:

gruden:/root# ntpdate 192.168.2.7
15 Nov 08:48:10 ntpdate[504]: step time server 192.168.2.7 offset -3.961761 sec
gruden:/root# sysctl -a | grep clockrate
kern.clockrate: { hz = 100, tick = 10000, profhz = 66, stathz = 13 }
hw.clockrate: 3246
gruden:/root# ntpdate 192.168.2.7
15 Nov 08:48:17 ntpdate[507]: step time server 192.168.2.7 offset -3.980486 sec

Anonymous said...

Disable your APIC device, provided you're not trying to run an SMP kernel in a virtual SMP machine. Disabling the APIC forces FreeBSD to fall back on the old-fashioned IRQ timers. I think. Anyway, it works. Or works around. Whatever:

In /boot/loader.conf , add:

hint.apic.0.disabled=1

Or, comment out the "device apic" line in your kernel config file and rebuild, if you're one of Those People.

-Ed

Richard Bejtlich said...

Ed -- you, sir, are a genius. It's working.

gruden:/root# date && ntpdate 192.168.2.7
Thu Nov 17 15:28:48 EST 2005
17 Nov 15:28:48 ntpdate[513]: adjust time server 192.168.2.7 offset -0.011940 sec
gruden:/root# date && ntpdate 192.168.2.7
Thu Nov 17 15:29:00 EST 2005
17 Nov 15:29:00 ntpdate[515]: adjust time server 192.168.2.7 offset 0.033098 sec

Thank you!

Anonymous said...

Thanks guys, I had the exact same problem and I followed the suggestion here to disable APIC and voila!

The timing on my side was really bad, I lost about 6 seconds for every 10 second interval.

By the way, I am testing on GSX server 3.2, FreeBSD 6.0-BETA5.

Thanks again!
---Jaco

lotso said...

It doesn't work for me. The time still drifts. as much as +/- 15 secs as far as I can tell.

Anonymous said...

disabling acpi showd only minimal impact for me. However I have a troublesome speedstep environment(centrino) on the host anyway. If I *enable* acpi on freebsd-guest and put the host into some work with a 'while true; do :; done' then everything works nicely. Not managed to get that into a useful setup yet...
... using various of the of the available tips.

Anonymous said...

Look anon, APIC is not ACPI! :)

Dennis said...

This thread was extremly helpful! Thanks

nycvelo said...

slightly offtopic, but has anyone here had luck with any VM software that:

- uses FreeBSD as the host OS; and

- runs at or near native speed

many thanks

Anonymous said...

With Virtual PC 2007 and FreeBSD 6.2
add the following to /boot/device.hints
hint.acpi.0.disabled="1"

Patrick Paradis
Patrick.Paradis@Alphamosaik.com

dghnfgj said...
This comment has been removed by a blog administrator.