blah blah woof woof

Enabling a non-interactive install of Blackdown's j2re1.4 on Ubuntu or Debian

Tim Riley 2008.06.12

When you apt-get install the j2re1.4 Java package in Debian or Ubuntu, it displays a few ncurses-style dialogs to configure the software and to require your acceptance of the license agreement. Working with these dialogs is fine if you are installing the software with apt-get in a typical interactive shell session. If you are installing without this capacity to interact (like in a script), you will run into problems. Here’s how to fix it.

If you install the package with the noninteractive frontend for dpkg, then you’ll get an error like this:

The package fails to install because it requires the acceptance of the licence agreement, which it will only allow in an interactive installation.

The typical way to fix this is to pre-seed the debconf database (using debconf-set-selections) with the answers to the questions that the j2re1.4 package requires. However, this doesn’t seem to satisfy j2re1.4, and the package still displays the dialog or fails in non-interactive mode. Why is it java that always gives me these hairy problems?

Anyway, here is the way to fix it. If you manually append the values directly to the debconf database file, it will work:

cp /var/cache/debconf/config.dat /var/cache/debconf/config.dat-old

cat << E_O_DEBCONF >> /var/cache/debconf/config.dat

Name: j2re1.4/jcepolicy
Template: j2re1.4/jcepolicy
Value:
Owners: j2re1.4
Flags: seen

Name: j2re1.4/license
Template: j2re1.4/license
Value: true
Owners: j2re1.4
Flags: seen

Name: j2re1.4/stopthread
Template: j2re1.4/stopthread
Value: true
Owners: j2re1.4
Flags: seen

E_O_DEBCONF

(For reference, I found these values by making a copy of the config.dat file, running dpkg-preconfigure on the j2re1.4 package, and then running a diff between the updated config.dat file and my copy.)

Now you’ll be able to successfully install the package in noninteractive mode. This means, for us, one step closer to fully automating our Xen builds!

Want More?

Previous Article

  1. 2008.06.10 Automatic Saving Of Invalid Resources in Rails While Maintaining a Clean RESTful Interface

Next Article

  1. 2008.06.18 Loading the ActiveRecord SQL Server adapter in a Rails 2.1 app