9

In an ideal world, configuring puppet to install the open-vm-tools should be as simple as this:

class vm-tools {
    package { 'open-vm-tools':
        ensure => installed
    }
    package { 'open-vm-dkms':
        ensure => installed
    }
}

But, that opens up an ugly can of dependency creep; it installs X, which obviously doesn't belong on servers. As of Ubuntu 10.04, these packages both end up recommending the open-vm-toolbox package of GUI tools:

# apt-cache depends open-vm-dkms
open-vm-dkms
  Depends: dkms
  Depends: make
  Suggests: open-vm-toolbox
  Recommends: open-vm-tools

# apt-cache depends open-vm-tools
open-vm-tools
  Depends: libc6
  Depends: libfuse2
  Depends: libgcc1
  Depends: libglib2.0-0
  Depends: libicu44
  Depends: libstdc++6
  Recommends: open-vm-source
  Recommends: open-vm-toolbox
  Recommends: ethtool
  Recommends: zerofree

Recommended packages are always installed by default. It's clearly not desirable to install X dependencies by default when installing a package that is described as "CLI Tools".

The feature request against Debian was immediately rejected for this reason, but cooler heads did not prevail in Ubuntu. It seems that within the last week, there's some recognition that this was an ill-advised change, but that's of no help until the next LTS release rolls around.

The behavior to install recommended packages is easily enough disabled on the command line with the --no-install-recommends option, but through puppet there's no support for doing this, and a tangled mess of tickets requesting that support haven't gone far in 3 years.

The other option is to just disable recommended packages throughout the whole system via apt.conf, which is a massive change to package behavior with impacts reaching further than I'd like.

I've resigned myself to doing it the lazy way;

exec { 'open-vm-tools install':
    command => '/usr/bin/apt-get install -y --no-install-recommends open-vm-dkms open-vm-tools',
    creates => '/usr/lib/open-vm-tools',
}

But this is clearly "doing it wrong". Am I missing something that would make this all work the way it's supposed to, or is this the best hackish workaround to this issue?

Shane Madden
  • 112,982
  • 12
  • 174
  • 248

2 Answers2

3

Bug 1766 indicated that the aptitude provider installs recommended packages, while the apt provider does not.

If that's correct (I've not verified it myself), then the following may work more cleanly:

package { [ "open-vm-tools", "open-vm-dkms" ]:
  ensure   => installed,
  provider => apt,
}

Adapted from Puppet Type Reference, "package" section.


Edit after further investigation: since the apt provider is the default on Ubuntu and Debian, use the aptitude provider for these packages, and add a suitable ~/.aptitude/config for root.

package { [ "open-vm-tools", "open-vm-dkms" ]:
  ensure   => installed,
  provider => aptitude,
  require  => File["/root/.aptitude/config"];
}
file { "/root/.aptitude/config":
  ensure  => present,
  content => 'APT::Install-Recommends "0";';
}

Not perfect, but more concise than a giant exec line.

Mike Renfro
  • 1,281
  • 1
  • 8
  • 11
  • No such luck; x11-common and all its friends ended up installed. That bug report seems to imply that there is an argument that can be added to control the behavior with the apt provider... but I can't find any info on how that's supposed to be done. That bug report may be outdated, but, seems like at least currently, the `apt` provider is actually the default for Ubuntu and Debian, see line 13 of [this file](https://github.com/puppetlabs/puppet/blob/master/lib/puppet/provider/package/apt.rb). – Shane Madden Jun 14 '11 at 22:47
  • See edit above. – Mike Renfro Jun 15 '11 at 02:00
3

It looks like on 12.04, apt-get install open-vm-tools no longer installs X.

Ubuntu wiki on VMware Tools

  • 1
    Yes indeed! My [ranting on the bug report](https://bugs.launchpad.net/ubuntu/+source/open-vm-tools/+bug/604998) may have helped with that :) – Shane Madden May 26 '12 at 00:03