The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #14366

virtual => physical and is_virtual => false on EC2

Added by Kevin O'Connor almost 2 years ago. Updated 7 months ago.

Status:ClosedStart date:05/08/2012
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:cloud - ec2
Target version:1.7.0
Keywords: Affected Facter version:1.6.8
Branch:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.


Description

As described:

[root@production-web-d95fb6bf ~]# facter | grep -i virtual
ec2_profile => default-paravirtual
is_virtual => false
virtual => physical
[root@production-web-d95fb6bf ~]# facter --version
1.6.8
[root@production-web-d95fb6bf ~]# cat /etc/*-release
Amazon Linux AMI release 2012.03

is_virtual should be true, right?


Related issues

Related to Facter - Feature #7559: Fact for identifying Amazon VPC instances. Merged - Pending Release 05/17/2011
Related to Facter - Bug #10625: Xen dom0 and domU hosts reported as physical without xenf... Duplicate 11/08/2011
Related to Facter - Bug #8210: virtual fact should work for EL kvm guests Closed 07/03/2011

History

#1 Updated by Daniel Pittman almost 2 years ago

  • Status changed from Unreviewed to Accepted

#2 Updated by Kevin O'Connor almost 2 years ago

  • Status changed from Accepted to In Topic Branch Pending Review

I added a pull request for this here – https://github.com/puppetlabs/facter/pull/201

This is my first pull request for facter/puppet related stuff, I’ve tried to follow the Contributor guide and other pull requests as closely as possible but let me know if it looks off.

Thanks!

#3 Updated by Ramin K almost 2 years ago

This looks like it could solved by cherrypicking this checkout from head. I don’t see it in the 1.6.x branch.

https://github.com/snappytv/facter/commit/976b7af24d641e589121d30e37bacc983d79cc0a#lib/facter/virtual.rb

#4 Updated by Martijn Heemels over 1 year ago

This unfortunately also occurs in the official Ubuntu facter package 1.6.5-1ubuntu1, which is the newest available on the current Ubuntu 12.04 LTS release.

This distro is widely used on EC2, so it would be very nice to have this fixed in an Ubuntu update.

#5 Updated by K White over 1 year ago

Still an issue, on old (2 yr+) & new (latest) versions of Amazon Linux [identical results as ec2-user & root]:

[ec2-user ~]$ uname -a
Linux ip-10-x-x-x 2.6.35.11-83.9.amzn1.x86_64 #1 SMP Sat Feb 19 23:42:04 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

[ec2-user ~]$ cat /etc/*-release
Amazon Linux AMI release 2011.02.1.1 (beta)

[ec2-user ~]$ facter --version
1.6.7

[ec2-user ~]$ facter | grep -v userdata | grep -i virtual
ec2_profile => default-paravirtual
is_virtual => false
virtual => physical

[ec2-user ~]$ dmesg | grep 'Xen ver'
[    0.000000] Xen version: 3.4.3-2.6.18 (preserve-AD)

==//==

[root ~]$ uname -a
Linux ip-10-x-x-x 3.2.34-55.46.amzn1.x86_64 #1 SMP Tue Nov 20 10:06:15 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

[root ~]$ cat /etc/*-release
Amazon Linux AMI release 2012.09

[root ~]$ facter --version
1.6.7

[root ~]$ facter | grep -v userdata | grep -i virtual
ec2_profile => default-paravirtual
is_virtual => false
virtual => physical

[root ~]$ dmesg | grep 'Xen ver'
[    0.000000] Xen version: 3.4.3.amazon (preserve-AD)

#6 Updated by Jeff McCune about 1 year ago

  • Category set to cloud - ec2
  • Status changed from In Topic Branch Pending Review to Needs More Information
  • Assignee set to Jeff McCune

K White wrote:

Still an issue, on old (2 yr+) & new (latest) versions of Amazon Linux [identical results as ec2-user & root]:

Martijn, Ramin, Kevin, K White, if you could easily configure your instances to install up to date packages from our own repository, would this be an acceptable solution to this issue?

It looks like this issue is fixed in recent versions of Facter. I think Amazon simply needs to update the version of Facter they make available to the AMI. I checked facter on amzn-ami-pv-2012.09.0.x86_64-ebs (ami-1624987f) and here’s what I get:

[ec2-user@ip-10-204-211-77] (master)(dirty)[██▁]~/src/facter 
$ bundle exec facter virtual
xenu
[ec2-user@ip-10-204-211-77] (master)(dirty)[██▁]~/src/facter 
$ bundle exec facter is_virtual
true
[ec2-user@ip-10-204-211-77] (master)(dirty)[██▁]~/src/facter 
$ git describe
1.6.17-467-g05f2519

I recommend working with Amazon and Canonical respectively to get more up to date packages in EC2. I also note that it’s not trivial to install Puppet and Facter from our own repository using the Amazon 2012.09 AMI.

-Jeff

#7 Updated by Ramin K about 1 year ago

Jeff,

Installing a recent version is agreeable to me, but even 1.6.17 does not solve the problem.

ramin@stats01.usw2 ~ $ facter | egrep "virt|facter|operating|instance"
ec2_instance_id => i-98111aa
ec2_instance_type => c1.medium
ec2_profile => default-paravirtual
facterversion => 1.6.17
is_virtual => false
kernelrelease => 3.2.0-36-virtual
operatingsystem => Ubuntu
operatingsystemrelease => 12.04
virtual => physical

#8 Updated by Jeff McCune about 1 year ago

  • Assignee changed from Jeff McCune to Ramin K

Ramin K wrote:

Jeff,

Installing a recent version is agreeable to me, but even 1.6.17 does not solve the problem.

Could you check if the code in the master branch does solve the issue for you? This will help me understand if we need to write more code to solve this or if we could solve this by cutting another release.

-Jeff

#9 Updated by Jeff McCune about 1 year ago

Also, a quick way to play around with the master branch and hack on the code is to do something like this; https://gist.github.com/4618182 which is how I hack on Puppet and Facter in EC2.

#! /bin/bash
#
sudo yum -y install git tmux zsh ruby-devel ruby-irb ruby-rdoc rubygems make gcc
cd ~
if ! [[ -f ~/.zshrc.local ]]; then
  echo 'export GEM_HOME="${HOME}"/.gems' > ~/.zshrc.local
  echo 'export PATH="${GEM_HOME}/bin:${PATH}"' >> ~/.zshrc.local
fi
eval "$(cat ~/.zshrc.local)"
gem install bundler --no-ri --no-rdoc
gem install rake --no-ri --no-rdoc
gem install hub --no-ri --no-rdoc
test -d src || mkdir src
cd src
test -d facter || hub clone puppetlabs/facter
test -d puppet || hub clone puppetlabs/puppet
test -d hiera || hub clone puppetlabs/hiera

(cd facter; bundle install --path vendor)

echo "All done!  Vim and your shell are setup, log back in and cd src/facter; bundle exec facter"

#10 Updated by Ramin K about 1 year ago

Jeff,

Thanks much for the pointer to hub, that helped. Nice thing for a blog post if you so inclined as well.

deploy@fe01.usw2 ~/src/facter $ bundle exec facter | egrep "virt|facter|operating|instance"               
ec2_instance_id => i-1111111
ec2_instance_type => c1.xlarge
ec2_profile => default-paravirtual
facterversion => 2.0.0-rc4
is_virtual => true
kernelrelease => 3.2.0-36-virtual
operatingsystem => Ubuntu
operatingsystemrelease => 12.04
virtual => xenu

That looks much better. I think the problem was introduced in the 3.x Linux kernel which changed the files in /proc/xen/ I believe this commit was the fix.

https://github.com/puppetlabs/facter/commit/976b7af24d641e589121d30e37bacc983d79cc0a

Let me know if you need any more info.

#11 Updated by Jeremy Brake about 1 year ago

  • Assignee changed from Ramin K to Jeff McCune

Hi Jeff, I’m seeing the same issue under Centos6 with 2.6 kernel (still broken in 6.17), but am not in a position to run the latest version of Puppet, and therefore facter. Is there a way to work around this (ideally in Puppet-2.6.7) by strategically overriding with custom facts, applied to known AWS instances and/or by exporting all of the ec2 and vpc facts to an external facts config and removing the dependancies?

#12 Updated by Jeff McCune about 1 year ago

Ramin K wrote:

Let me know if you need any more info.

I think the big remaining question is how Puppet Labs can best get recent versions of Puppet and Facter into your EC2 instances. I briefly played around with configuring an Amazon Linux AMI to talk to yum.puppetlabs.com, but I still couldn’t yum install anything beyond the Facter 1.6.7 version that Amazon provides.

How would you prefer to get releases of our software that contain these fixes? What should we be doing to make it easier to upgrade Puppet and Facter in EC2?

-Jeff

#13 Updated by Jeff McCune about 1 year ago

Jeremy Brake wrote:

Hi Jeff, I’m seeing the same issue under Centos6 with 2.6 kernel (still broken in 6.17), but am not in a position to run the latest version of Puppet, and therefore facter. Is there a way to work around this (ideally in Puppet-2.6.7) by strategically overriding with custom facts, applied to known AWS instances and/or by exporting all of the ec2 and vpc facts to an external facts config and removing the dependancies?

What version of Facter are you running? I tested this custom fact with Facter 1.6.7

If you put this into a module’s lib/facter/virtual.rb and make sure that only your EC2 hosts activate this code via pluginsync or otherwise, then you can override facter entirely:

require 'facter/util/ec2'

# Override EC2 facts for earlier versions of Puppet
# @see https://projects.puppetlabs.com/issues/14366#note-11
Facter.add("virtual") do
  has_weight 1000
  setcode { "xenu" }
end

Facter.add("is_virtual") do
  has_weight 1000
  setcode { true }
end

With this fact here’s what I get while running 1.6.7 in a VPC:

$ bundle exec facter | grep virtual
is_virtual => true
virtual => xenu

Hope this helps, -Jeff

#14 Updated by Jeff McCune about 1 year ago

  • Status changed from Needs More Information to Accepted
  • Assignee deleted (Jeff McCune)

#15 Updated by Jeff McCune about 1 year ago

  • Status changed from Accepted to Merged - Pending Release
  • Target version set to 2.0.0

This has been fixed in 976b7af24d641e589121d30e37bacc983d79cc0a and will be released in Facter 2.

-Jeff

#16 Updated by Andrew Parker 9 months ago

  • Status changed from Merged - Pending Release to Closed
  • Target version changed from 2.0.0 to 1.7.0

This was actually released in 1.7.0

Also available in: Atom PDF