sysutils/open-vm-tools: fixing runProgramInGuest
bms at fastmail.net
Thu Nov 27 17:49:07 UTC 2014
I noticed today that vmrun's runProgramInGuest didn't seem to work on
FreeBSD, and have a (hackish) fix.
Background: I'm trying to automate some nasty operations I need to run
across our test topology at work. I have dozens of multi-gigabyte
FreeBSD VMs with ZFS, and these need to be shrunk to fit onto BD-R media
for publication. Without ZFS BP-rewrite, recreating the pool on a new
device is the only way to do this. VMware's "shrink disk" feature only
really understands a subset of Windows and Linux filesystems.
Issue: The PAM configuration installed with the port refers to
non-existent PAM modules. If I try to use vmrun with a (known
passwordless) account, I get the following log message:
Nov 27 16:49:11 ilnp-builder vmsvc: in openpam_load_module(): no
Workaround: Remove the missing PAM modules from the vmtoolsd PAM
configuration entirely, e.g.
sed -i.orig -e '/pam_unix2/d;/pam_unix_auth/d;/pam_unix_acct/d'
I can confirm that this allows the following vmrun commands to work:
copyFileFromHostToGuest, runProgramInGuest, runScriptInGuest.
Other details: Whilst mostly documented, this functionality isn't great
(and is fairly Windows centric). E.g. the runScriptInGuest command takes
the actual content of a script to be executed, error messages are logged
to stdout, and need to be parsed for guest command return codes. I'd be
happy to share the scripts once I've got the ZFS pool rebuild automated.
BMS (sent via webmail)
More information about the freebsd-ports