Setting up Debian Sarge on Amazon's EC2

| | | | |

So i was asked by Martin to take a look at EC2 and S3 . Without knowing anything i got on amazon's site related to AWS (Amazon Web Services) and started to read the docs.
After setting up the tools i started an instance provided by amazon (it was a Fedora Core instance) and saw the whole thing run .

Linux elastic 2.6.16-xenU #1 SMP Mon Aug 14 19:11:10 SAST 2006 i686 GNU/Linux

# free
total used free shared buffers cached
Mem: 1740944 224916 1516028 0 41808 24288
-/+ buffers/cache: 158820 1582124
Swap: 917496 2224 915272

# cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 37
model name : AMD Opteron(tm) Processor 250
stepping : 1
cpu MHz : 2405.450
cache size : 1024 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu tsc msr pae mce cx8 apic mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt lm 3dnowext 3dnow pni lahf_lm ts fid vid ttp
bogomips : 4811.86

# hdparm -tT /dev/sda2

/dev/sda2:
Timing cached reads: 1540 MB in 2.00 seconds = 769.98 MB/sec
Timing buffered disk reads: 162 MB in 3.04 seconds = 53.37 MB/sec

After this i started to do my on instance, i didn't choose to follow the examples by using a loopback device or create a new system with yum (anyway i wasn't using Fedora at all); instead i installed Debian Sarge in VMware. I wanted a clean install and i didn't have time and wasn't in the mood to do weird things with debian installer or other stuff, anyway the VMware has it's downside ... you have to own VMware. If don't own a copy of VMware or other virtualization software you could you a spare machine or a machine with at least a spare partition and enough disk space to set up a Debian Sarge distro.
I installed the basic stuff i need (wich is not so basic), downloaded the ec2 ami tools , patched the script /usr/lib/site_ruby/image.rb by changing

exec( 'for i in console null zero ; do /sbin/MAKEDEV -d ' + dev_dir + ' -x $i ; done' )

to

exec("cd #{dev_dir} && /sbin/MAKEDEV console && /sbin/MAKEDEV std && /sbin/MAKEDEV generic")

Seems like debian's MAKEDEV is different from Fedora Core's one (the script patching above was suggested by another user and amazon's support staff wich , by the way, is great).
You must set the RUBYLIB enviroment variable to:

export RUBYLIB="/usr/lib/site_ruby"

so ruby "knows" where to find the ami tools libraries

From here everything went smooth. I ran ec2-bundle-vol and uploaded my stuff to Amazon S3 , registerd the image and started it.
Btw, it worked too :)

elastic:~# echo Running Debian `cat /etc/debian_version ` on `uname -a`
Running Debian 3.1 on Linux elastic 2.6.16-xenU #1 SMP Mon Aug 14 19:11:10 SAST 2006 i686 GNU/Linux

elastic:~# iptables -vL -n
FATAL: Could not load /lib/modules/2.6.16-xenU/modules.dep: No such file or directory
iptables v1.2.11: can't initialize iptables table `filter': iptables who? (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

Solved with the help of AWS support, you can either start the original Fedora instance and copy the modules from there or download them from AWS.The full kernel source is available too.
After decompressing the modules and moving them to /lib/modules do a depmod -a . Now iptables is ok.

Doing a dmesg a got this surprise:

************************************************** *************
** WARNING: Currently emulating unsupported memory accesses **
** in /lib/tls glibc libraries. The emulation is **
** slow. To ensure full performance you should **
** install a 'xen-friendly' (nosegneg) version of **
** the library, or disable tls support by executing **
** the following as root: **
** mv /lib/tls /lib/tls.disabled **
** Offending process: init (pid=1) **
************************************************** *************

I have never worked before with Xen(Xen beeing part of the software that amazon uses to deliver the EC2 service), but after googling and reading i found out this is "kind of expected behaveour under Xen". To fixit you can: do the mv /lib/tls /lib/tls.disabled or do a mixing with packages from Debian testing (Etch) and install libc6-xen from there (wich is libc patched with the nosegneg - WARNING! i didn't try this) .
I chose just to do the mv thing as i didn't figure out exactly if i really need the tls thing (i read on wikipedia and google about it but still i'm not quite sure about it). There is a real proper way to do the mv thing.
.
After budling the new instance and starting it dmesg doesn't show up any errors.

So this is the first expercience with EC2.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
More information about formatting options