Comment 21 for bug 494185

Revision history for this message
Eric Hammond (esh) wrote :

I verified this fix in my personal EC2 account using the 64-bit instances in eu-west-1, us-east-1, and us-west-1.

# For each of these three groups, run the remainder of the commands

  region=eu-west-1
  amiid=ami-4fcfe43b
  type=m1.large

  region=us-west-1
  amiid=ami-c12c7d84
  type=m1.large

  region=us-east-1
  amiid=ami-bb12ffd2
  type=m1.large

# Add an ssh keypair for the region

  ec2-add-keypair \
    --region $region \
    ec2-$region \
    > ~/.ssh/ec2-$region.pem

# Run an instance and connect to it

  instanceid=$(ec2-run-instances \
    --region $region \
    --instance-type $type \
    --key ec2-$region \
    $amiid |
    egrep ^INSTANCE | cut -f2)
  echo "instanceid=$instanceid"

  while host=$(ec2-describe-instances --region $region "$instanceid" |
    egrep ^INSTANCE | cut -f4) && test -z $host; do echo -n .; sleep 1; done
  echo host=$host

  ssh \
    -i ~/.ssh/ec2-$region.pem \
    ubuntu@$host

# Enable proposed and get fixed ec2-init

  printf "%s %s %s %s\n" \
     deb http://archive.ubuntu.com/ubuntu/ karmic-proposed main |
     sudo tee -a /etc/apt/sources.list

  sudo apt-get update && sudo apt-get install ec2-init

# Let defaults be run on next reboot and reboot

  sudo rm -f /var/lib/ec2/ec2-defaults.ever

  sudo reboot

# Connect to the instance again

  ssh \
    -i ~/.ssh/ec2-$region.pem \
    ubuntu@$host

# Verify archive host matches $region and test accessibility

  cat /etc/apt/sources.list

  sudo apt-get update && sudo apt-get upgrade -y

  exit

# Kill the instance

  ec2-terminate-instances --region $region $instanceid

Here is a sample /etc/apt/sources.list from the instance in us-west-1 (which had the original problem):

deb http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ karmic main universe
deb-src http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ karmic main universe
deb http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ karmic-updates main universe
deb-src http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ karmic-updates main universe
deb http://security.ubuntu.com/ubuntu karmic-security main universe
deb-src http://security.ubuntu.com/ubuntu karmic-security main universe