FreeBSD in VMware: Difference between revisions

From ZS64
Jump to navigationJump to search
No edit summary
 
(36 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Considerations for installing FreeBSD in VMware Fusion 2.0=
=Considerations for installing FreeBSD in VMware Fusion 2.0=


Installing 7.0-RELEASE or 7.1-BETA2 from the disk1 image works without a hitch.
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.


Upgrading via source to -current (2008-11-21) also worked flawlessly. I created a custom kernel config, removing INVARIANTS and WITNESS and most devices.
Update on 2010-05-22: all of this applies to VMware Fusion 3.0.2 and FreeBSD 8-stable including 8.1-PRERELEASE.


Trying to install emulation/vmware-guestd6 fails; it appears some patches are needed. Specifically, the location of the compiled vmmemctl.ko is now one level above from what the Makefile expects. In do-install around line 214, it now must read:
== Kernel Config ==
  ${INSTALL_KLD} ${WRKDIR}/vmmemctl.ko ${VMWARE_KMODDIR}
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.  


== Packages ==
# Minimal Configuration
I put in these packages:
#
* emulation/vmware-guestd6
# $FreeBSD: head/sys/amd64/conf/GENERIC 195618 2009-07-11 15:02:45Z rpaulo $
* emulation/vmware-tools6
* x11-servers/xorg-server
cpu HAMMER
* x11/xorg
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-mouse
* x11-drivers/xf86-input-vmmouse (see [[FreeBSD_in_VMware#Useful_Links|link list]] below for a patch that might be necessary to make vmmouse work with hald)
* x11-drivers/xf86-video-vmware
* x11-drivers/xf86-video-vmware
* x11-fonts/xorg-fonts


== xorg.conf ==
To set a non-standard keyboard layout, add a file <code>/usr/local/etc/hal/fdi/policy/x11-xkb.fdi</code>:


The auto-generated xorg.conf (X -configure) is almost complete, but I did make a few changes:
<?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"><b>de</b></merge>
    </match>
  </device>
</deviceinfo>


Use the VMware mouse driver:
=== Simple X11 Setup ===
Section "InputDevice"
Here's a small footprint X11 setup to get going:
        Identifier  "Mouse0"
* x11/xdm
        Driver      "vmmouse"
* x11/xterm
        Option      "Device" "/dev/sysmouse"
* x11-wm/windowmaker
        Option      "ZAxisMapping" "4 5 6 7"
 
EndSection
Edit <code>/etc/ttys</code> to enable <code>xdm</code>:
  ttyv8  "/usr/local/bin/xdm -nodaemon" xterm  <b>on</b> secure
 
=== xorg.conf ===
 
With <code>hald</code> 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:


Fix monitor timings to allow all resolutions (no idea why the autodetection is not working properly):
  Section "Monitor"
  Section "Monitor"
         Identifier  "Monitor0"
         Identifier  "Monitor0"
         VendorName  "Monitor Vendor"
         VendorName  "Monitor Vendor"
         ModelName    "Monitor Model"
         ModelName    "Monitor Model"
         HorizSync    30-100
         # The default frequencies make most resolutions unavailable, so specify better ones.
         VertRefresh  56-120
        <b>HorizSync    30-100</b>
         <b>VertRefresh  56-120</b>
  EndSection
  EndSection


Pin down resolutions to 1280x1024:
=== Starting Up ===
  Section "Screen"
 
        Identifier "Screen0"
After installing the packages and editing the config files, make sure to (re)start all necessary daemons:
        Device    "card0"
  /usr/local/etc/rc.d/dbus start
        Monitor    "Monitor0"
/usr/local/etc/rc.d/hald start
        SubSection "Display"
kill -1 1
                Viewport  0 0
 
                Depth    1
== VMware Tools ==
                Modes    "1280x1024"
 
        EndSubSection
None of the various ports worked for me, so I'm using the binaries included with VMware Fusion. Installation is straightforward:
...
# Install the misc/compat6x package.
EndSection
# Select Install VMware Tools from the Virtual Machine menu to attach the tools CD-ROM image to the virtual drive.
# Mount the CD-ROM: <code>mount /cdrom</code>
# Unpack the tools: <code>tar xf /cdrom/vmware-freebsd-tools.tar.gz</code>
# Run the installer: <code>vmware-tools-distrib/vmware-install.pl</code>
 
= 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 =
* [http://forums.freebsd.org/showthread.php?t=6291 VESA driver for amd64] Note that the mentioned PR for enabling 8bit modes in syscons has been committed since.
* [http://communities.vmware.com/docs/DOC-1201 A Power User's Guide to VMware Fusion]
* [http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/137731 Patch to have vmmouse activate when using hald]
* [http://blog.gcds.lt/2011/03/22/socat-virtual-serial-bridge/ Using socat to access a serial port in the guest]

Latest revision as of 13:28, 24 March 2011

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