Skip to content

Stupid Puppet Trick: Agreeing to the Sun Java License with Debconf Preseeds and Puppet

I had a user ask for Java to be installed on the cluster systems, so I started up by making a simple JRE5 module for puppet, but this first one didn’t quite work:

class jre5 {
  package { "sun-java5-jre":
    ensure => latest;

It doesn’t work because Sun wants you to agree to its license before installing the JRE. There’s a couple of ways around this. First, the old-school method:

ssh host "yes | apt-get -y install sun-java5-jre"

where ‘yes’ is a standard Unix program that just prints out “yes” over and over until the program on the other side of the pipe terminates. But “ssh host foo” is not the way of the managed infrastructure.

The second method, much more friendly to centralized management, is to first install debconf-utils on a candidate system, and then install sun-java5-jre on the same system. Once that’s done, you can query the debconf database to see how it stored your answers to the Sun license agreement:

ch226-12:~# debconf-get-selections | grep sun-
sun-java5-bin   shared/accepted-sun-dlj-v1-1    boolean true
sun-java5-jre   shared/accepted-sun-dlj-v1-1    boolean true
sun-java5-jre   sun-java5-jre/jcepolicy note
sun-java5-jre   sun-java5-jre/stopthread        boolean true
sun-java5-bin   shared/error-sun-dlj-v1-1       error
sun-java5-jre   shared/error-sun-dlj-v1-1       error
sun-java5-bin   shared/present-sun-dlj-v1-1     note
sun-java5-jre   shared/present-sun-dlj-v1-1     note

Save those results (debconf seeds) into a file on the gold server. Then we can modify our jre5 class as follows:

class jre5 {
  package { "sun-java5-jre":
    require      => File["/var/cache/debconf/jre5.seeds"],
    responsefile => "/var/cache/debconf/jre5.seeds",
    ensure       => latest;

  file { "/var/cache/debconf/jre5.seeds":
    source => "puppet:///jre5/jre5.seeds",
    ensure => present;

Now our class will download the preseeded answers for the Java license, download and install the JRE, and then use the preseeded answers to skip past the license agreement. I had never messed with debconf seeding previously, since I had either just imaged my systems, or provided config files that would be used when I restarted any daemons or programs that depended on those files. Now debconf-utils is part of my standard system class definition.

Note that this method doesn’t work with the default puppet provided in Debian Etch (version 0.20) — the responsefile parameter for Debian packages was only added in puppet 0.22.

{ 18 } Comments

  1. Robin | April 7, 2009 at 1:46 am | Permalink

    When I ran debconf-get-selections, the various ‘accepted’ fields had the value ‘select true’. This still causes you to be asked (or, if using puppet, the install to fail.) So this is a note to anyone else finding this: make sure that they are ‘boolean true’ as they are in this post. It turns out to be something that takes about 45 minutes of staring to work out :)

  2. Robin | April 7, 2009 at 3:22 am | Permalink

    Additionally, there must not be more than a single space between ‘boolean’ and ‘true’ or you may spend a very long time figuring it out again.

    Even if that’s what debconf-get-selections provides in your case.

  3. Mike Renfro | April 7, 2009 at 8:54 am | Permalink

    Odd. I don’t recall editing anything in the debconf output; it may have changed with the Lenny release? Might be something else entirely, too.

  4. Soren Vind | January 28, 2010 at 5:18 am | Permalink

    Thank you SO much for this! Have been looking around for a while for a good solution to that problem. It is quite painful to accept the license agreement manually on tens of servers :)

  5. Jan | May 12, 2010 at 7:47 am | Permalink

    Thank you. Also: I run Lenny on my machines and I didn’t have to edit the debconf-get-selections output.

  6. Peter Sankauskas | December 9, 2010 at 9:13 pm | Permalink

    This is awesome! Thank you very much. If I get time, I will repost this on my blog updated for Ubuntu 10.04, Puppet 0.25 and JDK6

  7. Offirmo | November 2, 2011 at 4:45 pm | Permalink

    Excellent ! Just what I was looking for ! I didn’t even know this preseeding technique.
    Successfully applied this pre-seeding technique for java6 / ubuntu 10.04.
    Très bien !

  8. java assignment help | April 7, 2017 at 5:07 am | Permalink

    Excellent post for students who are learning Java.

  9. GoAssignmentHelp | June 22, 2017 at 6:19 am | Permalink

    Thanks a lot for sharing it, that’s truly has added a lot to our knowledge about this topic. Have a more successful day.

  10. Java help | July 17, 2017 at 8:25 am | Permalink


  11. Make My Assignment | July 22, 2017 at 11:14 am | Permalink

    Great site and a great topic as well I really get amazed to read this. It’s really good. I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge.

  12. bloons tower defense | August 8, 2017 at 12:25 pm | Permalink

    I don’t know who you are. Don’t even know your name I wish we could talk but I don’t have a number to call.

  13. Case Study Assignmen | November 24, 2017 at 2:58 am | Permalink

    Information news shared by the author. Keep it up

  14. Case Study Assignmen | November 24, 2017 at 2:59 am | Permalink

    Information news shared by the author best of luck Dear..!!

  15. Case Study online he | November 24, 2017 at 3:25 am | Permalink

    Please keep us informed like this.

  16. assignment reviews | January 17, 2018 at 12:44 am | Permalink

    Hi, myself Lui Jones professional research writer. Our aim is to provide the reviews of the assignment websites for the students.

  17. assignment reviews | January 17, 2018 at 12:45 am | Permalink

    I am glad that you visited this website. It is easy to understand and designed in a proper way. We are web portal where you can review and write assignment related websites.

  18. Academic Help UK | January 30, 2018 at 1:45 am | Permalink

    There are many techniques which can get the job done and there are also many libraries in the JavaScript through which it can be done easily.

{ 1 } Trackback

  1. IT-Consulting Hempel | June 25, 2011 at 9:59 am | Permalink

    Ubuntu – Sun Java6 mit Puppet installieren…

    Ich bin gerade dabei die Installation einer Arbeitsstation / Notebooks mittels Puppet zu automatisieren. Ziel ist es nach der Installation der Grundversion von Ubuntu 10.10 mittels Puppet die Installation weiter Software sowie die Grundkonfiguration zu…

Post a Comment

Your email is never published nor shared. Required fields are marked *