Quantcast
Channel: Planet Ubuntu
Viewing all articles
Browse latest Browse all 17727

Scott Moser: Migrating to pv-grub kernels for kernel upgrades

$
0
0

After the release of the Ubuntu 10.04 LTS images that use the pv-grub kernel, there were some questions on what to do if you're running from an older AMI and want to take advantage of what pv-grub offers.

Heres a short list of how you might be affected:

  • If you are running an EBS root instance launched from or rebundled from an Official Ubuntu image of 10.04 LTS (Lucid Lynx) released 20110201.1 or later, 10.10 (Maverick Meerkat), Natty Narwhal, or later, then you do not need to do anything. You already are using pv-grub, and can simply apply software updates and reboot to get new kernel updates. You can stop reading now.
  • If you are running an instance-store instance that is not using a pv-grub kernel, there is nothing you can do. There is simply no way to change the kernel of an instance store instance.
  • If you are running an EBS-root based instance rebundled from a Ubuntu 9.04 (Karmic Koala) or older, then there is currently no supported path to getting kernel upgrades. There were no officially released EBS-root based Ubuntu images of 9.04, and with Karmic's end of life coming in April, there is not likely to be support for this new feature.
  • If you are running an EBS-root instance launched from or rebundled from an official Ubuntu release of 10.04, read on.

Updating a 10.04 based image basically entails 2 steps, setting up /boot/grub/menu.lst, and then modifying your instance to have a pv-grub kernel.


Step 1: installing grub-legacy-ec2.

If you launched or rebundled your instance from an Ubuntu 10.04 numbered 20101020 or earlier, you need to do this step. If you started from a release of 20101228 you can skip this step.

  • Apply software updates.

    Depending on how out of date you are, this might take a while.


    sudo apt-get update && sudo apt-get dist-upgrade

  • Install grub-legacy-ec2

    The 'grub-legacy-ec2' package is what the images use to manage /boot/grub/menu.lst. If you had used Ubuntu prior to the default selection of grub2, you will be familiar with how it works. grub-legacy-ec2 is basically just the menu.lst managing portion of the Ubuntu grub 0.97 package with some EC2 specifics thrown in.

    To get a functional /boot/grub/menu.lst, all you have to do is:


    sudo apt-get install grub-legacy-ec2


Step 2: modifying the instance to use pv-grub kernels

Now, your images should have a functional /boot/grub/menu.lst, and grub-legacy-ec2 should be properly installed such that future kernels will get automatically added and selected on reboot. However, you have to change your instance to boot using pv-grub rather than the old kernel aki that you originally started with.
  • Shut down the instance

    The best way to do this is probably to just issue '/sbin/poweroff' inside the instance. Alternatively, you could use the ec2 api tools, or do so from the AWS console.

    % sudo /sbin/poweroff

  • Modify the instance's kernel to be a pv-grub kernel

    Once the instance is moved to "stopped" state, you can modify its kernel to be a pv-grub kernel. The kernel you select depends on the arch and region. See the table below for selecting which you should use:
    regionarchaki id
    ap-southeast-1x86_64aki-11d5aa43
    ap-southeast-1i386aki-13d5aa41
    eu-west-1x86_64aki-4feec43b
    eu-west-1i386aki-4deec439
    us-east-1x86_64aki-427d952b
    us-east-1i386aki-407d9529
    us-west-1x86_64aki-9ba0f1de
    us-west-1i386aki-99a0f1dc

    Then, assuming you have $AKI represents the appropriate aki above, and $IID represents your instance id, and $REGION represents your region, you can update the instance and then start it with:

    $ ec2-modify-instance-attribute --region ${REGION} --kernel ${AKI} ${IID}
    $ ec2-start-instances --region ${REGION} ${IID}


Your instance will start with a new hostname/IP address, so get that out of describe-instances and ssh to your instance. You can check that it has worked by looking at /proc/cmdline. Your kernel command line should look something like this:


$ cat /proc/cmdline
root=UUID=7233f657-c156-48fe-8d60-31ae6400d0cf ro console=hvc0


In the future, your instance will now behave much more like a "normal server". If you apply software updates (apt-get dist-upgrade) and reboot, you'll boot into a fresh new kernel.


Viewing all articles
Browse latest Browse all 17727

Trending Articles