ec2-init overwrites user/vmbuilder provided /etc/apt/sources.list

Bug #502490 reported by Eric Hammond on 2010-01-03
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Scott Moser
vm-builder (Ubuntu)

Bug Description

Binary package hint: ec2-init

The ec2-init startup code in /usr/bin/ec2-set-defaults overwrites the /etc/apt/sources.list that was bundled with the image.

I support the goal of this code, which is to provide a reasonable default of an apt mirror in the same EC2 region where the instance is running, but the end effect is disastrous for people and tools attempting to create custom /etc/apt.sources.list files on EC2 images.

The (undocumented?) workaround for this problem was for the image builder to place their desired sources.list into the file:



a. it is unintuitive and difficult for image builders to know they should do this, and

b. this does not interact well with even the existing image building software like vmbuilder.

Here are some use cases which are hurt by the current policy of always overwriting:

1. User sets the image /etc/apt/sources.list to point to a daily snapshot in the Ubuntu EC2 mirror provided by RightScale.

2. User adds multiverse to an EC2 image they are building using vmbuilder's --components option.

3. User adds a PPA to an EC2 image they are building using vmbuilder's --ppa option.

All of the above preferences in the image are currently wiped out by ec2-init when the EC2 instance boots up.

I'd like to see ec2-init be able to detect when the user has customized the /etc/apt/sources.list and not overwrite it. This seems like it would offer the smallest element of surprise and require the least amount of ongoing user frustration and support effort.

Further enhancements could then be made to vmbuilder so that its basic --component and --ppa options integrate nicely with the new ec2-init. For example:

1. vmbuilder --component could be smart and modify the /etc/ec2-init/templates/sources.list.tmpl in addition to /etc/apt/sources.list and could communicate to ec2-init that the /etc/apt/sources.list may be overwritten with ones generated from the templates using the current EC2 region.

2. vmbuilder --ppa could create a file like /etc/apt/sources.list.d/[PPANAME]-ppa.list instead of appending lines to the /etc/apt/sources.list file.

The vmbuilder --mirror option would still create a custom /etc/apt/sources.list file which should not be overwritten by ec2-init.

ProblemType: Bug
Architecture: i386
Date: Sun Jan 3 00:36:20 2010
DistroRelease: Ubuntu 9.10
Ec2AMI: ami-1515f67c
Ec2AMIManifest: ubuntu-images-us/ubuntu-karmic-9.10-i386-server-20091027.1.manifest.xml
Ec2AvailabilityZone: us-east-1a
Ec2InstanceType: c1.medium
Ec2Kernel: aki-5f15f636
Ec2Ramdisk: ari-0915f660
Package: ec2-init 0.4.999-0ubuntu7
PackageArchitecture: all
ProcVersionSignature: User Name 2.6.31-302.7-ec2
SourcePackage: ec2-init
Tags: ec2-images
Uname: Linux 2.6.31-302-ec2 i686

Eric Hammond (esh) wrote :
Scott Moser (smoser) wrote :

I've added a 'cloud-config' option to preseve /etc/apt/sources.list
This can be specifed in /etc/cloud/cloud.cfg or in user data tagged as cloud-config. The line is like:

# Preserve existing /etc/apt/sources.list
# Default: overwrite sources_list with mirror. If this is true
# then apt_mirror above will have no effect
apt_preserve_sources_list: true

Changed in ec2-init (Ubuntu):
status: New → Confirmed
importance: Undecided → Low
status: Confirmed → Triaged
Scott Moser (smoser) on 2010-02-24
affects: ec2-init (Ubuntu) → cloud-init (Ubuntu)
Scott Moser (smoser) wrote :

I opened a task against vm-builder, as I do agree with Eric that it should write ppa entries to /etc/init/sources.list.d/ .

I believe that the cloud-config option is sufficient for cloud-init solution. If you feel otherwise, please re-open that task.

Changed in cloud-init (Ubuntu):
assignee: nobody → Scott Moser (smoser)
status: Triaged → Fix Released
Eric Hammond (esh) wrote :

Scott: Is this fixed in Karmic or just Lucid?

On Fri, 19 Mar 2010, Eric Hammond wrote:

> Scott: Is this fixed in Karmic or just Lucid?

Lucid. If you want a Karmic (no promises), please 'Nominate for Release'

Chuck Short (zulcss) on 2010-03-22
Changed in vm-builder (Ubuntu):
status: New → Confirmed
Mathias Gug (mathiaz) on 2010-03-31
Changed in cloud-init (Ubuntu Karmic):
status: New → Won't Fix
Changed in vm-builder (Ubuntu Karmic):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers