add support for set selections

Bug #582667 reported by Pete Crossley on 2010-05-19
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)

Bug Description

Binary package hint: cloud-init

-- Lucid, x86 & x64

With the evolution of the cloud packages like this make it much easier for provisioning base configurations. With that the ability of installing packages in to the instance on initial startup provides much flexibility with configuration management systems such as CHEF, and PUPPET. Though some of these prereqs have user directed input required on install. Trying to stay away from the golden image complex, cloud-init could benefit from implementing the debconf set selections. I have seen a purposed syntax in the TODO file in the example directory and I feel that would be a great addition. If I have time I might work on a patch and update this Bug/ER when I have time. Till then I wanted to see if others are limited by this issue like myself.

Related branches

Scott Moser (smoser) wrote :

I agree. Wish I had realized the usefulness of this prior to lucid release.
Thank you for opening a bug.

just for the record here, the doc referred to was:
debconf_selections: | # Need to perserve newlines
        # Force debconf priority to critical.
        debconf debconf/priority select critical

        # Override default frontend to readline, but allow user to select.
        debconf debconf/frontend select readline
        debconf debconf/frontend seen false

Changed in cloud-init (Ubuntu):
importance: Undecided → Wishlist
status: New → Triaged
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.5.12-0ubuntu1

cloud-init (0.5.12-0ubuntu1) maverick; urgency=low

  * New upstream release.
  * fix cloud-init-run-module to allow 'always' (LP: #568139)
  * add support for setting debconf selections
  * add cloud-config support for debconf selections (LP: #582667),
    byobu enablement, and ssh-import-lp-id
 -- Scott Moser <email address hidden> Fri, 18 Jun 2010 15:48:14 -0400

Changed in cloud-init (Ubuntu):
status: Triaged → Fix Released
Pete Crossley (peterc) wrote :

Is there a possibility with getting this added to lucid-updates?

Scott Moser (smoser) wrote :

On Tue, 22 Jun 2010, Pete Crossley wrote:
> Is there a possibility with getting this added to lucid-updates?

Its not normally the type of thing that gets pulled back. It definitely
qualifies as a feature rather than a bug fix.

Please go ahead and "nominate for release" of lucid, and then the server
team will look consider it.

Pete Crossley (peterc) wrote :

Information for SRU:
  * Since Lucid is an LTS release and cloud computing is here to stay.
  * Having a way to preconfigured packages installed by cloud-init using dpkg-setselection is necessary to help people stay away from golden images.
  * adding this LP issue does not change any existing syntax in the cloud-init config file, only enabling additional support, prior configuration files will not break.

Martin Pitt (pitti) wrote :

Is there a patch/bzr revision to look at for evaluating how intrusive this is?

Scott Moser (smoser) wrote :

Pete, I've added a build to my ppa. [1], and am attaching the patch here.
The build should finish sometime in the next day or so. I'd appreciate it if you'd test it and report back.

I've tested this build with:
## launch a ec2 lucid instance of ubuntu-lucid-10.04-i386-server-20100427.1
## in the us-east-1 region with some specific user data to test this.
$ cat /tmp/my-ud.txt
debconf_selections: |
  debconf debconf/priority select low
  debconf debconf/frontend select readline
$ ec2-run-instances --user-data-file=/tmp/my-ud.txt --key mykey ami-2d4aa444

## now, in the instance
% sudo apt-add-repository ppa:smoser/ppa
% sudo apt-get update
% sudo apt-get debconf-utils
% sudo apt-get install cloud-init
% dpkg-query --show cloud-init
cloud-init 0.5.10-0ubuntu1.2~ppa0

% sudo debconf-get-selections | grep debconf/
debconf debconf/frontend select Dialog
debconf debconf/priority select high

## Remove the apt-update-upgrade "already ran" file to make this run again
## with the new code, and then run it again.
% sudo rm /var/lib/cloud/sem/apt-update-upgrade.i-*
% sudo cloud-init-cfg apt-update-upgrade
% sudo debconf-get-selections | grep debconf/
debconf debconf/frontend select readline
debconf debconf/priority select low

The above shows that the new code is functioning with the ppa build. Note, that 'frontend' and 'priority' values where changed by the re-running of 'cloud-init-cfg apt-update-upgrade'.

Martin, you can take a look at the patch attached to see if you think its sufficient.

Pete Crossley (peterc) wrote :

Sure I will add it to my UEC image and give it a shot once the PPA build is done and let you know.

Martin Pitt (pitti) wrote :

Thanks for the patch link. The patch is small, self-contained, touches only non-compiled files, and does not change the default behaviour, so I consider it having a very low regression potential. It does add a new feature, but we are more lenient with that for LTS releases.

Patch approved for SRU, please go ahead and upload.

Changed in cloud-init (Ubuntu Lucid):
status: New → Confirmed
Pete Crossley (peterc) wrote :

Set selection works, but.... the upstart scripts do not wait for the 'cloud-config' status.

So some of the scripts start too soon. I had to make most of the scripts use 'start on filesystem and cloud-config' and I made the cloud-run-user-scripts use 'start on (stopped rc RUNLEVEL=[2345] and stopped cloud-config-misc)'

I will create a new issue but I feel this should be fixed prior to the SRU since this will prevent the usage of the cloud-init in UEC and maybe ec2.

Pete Crossley (peterc) wrote :

See (LP #613309) for the upstart issue.

Martin Pitt (pitti) wrote :

Please upload.

Pete Crossley (peterc) wrote :

If your regarding the patch to the upstart scripts I attached it to (LP: #613309).

Scott Moser (smoser) wrote :

  uploaded to lucid-proposed.

Pete Crossley (peterc) wrote :

Scott did this get uploaded correctly?? I don't see it in the SRU process.

On Wed, 11 Aug 2010, Pete Crossley wrote:

> Scott did this get uploaded correctly?? I don't see it in the SRU
> process.

Where do you not see it?
The archive is closed right now for 10.04.1 preparation, I did get an
acknowledgment of upload from launchpad for it though:
  Subject: [ubuntu/lucid-proposed] cloud-init 0.5.10-0ubuntu1.3 (Waiting for approval)

Pete Crossley (peterc) wrote :

I didn't see it here..

But now i do. :) so its all cool. Sorry

Accepted cloud-init into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See for documentation how to enable and use -proposed. Thank you in advance!

Changed in cloud-init (Ubuntu Lucid):
status: Confirmed → Fix Committed
tags: added: verification-needed
Scott Moser (smoser) wrote :

I've verified the update is functioning as it should. Here is how:

- booted ami-1eea0077 (us-east-1 ubuntu-lucid-daily-i386-server-20100817)
  with the following user data:
debconf_selections: |
  debconf debconf/priority select low
  debconf debconf/frontend select readline
apt_update: true
apt_upgrade: true

 - &user_setup |
   set -x; exec > ~/user_setup.log 2>&1
   echo "starting at $(date -R)"
   echo "ps grep apt"
   ps axw | grep apt
   echo "ps grep cloud-init-cfg"
   ps axw | grep cloud-init-cfg

 - [ sudo, -Hu, ubuntu, sh, -c, 'read up sleep < /proc/uptime; echo $(date): runcmd up at $up | tee -a ~/runcmd.log' ]
 - [ sudo, -Hu, ubuntu, sh, -c, *user_setup ]
### end user data ###

- on initial boot, the instance has old cloud-init from lucid,
  so old debconf values will be in place.
$ sudo apt-get install debconf-utils
$ sudo debconf-get-selections | grep debconf/
debconf debconf/frontend select Dialog
debconf debconf/priority select high

- save off old logs
  $ mkdir old-logs && mv *.log old-logs

- add proposed and get cloud-init
  $ echo deb \
     $(lsb_release -sc)-proposed restricted main multiverse universe |
     sudo tee -a /etc/apt/sources.list.d/proposed.list
  $ sudo apt-get install cloud-init
  $ dpkg-query --show cloud-init
  cloud-init 0.5.10-0ubuntu1.2

- remove /var/lib/cloud so cloud-init will run again on next boot
  $ sudo rm -Rf /var/lib/cloud
  $ sudo reboot

- come back to instance, this time
  * debconf set selelections will have taken affect ( bug 582667 is fixed)
    $ sudo debconf-get-selections | grep debconf/
    debconf debconf/frontend select readline
    debconf debconf/priority select low

  * the logs will not show apt or cloud-init-cfg processes ( bug 613309 is fixed) because
    the scripts will have run after those have finished (even though 'apt-get
    upgrade' will have pulled all the -proposed changes)

    the second time, runcmd.log showed it was running at 92.46 seconds of
    uptime, compared to 12.63 the first time. The second time neither 'ps'
    finds cloud-init-cfg processes or apt processes.

tags: added: verification-done
removed: verification-needed
tags: added: ec2-images
removed: cloud ec2
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 0.5.10-0ubuntu1.2

cloud-init (0.5.10-0ubuntu1.2) lucid-proposed; urgency=low

  * add support for setting debconf selections (LP: #582667)
  * force runcmd scripts to run after cloud-init/cloud-config
    scripts are finished (LP: #613309)
 -- Scott Moser <email address hidden> Tue, 17 Aug 2010 08:45:39 -0400

Changed in cloud-init (Ubuntu Lucid):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers