FreeBSD in VMware

From ZS64
Jump to navigationJump to search

Considerations for installing FreeBSD in VMware Fusion 2.0

Installing various 6.x and 7.x releases (both i386 and amd64) works without a hitch (I usually work off the disk1 image). Various 8-current snapshots also worked fine, and most of the following is based on 8-BETA3. Although I'm working on VMware Fusion 2.0.5, most of this should apply to other (current) VMware products as well.

Update on 2010-05-22: all of this applies to VMware Fusion 3.0.2 and FreeBSD 8-stable including 8.1-PRERELEASE.

Kernel Config

I've pared down my kernel config to remove unnecessary devices, and to be able to load and unload certain drivers on demand, to aid in debugging etc.

# Minimal Configuration
#
# $FreeBSD: head/sys/amd64/conf/GENERIC 195618 2009-07-11 15:02:45Z rpaulo $

cpu		HAMMER
ident		MINIMAL

makeoptions	DEBUG=-g		# Build kernel with gdb(1) debug symbols

options 	SCHED_ULE		# ULE scheduler
options 	PREEMPTION		# Enable kernel thread preemption
options 	INET			# InterNETworking
options 	INET6			# IPv6 communications protocols
options 	FFS			# Berkeley Fast Filesystem
options 	SOFTUPDATES		# Enable FFS soft updates support
options 	UFS_ACL			# Support for access control lists
options 	UFS_DIRHASH		# Improve performance on big directories
options 	UFS_GJOURNAL		# Enable gjournal-based UFS journaling
options 	MD_ROOT			# MD is a potential root device
options 	NFSCLIENT		# Network Filesystem Client
options 	NFSSERVER		# Network Filesystem Server
options 	NFSLOCKD		# Network Lock Manager
options 	NFS_ROOT		# NFS usable as /, requires NFSCLIENT
options 	GEOM_PART_GPT		# GUID Partition Tables.
options 	GEOM_LABEL		# Provides labelization
options 	COMPAT_43TTY		# BSD 4.3 TTY compat (sgtty)
options 	COMPAT_IA32		# Compatible with i386 binaries
options 	COMPAT_FREEBSD4		# Compatible with FreeBSD4
options 	COMPAT_FREEBSD5		# Compatible with FreeBSD5
options 	COMPAT_FREEBSD6		# Compatible with FreeBSD6
options 	COMPAT_FREEBSD7		# Compatible with FreeBSD7
options 	SCSI_DELAY=500		# Delay (in ms) before probing SCSI
options 	KTRACE			# ktrace(1) support
options 	STACK			# stack(9) support
options 	SYSVSHM			# SYSV-style shared memory
options 	SYSVMSG			# SYSV-style message queues
options 	SYSVSEM			# SYSV-style semaphores
options 	P1003_1B_SEMAPHORES	# POSIX-style semaphores
options 	_KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options 	PRINTF_BUFR_SIZE=128	# Prevent printf output being interspersed.
options 	KBD_INSTALL_CDEV	# install a CDEV entry in /dev
#options 	STOP_NMI		# Stop CPUS using NMI instead of IPI
options 	HWPMC_HOOKS		# Necessary kernel hooks for hwpmc(4)
options 	AUDIT			# Security event auditing
options 	MAC			# TrustedBSD MAC Framework
options		FLOWTABLE		# per-cpu routing cache
#options 	KDTRACE_FRAME		# Ensure frames are compiled in
#options 	KDTRACE_HOOKS		# Kernel DTrace hooks
options 	SMP			# Symmetric MultiProcessor Kernel

# Debugging for use in -current
options 	KDB			# Enable kernel debugger support.
options 	DDB			# Support DDB.
options 	GDB			# Support remote GDB.
#options 	INVARIANTS		# Enable calls of extra sanity checking
options 	INVARIANT_SUPPORT	# Extra sanity checks of internal structures, required by INVARIANTS
options 	WITNESS			# Enable checks to detect deadlocks and cycles
#options    WITNESS_SKIPSPIN    # Don't run witness on spinlocks for speed

device      acpi
device      pci
device      agp     # support several AGP chipsets 
device      scbus       # SCSI bus (required for SCSI)

options 	ATA_STATIC_ID	# Static device numbering

# SCSI devices are not available as modules
device		ch		# SCSI media changers
device		da		# Direct Access (disks)
device		sa		# Sequential Access (tape etc)
device		cd		# CD
device		pass		# Passthrough device (direct SCSI access)
device		ses		# SCSI Environmental Services (and SAF-TE)

device		atkbdc		# AT keyboard controller
device		atkbd		# AT keyboard
device		psm		# PS/2 mouse
device		kbdmux		# keyboard multiplexer
device		vga		# VGA video card driver
device		sc

device		uart		# Generic UART driver
device		loop		# Network loopback
device		ether		# Ethernet support
device		bpf		# Berkeley packet filter

loader.conf

# quick boot
autoboot_delay="1"
beastie_disable="YES"
# drivers for "on-board" VMware hardware, plus other essentials
snd_es137x_load="YES"
mpt_load="YES"
ata_load="YES"
atapci_load="YES"
atadisk_load="YES"
atapicd_load="YES"
if_em_load="YES"
random_load="YES"
uhci_load="YES"
ehci_load="YES"
# optional drivers for USB devices
umass_load="YES"
uplcom_load="YES"
uftdi_load="YES"
# VESA is currently only available on i386
#vesa_load="YES"

rc.conf

ifconfig_em0="DHCP -rxcsum -txcsum"

# standard console configuration: ISO-8859-1 charset and German keyboard layout
font8x14="iso-8x14"
font8x16="iso-8x16"
font8x8="iso-8x8"
keymap="german.iso"

dbus_enable="YES"
hald_enable="YES"

X11

Minimum X11

The following list adds the minimum X11 support. You will want a window manager, etc. See below.

  • x11/libXcursor
  • x11/xauth
  • x11/xrandr
  • x11-drivers/xf86-input-keyboard
  • x11-drivers/xf86-input-mouse
  • x11-drivers/xf86-input-vmmouse (see link list below for a patch that might be necessary to make vmmouse work with hald)
  • x11-drivers/xf86-video-vmware
  • x11-fonts/xorg-fonts

To set a non-standard keyboard layout, add a file /usr/local/etc/hal/fdi/policy/x11-xkb.fdi:

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
  <device>
    <match key="info.capabilities" contains="input.keyboard">
      <merge key="input.xkb.layout" type="string">de</merge>
    </match>
  </device>
</deviceinfo>

Simple X11 Setup

Here's a small footprint X11 setup to get going:

  • x11/xdm
  • x11/xterm
  • x11-wm/windowmaker

Edit /etc/ttys to enable xdm:

 ttyv8   "/usr/local/bin/xdm -nodaemon"  xterm   on secure

xorg.conf

With hald support in the server, no config file is necessary.

For better control over the screen resolutions available, and other options, you should generate the default one by running X -configure, and copying the resulting xorg.conf.new to /etc/X11/xorg.conf.

I added these entries to my xorg.conf:

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "Monitor Vendor"
        ModelName    "Monitor Model"
        # The default frequencies make most resolutions unavailable, so specify better ones.
        HorizSync    30-100
        VertRefresh  56-120
EndSection

Starting Up

After installing the packages and editing the config files, make sure to (re)start all necessary daemons:

/usr/local/etc/rc.d/dbus start
/usr/local/etc/rc.d/hald start
kill -1 1

VMware Tools

None of the various ports worked for me, so I'm using the binaries included with VMware Fusion. Installation is straightforward:

  1. Install the misc/compat6x package.
  2. Select Install VMware Tools from the Virtual Machine menu to attach the tools CD-ROM image to the virtual drive.
  3. Mount the CD-ROM: mount /cdrom
  4. Unpack the tools: tar xf /cdrom/vmware-freebsd-tools.tar.gz
  5. Run the installer: vmware-tools-distrib/vmware-install.pl

Problems and Issues

Ethernet Interface Dropping Connections

The Intel Gigabit Ethernet controller emulated by VMware is not working properly with the current FreeBSD driver. I had to turn off TCP Checksum Offloading using the ifconfig switches -rxcsum and -txcsum. This is reflected in the above rc.conf sample.

Useful Links