← Back to team overview

group.of.nepali.translators team mailing list archive

[Bug 1941785] Re: ec2-hibinit-agent: Add support for IMDSv2

 

** Changed in: cloud-images
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1941785

Title:
  ec2-hibinit-agent: Add support for IMDSv2

Status in cloud-images:
  Fix Released
Status in ec2-hibinit-agent package in Ubuntu:
  Fix Released
Status in ec2-hibinit-agent source package in Xenial:
  Fix Released
Status in ec2-hibinit-agent source package in Bionic:
  Fix Released
Status in ec2-hibinit-agent source package in Focal:
  Fix Released
Status in ec2-hibinit-agent source package in Impish:
  Won't Fix
Status in ec2-hibinit-agent source package in Jammy:
  Fix Released
Status in ec2-hibinit-agent source package in Kinetic:
  Fix Released
Status in ec2-hibinit-agent source package in Lunar:
  Fix Released
Status in ec2-hibinit-agent source package in Mantic:
  Fix Released

Bug description:
  [Impact]
  If an Amazon Instance is set to require IMDSv2 and enable hibernation, the instance will get stuck in a "stopping" state when hibernation is triggered, and no VM state is preserved. Changes to support IMDSv2 in ec2-hibinit-agent are needed to prevent this behavior when only using IMDSv2.

  [Fix]
  Backport a portion of https://github.com/aws/amazon-ec2-hibinit-agent.git commit 9d9bca5c61fa9256289e68c88bd3747af2f62e28 ("Add IMDSv2 support")

  [Test Case]

  # To test the failure
  # This test case is written for Mantic but will apply to all distributions
  1. Create an amazon EC2 instance with the following properties
     - AMI - ami-0c2d04617e311f0d0 (For Mantic)
     - t3.micro
     - encrypted 8GB EBS volume with default key
     - Stop - Hibernate behavior: Enable
     - Metadata accessible : Enable
     - Metadata version  Info : V2 only (token required)
  2. Wait for instance to say "Running"
  3. Initiate Hibernation
  # At this point the machine will stay stuck in the "Stopping" State and you will have to force stop the machine.

  # To test the fix
  1. Create an amazon EC2 instance with the following properties
     - AMI - ami-0c2d04617e311f0d0 (For Mantic)
     - t3.micro
     - encrypted 8GB EBS volume with default key
     - Stop - Hibernate behavior: Enable
     - Metadata accessible : Enable
     - Metadata version  Info : V2 only (token required)
  2. Wait for instance to say "Running"
  3. ssh into your instance
  4. (Before Change is Merged) add PPA for updated package; apt update && apt upgrade
  5. Create a test program
  ```
  /bin/cat <<EOM >~/allocate_mem.py
  #!/usr/bin/python3
  import time

  # Allocate 200MB chunk of memory
  size = 200 * 1024 * 1024  # 200MB
  memory_chunk = bytearray(size)

  print("Allocated 200MB of memory.")

  # Enter indefinite loop
  while True:
      time.sleep(1)  # Wait for 1 second

  # The script will never reach this point
  EOM
  ```
  6. Run a background process
  ```
  python3 ~/allocate_mem.py &
  ```
  7. Hibernate the instance
  8. Wait for Instance to be in "Stopped" State
  9. Start the intsance
  10. ssh into instance
  11. Check that the process is running
  $ ps aux | grep allocate_mem
  ubuntu      2532  1.1 23.0 221948 213248 pts/0   S    13:43   0:00 python3 /home/ubuntu/allocate_mem.py

  [Where problems could occur]
  Hibernation may not properly occur which would result in a loss of VM state and the end user needing to force stop the instance.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-images/+bug/1941785/+subscriptions