swap turned off

Bug #499522 reported by Mathias Gug on 2009-12-22
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
ec2-init (Ubuntu)
Medium
Scott Moser

Bug Description

Binary package hint: ec2-init

UEC lucid images have swap turned off by default. If the guest is under memory pressure, the OOM kicks in.

Scott Moser (smoser) wrote :

Note, that the OOM is kicking in in 256M in a basically idle system soon after boot. I've not seen this, but mathias reports it.

Scott Moser (smoser) wrote :

I changed the built ec2-init images to not have an entry for swap. The plan was to find available swaps and enable it in ec2-init.

Changed in ec2-init (Ubuntu):
milestone: none → lucid-alpha-3
Scott Moser (smoser) wrote :

swap devices should be found and enabled with ec2-init 0.5.1 or greater.
This happens in 2 ways:
- if the ec2 metadata service provides data, it will be used
- if not, blkid is used to find devices with swap signature from partitions

I've verified that swap is enabled on ec2 i386 with in 20100126 with 0.5.1-0ubuntu1

Changed in ec2-init (Ubuntu):
assignee: nobody → Scott Moser (smoser)
importance: Undecided → Medium
status: New → Fix Released
Eric Hammond (esh) wrote :

Hi, it's me (again) trying to make sure that power users have the ability to control what they want (again).

Is there a document or can you point me to code where the swap is automatically turned on?

I'd like to be able to turn off swap in my /etc/fstab in my AMI and not have ec2-init override this.

If necessary, I suppose I can turn off swap again later, but I get uncomfortable when the ec2-init keeps changing things out from under me after I have set them in my image (like it currently does with /etc/apt/sources.list).

On Tue, 26 Jan 2010, Eric Hammond wrote:

> Hi, it's me (again) trying to make sure that power users have the
> ability to control what they want (again).
>
> Is there a document or can you point me to code where the swap is
> automatically turned on?

line 288 at
http://bazaar.launchpad.net/%7Esmoser/ec2-init/ec2-init.devel/annotate/head%3A/ec2init/__init__.py
defines enable_swap()

it tries to get information from the datasource (the metadata service). if
that fails, it uses 'blkid' to identify everything that it thinks is swap.
In ec2, the metadata service shouldn't ever fail.

> I'd like to be able to turn off swap in my /etc/fstab in my AMI and not
> have ec2-init override this.
>
> If necessary, I suppose I can turn off swap again later, but I get
> uncomfortable when the ec2-init keeps changing things out from under me
> after I have set them in my image (like it currently does with
> /etc/apt/sources.list).

I could make a user data option for this, but I think its easy enough to
make a user script do 'swapoff -a', or more permenantly:
   sed -i 's,\(.*swap.*\),#\1,' /etc/fstab

The code to enable swap runs only once per instance.

Note, that as it is in our images, this is the same behavior as before.
On i386 you get swap, on amd64 you don't (per the meta-data service).

ie, the metadata service says:
 'block-device-mapping': {'ami': 'sda1',
                          'ephemeral0': 'sda2',
                          'root': '/dev/sda1',
                          'swap': 'sda3'},

ec2-init is just respecting that.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers