FreeBSD 7.0 running inside VMware as a "Guest OS"

Prerequisites:

 Basic Installation of FreeBSD

Overview:
bulletHelpful Links & Tools
bulletVMX File "Tweaks" and Settings
bulletInstalling VMware Tools in FreeBSD 7
bulletFreeBSD Kernel Configuration Examples
bullet Re-Securing a FreeBSD VM that you may have downloaded
(VMware Appliances running SSH for example)
bullet The "Old" way to install VMware Tools FreeBSD 6.x

 

FreeBSD as a VMware "Virtual Appliance"

Home: 

 http://www.vmware.com

Helpful Links & Tools

# http://ivoras.sharanet.org/freebsd/vmware.html
# http://sanbarrow.com/vmx/vmx-config-ini.html
# http://petruska.stardock.net/Software/VMware.html

 

VMX File "Tweaks" and Settings

# Note for VMware users running FreeBSD in a VM to fix time drift
# Edit or add a line to your loader.conf
vi
/boot/loader.conf

# ACPI in a VMware VM using FreeBSD caused serious clock drift, shutting off ACPI fixed this for me
# Reducing the Kernel timer frequency from the default 1000 to 100 may also help


# Use Intel (em0) emulation instead of Lance (lnc0) for Ethernet to avoid "Giant Lock"
# Edit your FreeBSD.vmx file and add:

# Edit /etc/rc.conf and change the lnc0 to em0
vi /etc/rc.conf

 

# # Consider disabling VM memory swap (if you have enough RAM)
# Edit your FreeBSD.vmx file and add:

# Also you can disable the beep if it bugs you!

# Help time sync

# Optional: and in the guest file's rc.conf start ntpd with flags "-Aqgx &" so it just syncs once at boot and exits.


Additional Documentation

Memory
prefvmx.minVmMemPct = "100" fit memory into RAM

Whenever possible avoid settings lower 100%

prefvmx.minVmMemPct = "50" allow some memory to be swapped
prefvmx.minVmMemPct = "25" allow most memory to be swapped
 
prefvmx.allVMMemoryLimit = "1272" sets the maximum amount of RAM that can be used by VMs-
if this is less than at least 80% of the physical RAM
something is going wrong:
scan through preferences.ini and config.ini for memory-related entries, power down all running VMs and delete these lines and restart your host.
Do not launch any other apps! Create a new VM and check if anything has changed.
 
mainMem.partialLazyRestore = "true" restore snapshots in background -
mainMem.partialLazyRestore = "false" do not restore snapshots in background
 
mainMem.partialLazySave = "true" take snapshots in background
mainMem.partialLazySave = "false" do not take snapshots in background

 

mainMem.useNamedFile = "true" creates a file the size of nominal RAM in working directory
file uses random name
mainMem.useNamedFile = "false" doesn't use named-file - use for VMs on USB-disks or other slow disks
Windows: useNamedFile= "FALSE" causes memory to be backed by the host's swap space.
Linux: useNamedFile= "FALSE" causes a hidden file to be created in a temporary directory, which is immediately deleted when you power off the VM

 

Priority
priority.grabbed = "high"
priority.grabbed = "normal"
this host-wide settings can be over-ruled by settings in the vmx-file

priority.ungrabbed = "normal"
priority.ungrabbed = "low"
priority.ungrabbed = "idle"
this host-wide settings can be over-ruled by settings in the vmx-file

 

Copy and paste
Isolation.tools.copy.enable = "true" enable copy function (vmware-tools) - use same settings for ... paste.enable
Isolation.tools.copy.enable = "false" disable copy function (vmware-tools)
Isolation.tools.paste.enable = "true" enable paste function (vmware-tools)
Isolation.tools.paste.enable = "false" disable paste function (vmware-tools)

 

Shared folders
Isolation.tools.HGFS.disable = "true" disables shared-folders - if implemented
Isolation.tools.HGFS.disable = "false" enables shared-folders - if implemented

 

Misc
mks.ctlAltDel.ignore = "true" see
mks.fullscreen.allowScreenSaver = "true" see
fullScreenSwitch.onSeparateDesktop = "true" see

 

Beep
mks.noBeep = "TRUE" in earlier versions you could add this entry to the vmx-file to get rid of anoying BIOS-beeps via the computer-speaker.
looks like you have to add this to the config.ini with Workstation 6

 

Startup
msg.autoAnswer = "true" tries to automatically answer all pop-ups at start of a VM

 

Security
security.host.muissl= "true" use SSL for the remote-console
security.host.muissl = "false" don't use SSL for the remote-console

 

Workspace
defaultVMPath = "path"
datastore.name
datastore.localpath = "path"
This sets the workspace - new VMs will be created here

 

Cycling through VM and Host
FullScreenSwitch.cycleKey = "0x13"
FullScreenSwitch.cycleKey = "0x0"
FullScreenSwitch.cycleHost = "true"
http://www.vmware.com/support/ws5/doc/ws_special_config.html

 

Switching directly to VM and Host
FullScreenSwitch.directKey = "0x70"
FullScreenSwitch.directKey = "0x6"
FullScreenSwitch.hostDirectKey = "0x78"
FullScreenSwitch.hostDirectKey = "0x6"
http://www.vmware.com/support/ws5/doc/ws_special_config.html
 

 

Prevent swapping on a Windows Host
datastore.name = "local"
defaultVMPath = "R:\vm\machines"

datastore.localpath = "R:\vm\machines\"

sched.mem.pshare.enable = "FALSE"
prefvmx.useRecommendedLockedMemSize = "TRUE"
prefvmx.minVmMemPct = "100"
priority.grabbed = "normal"
priority.ungrabbed = "normal"

security.host.ruissl = "FALSE"

mainMem.partialLazySave = "FALSE"
mainMem.partialLazyRestore = "FALSE"
mainMem.useNamedFile = "FALSE"

prevent swapping on a windows-host


This allocates all nominal guest-RAM completely into host-memory
Sorry - doesn't work on Linux

 

 

Installing VMware Tools in FreeBSD 7

# vmware-toolbox - http://open-vm-tools.sourceforge.net
cd /usr/ports/emulators/open-vm-tools
make install clean
# vmshrink - http://chitchat.at.infoseek.co.jp/vmware/vmtools.html
cd /usr/ports/emulators/vmw
make install clean
# X.Org xf86-video-vmware driver
cd /usr/ports/x11-drivers/xf86-video-vmware/
make install clean

vi /etc/rc.conf
vmware_guestd_enable="YES"

shutdown -r now

vmware-toolbox &
vmshrink

 

FreeBSD Kernel Configuration Examples

# Typical FreeBSD 7.0 Kernel configuration file running inside VMware

 

# Typical FreeBSD 6.3 Kernel configuration file running inside VMware

 

Re-Securing a FreeBSD VM that you may have downloaded (VMware Appliances running SSH for example)

# Security notes for anyone who downloads a pre-made FreeBSD VM from the Internet

# Problem: Whenever you clone a virtual machine, or download a virtual machine, you also clone the private SSH key for that virtual machine.
# Once you have the private key, you can decrypt or hijack the traffic being sent over your "secure" connection.
# Solution: You need to re-generate your private SSH keys when you clone a VM:

# FreeBSD SSH Key Regeneration:
rm -i /etc/ssh/*key* # permanently delete your existing private keys
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa1 # re-gen the rsa1 key
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa # re-gen the dsa key

# Remember that you will receive a "key changed" warning the next time you ssh to your server.

 

The "Old" way to install VMware Tools FreeBSD 6.x

# Installing the VMware Tools into FreeBSD

1.) Load the "freebsd.iso" that comes with VMware as the virtual CD-ROM
    

2.) Click "Install VMware Tools" from the "VM" menu
   

3.) Choose "Install" when prompted
   

4.) Log into FreeBSD as user: root
     cd /usr/ports/emulators/vmware-tools6
     make install clean
     # Answer "Y" for yes when prompted
   

5.) Ignore any errors and reboot
     Make sure you set the CD-ROM back to "Auto" instead of pointing to the freebsd.iso
    

6.) After rebooting you should see "vmware_guestd" running and no more tools error messages
   

7.) Using your favorite "X Windows" client launch the tools
     /usr/X11R6/bin/vmware-toolbox &
   

Note: You need an X11 client / server to "see" X11 applications running on other machines.