<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>etbe - Russell Coker &#187; Best Posts</title>
	<atom:link href="http://etbe.coker.com.au/tag/best-posts/feed/" rel="self" type="application/rss+xml" />
	<link>http://etbe.coker.com.au</link>
	<description>Linux, politics, and other interesting things</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:24:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>EC2 and IP Addresses</title>
		<link>http://etbe.coker.com.au/2008/11/06/ec2-and-ip-addresses/</link>
		<comments>http://etbe.coker.com.au/2008/11/06/ec2-and-ip-addresses/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 12:01:16 +0000</pubDate>
		<dc:creator>etbe</dc:creator>
				<category><![CDATA[Virtualisation]]></category>
		<category><![CDATA[Best Posts]]></category>

		<guid isPermaLink="false">http://etbe.coker.com.au/?p=890</guid>
		<description><![CDATA[One of the exciting things about having a cloud computing service is how to talk to the rest of the world. It&#8217;s all very well to have a varying number of machines in various locations, but you need constant DNS names at least (and sometimes constant IP addresses) to do most useful things. I have [...]]]></description>
			<content:encoded><![CDATA[<p>One of the exciting things about having a cloud computing service is how to talk to the rest of the world.  It&#8217;s all very well to have a varying number of machines in various locations, but you need constant DNS names at least (and sometimes constant IP addresses) to do most useful things.</p>
<p>I have previously <a href="http://etbe.coker.com.au/2008/11/04/basics-of-ec2/">described how to start an EC2 instance and login to it &#8211; which includes discovering it&#8217;s IP address [1]</a>.  It would not be difficult (in theory at least) to use <b>nsupdate</b> to change DNS records after an instance is started or terminated.  One problem is that there is no way of knowing when an instance is undesirably terminated (IE killed by hardware failure) apart from polling <b>ec2-describe-instances</b> so it seems impossible to remove a DNS name before some other EC2 customer gets a dynamic IP address.  So it seems that in most cases you will want a constant IP address (which Amazon calls an Elastic IP address) if you care about this possibility.  For the case of an orderly shutdown you could have a script remove the DNS record, wait for the timeout period specified by the DNS server (so that all correctly operating DNS caches have purged the record) and then terminate the instance.</p>
<p>One thing that interests me is the possibility of running front-end mail servers on EC2.  Mail servers that receive mail from the net can take significant amounts of CPU time and RAM for spam and virus filters.  Instead of having the expense of running enough MX servers to sustain the highest possible load even while one of the servers has experienced a hardware failure there is a possibility of running an extra EC2 instance at peak times with the possibility of running a large instance for a peak time when one of the dedicated servers has experienced a problem.  The idea of having a mail server die and have someone else&#8217;s server take the IP address and receive the mail is too horrible to contemplate, so an Elastic IP address is required.</p>
<p>It is quite OK to have a set of mail servers of which not all servers run all the time (this is why the MX record was introduced to the DNS) so having a server run periodically at periods of high load (one of the benefits of the EC2 service) will not require changes to the DNS.  I think it&#8217;s reasonably important to minimise the amount of changes to the DNS due to the possibility of accidentally breaking it (which is a real catastrophe) and the possibility of servers caching DNS data for longer than they should.  The alternative is to change the MX record to not point to the hostname of the server when the instance is terminated.  I will be interested to read comments on this issue.</p>
<p>The command <b>ec2-allocate-address</b> will allocate a public IP address for your use.  Once the address is allocated it will cost $0.01 per hour whenever it is unused.  There are also commands <b>ec2-describe-addresses</b> (to list all addresses allocated to you), <b>ec2-release-address</b> (to release an allocated address), <b>ec2-associate-address</b> to associate an IP address with a running instance, and <b>ec2-disassociate-address</b> to remove such an association.</p>
<p>The command &#8220;<b>ec2-associate-address -i INSTANCE ADDRESS</b>&#8221; will associate an IP address with the specified instance (replace <b>INSTANCE</b> with the instance ID &#8211; a code starting with &#8220;<b>i-</b>&#8221; that is returned from <b>ec2-describe-instances</b>.  The command &#8220;<b>ec2-describe-instances |grep ^INSTANCE|cut -f2</b>&#8221; will give you a list of all instance IDs in use &#8211; this is handy if your use of EC2 involves only one active instance at a time (all the EC2 API commands give output in tab-separated lists and can be easily manipulated with <b>grep</b> and <b>cut</b>).  Associating an IP address with an instance is documented as taking several minutes, while Amazon provides no guarantees or precise figures as to how long the various operations take it seems that assigning an IP address is one of the slower operations.  I expect that is due to the requirement for reconfiguring a firewall device (which services dozens or maybe hundreds of nodes) while creating or terminating an instance is an operation that is limited in scope to a single Xen host.</p>
<p>One result that I didn&#8217;t expect was that associating an elastic address is that the original address that was assigned to the instance is removed.  I had a ssh connection open to an instance when I assigned an elastic address and my connection was broken.  It makes sense to remove addresses that aren&#8217;t needed (IPv4 addresses are a precious commodity) and further reading of the documentation revealed that this is the documented behavior.</p>
<p>One thing I have not yet investigated is whether assigning an IP address from one instance to another is atomic.  Taking a few minutes to assign an IP address is usually no big deal, but having an IP address be unusable for a few minutes while in the process of transitioning between servers would be quite inconvenient.  It seems that a reasonably common desire would be to have a small instance running and to then transition the IP address to a large (or high-CPU) instance if the load gets high, having this happen without the users noticing would be a good thing.</p>
<ul>
<li>[1]<a href="http://etbe.coker.com.au/2008/11/04/basics-of-ec2/"> http://etbe.coker.com.au/2008/11/04/basics-of-ec2/</a></li>
</ul>
<p>Related posts:</p><ol>
<li><a href='http://etbe.coker.com.au/2008/08/05/new-strategy-xen-mac-allocation/' rel='bookmark' title='A New Strategy for Xen MAC Allocation'>A New Strategy for Xen MAC Allocation</a> <small>When installing Xen servers one issue that arises is how...</small></li>
<li><a href='http://etbe.coker.com.au/2008/11/04/basics-of-ec2/' rel='bookmark' title='Basics of EC2'>Basics of EC2</a> <small>I have previously written about my work packaging the tools...</small></li>
<li><a href='http://etbe.coker.com.au/2006/10/16/mx-vs-a-record/' rel='bookmark' title='MX vs A record'>MX vs A record</a> <small>One issue that has been the topic of some pointless...</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://etbe.coker.com.au/2008/11/06/ec2-and-ip-addresses/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Basics of EC2</title>
		<link>http://etbe.coker.com.au/2008/11/04/basics-of-ec2/</link>
		<comments>http://etbe.coker.com.au/2008/11/04/basics-of-ec2/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 11:02:28 +0000</pubDate>
		<dc:creator>etbe</dc:creator>
				<category><![CDATA[Virtualisation]]></category>
		<category><![CDATA[Best Posts]]></category>
		<category><![CDATA[Most Popular]]></category>

		<guid isPermaLink="false">http://etbe.coker.com.au/?p=886</guid>
		<description><![CDATA[I have previously written about my work packaging the tools to manage Amazon EC2 [1]. First you need to login and create a certificate (you can upload your own certificate &#8211; but this is probably only beneficial if you have two EC2 accounts and want to use the same certificate for both). Download the X509 [...]]]></description>
			<content:encoded><![CDATA[<p>I have <a href="http://etbe.coker.com.au/2008/10/04/getting-started-with-amazon-ec2/">previously written about my work packaging the tools to manage Amazon EC2 [1]</a>.</p>
<p>First you need to login and create a certificate (you can upload your own certificate &#8211; but this is probably only beneficial if you have two EC2 accounts and want to use the same certificate for both).  Download the X509 private key file (named pk-X.pem) and the public key (named cert-X.pem).  My Debian package of the EC2 API tools will look for the key files in the <b>~/.ec2</b> and <b>/etc/ec2</b> directories and will take the first one it finds by default.</p>
<p>To override the certificate (when using my Debian package) or to just have it work when using the code without my package you set the variables <b>EC2_PRIVATE_KEY</b> and <b>EC2_CERT</b>.</p>
<p><a href="http://docs.amazonwebservices.com/AmazonEC2/gsg/2006-06-26/running-an-instance.html">This Amazon page describes some of the basics of setting up the client software and RSA keys [2]</a>.  I will describe some of the most important things now:</p>
<p>The command &#8220;<b>ec2-add-keypair gsg-keypair > id_rsa-gsg-keypair</b>&#8221; creates a new keypair for logging in to an EC2 instance.  The public key goes to amazon and the private key can be used by any ssh client to login as root when you creat an instance.  To create an instance with that key you use the &#8220;<b>-k gsg-keypair</b>&#8221; option, so it seems a requirement to use the same working directory for creating all instances.  Note that <b>gsg-keypair</b> could be replaced by any other string, if you are doing something really serious with EC2 you might use one account to create instances that are run by different people with different keys.  But for most people I think that a single key is all that is required.  Strangely they don&#8217;t provide a way of getting access to the public key, you have to create an instance and then copy the /root/.ssh/authorized_keys file for that.</p>
<p><a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1345&#038;categoryID=100">This Amazon page describes how to set up sample images [3]</a>.</p>
<p>The first thing it describes is the command <b>ec2-describe-images -o self -o amazon</b> which gives a list of all images owned by yourself and all public images owned by Amazon.  It&#8217;s fairly clear that Amazon doesn&#8217;t expect you to use their images.  The i386 OS images that they have available are Fedora Core 4 (four configurations with two versions of each) and Fedora 8 (a single configuration with two versions) as well as three other demo images that don&#8217;t indicate the version.  The AMD64 OS images that they have available are Fedora Core 6 and Fedora Core 8.  Obviously if they wanted customers to use their own images (which seems like a really good idea to me) they would provide images of CentOS (or one of the other recompiles of RHEL) and Debian.  <a href="http://etbe.coker.com.au/2008/10/13/ec2-security/">I have written about why I think that this is a bad idea for security [4]</a>, please make sure that you don&#8217;t use the ancient Amazon images for anything other than testing!</p>
<p>To test choose an i386 image from Amazon&#8217;s list, i386 is best for testing because it allows the cheapest instances (currently $0.10 per hour).</p>
<p>Before launching an instance allow ssh access to it with the command &#8220;<b>ec2-authorize default -p 22</b>&#8220;.  Note that this command permits access for the entire world.  There are options to limit access to certain IP address ranges, but at this stage it&#8217;s best to focus on getting something working.  Of course you don&#8217;t want to actually use your first attempt at creating an instance, I think that setting up an instance to run in a secure and reliable manner would require many attempts and tests.  As all the storage of the instance is wiped when it terminates (as we aren&#8217;t using S3 yet) and you won&#8217;t have any secret data online security doesn&#8217;t need to be the highest priority.</p>
<p>A sample command to run an instance is &#8220;<b>ec2-run-instances ami-2b5fba42 -k gsg-keypair</b>&#8221; where <b>ami-2b5fba42</b> is a public Fedora 8 image available at this moment.  This will give output similar to the following:</p>
<p><b>RESERVATION	r-281fc441	999999999999	default<br />
INSTANCE	i-0c999999	ami-2b5fba42			pending	gsg-keypair	0		m1.small	2008-11-04T06:03:09+0000	us-east-1c	aki-a71cf9ce	ari-a51cf9cc</b></p>
<p>The parameter after the word <b>INSTANCE</b> is the serial number of the instance.  The command &#8220;<b>ec2-describe-instances i-0c999999</b>&#8221; will provide information on the instance, once it is running (which may be a few minutes after you request it) you will see output such as the following:</p>
<p><b>RESERVATION	r-281fc441	999999999999	default<br />
INSTANCE	i-0c999999	ami-2b5fba42	ec2-10-11-12-13.compute-1.amazonaws.com	domU-12-34-56-78-9a-bc.compute-1.internal	running	gsg-keypair	0		m1.small	2008-11-04T06:03:09+0000	us-east-1c	aki-a71cf9ce	ari-a51cf9cc</b></p>
<p>The command &#8220;<b>ssh -i id_rsa-gsg-keypair root@ec2-10-11-12-13.compute-1.amazonaws.com</b>&#8221; will then grant you root access.  The part of the name such as <b>10-11-12-13</b> is the public IP address.  Naturally you won&#8217;t see 10.11.12.13, it will instead be public addresses in the Amazon range &#8211; I replaced the addresses to avoid driving bots to their site.</p>
<p>The name <b>domU-12-34-56-78-9a-bc.compute-1.internal</b> is listed in Amazon&#8217;s internal DNS and returns the private IP address (in the 10.0.0.0/8 range) which is used for the instance.  The instance has no public IP address, all connections (both inbound and outbound) run through some sort of NAT.  This shouldn&#8217;t be a problem for HTTP, SMTP, and most protocols that are suitable for running on such a service.  But for FTP or UDP based services it might be a problem.  The part of the name such as<b>12-34-56-78-9a-bc</b> is the MAC address of the eth0 device.</p>
<p>To halt a service you can run <b>shutdown</b> or <b>halt</b> as root in the instance, or run the <b>ec2-terminate-instances</b> command and give it the instance ID that you want to terminate.  It seems to me that the best way of terminating an instance would be to run a script that produces a summary of whatver the instance did (you might not want to preserve all the log data, but some summary information would be useful), and give all operations that are in progress time to stop before running halt.  A script could run on the management system to launch such an orderly shutdown script on the instance and then uses <b>ec2-terminate-instances</b> if the instance does not terminate quickly enough.</p>
<p>In the near future I will document many aspects of using EC2.  This will include dynamic configuration of the host, dynamic DNS, and S3 storage among other things.</p>
<ul>
<li>[1]<a href="http://etbe.coker.com.au/2008/10/04/getting-started-with-amazon-ec2/"> http://etbe.coker.com.au/2008/10/04/getting-started-with-amazon-ec2/</a></li>
<li>[2]<a href="http://docs.amazonwebservices.com/AmazonEC2/gsg/2006-06-26/running-an-instance.html"> http://docs.amazonwebservices.com/AmazonEC2/gsg/2006-06-26/running-an-instance.html</a></li>
<li>[3]<a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1345&#038;categoryID=100"> http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1345&#038;categoryID=100</a></li>
<li>[4]<a href="http://etbe.coker.com.au/2008/10/13/ec2-security/"> http://etbe.coker.com.au/2008/10/13/ec2-security/</a></li>
</ul>
<p>Related posts:</p><ol>
<li><a href='http://etbe.coker.com.au/2007/10/03/xen-memory-use-and-zope/' rel='bookmark' title='Xen Memory Use and Zope'>Xen Memory Use and Zope</a> <small>I am currently considering what to do regarding a Zope...</small></li>
<li><a href='http://etbe.coker.com.au/2008/10/13/ec2-security/' rel='bookmark' title='EC2 Security'>EC2 Security</a> <small>One thing that concerns me about using any online service...</small></li>
<li><a href='http://etbe.coker.com.au/2007/09/07/duplicating-a-xen-domu/' rel='bookmark' title='Duplicating a Xen DomU'>Duplicating a Xen DomU</a> <small>A fairly common request is to be able to duplicate...</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://etbe.coker.com.au/2008/11/04/basics-of-ec2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrity and Mailing Lists</title>
		<link>http://etbe.coker.com.au/2008/11/02/integrity-mailing-lists/</link>
		<comments>http://etbe.coker.com.au/2008/11/02/integrity-mailing-lists/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 11:10:21 +0000</pubDate>
		<dc:creator>etbe</dc:creator>
				<category><![CDATA[Misc Computer]]></category>
		<category><![CDATA[Best Posts]]></category>

		<guid isPermaLink="false">http://etbe.coker.com.au/?p=859</guid>
		<description><![CDATA[One significant dividing factor between mailing lists is the difference between summary lists (where the person who asks a question receives replies off-list and then sends a summary to the list) and the majority of mailing lists which are discussion lists (where every reply goes to the list by default). I have seen an argument [...]]]></description>
			<content:encoded><![CDATA[<p>One significant dividing factor between mailing lists is the difference between summary lists (where the person who asks a question receives replies off-list and then sends a summary to the list) and the majority of mailing lists which are discussion lists (where every reply goes to the list by default).</p>
<p>I have seen an argument put forward that trusting the answers on a mailing list that operates under the summary list model is inherently risky and that peer review is required.</p>
<p>It could be argued that the process of sending a summary to the list is the peer review.  I&#8217;m sure that if someone posts a summary which includes some outrageously bad idea then there will be some commentary in response.  Of course the down-side to this is that it takes a few days for responses to the question to arrive and as it&#8217;s common that computer problems need to be solved in hours not days the problem will be solved (one way or another) before the summary message is written.  But the idea of peer review in mailing lists seems to fall down in many other ways.</p>
<p>The first problem with the idea of peer review is that the usual aim of mailing lists is that most people will first ask google and only ask the list if a reasonable google search fails (probably most mailing lists would fall apart under the load of repeated questions otherwise).  Therefore I expect that the majority of such problems to be solved by reading a web page (with no peer review that is easily accessible).  Some of those web pages contain bad advice and part of the skill involved in solving any problem relates to recognising which advice to follow.  Also it&#8217;s not uncommon for a question on a discussion list to result in a discussion with two or more radically different points of view being strongly supported.  I think that as a general rule there is little benefit in asking for advice if you lack any ability to determine whether the advice is any good, and which of the possible pieces of good advice actually apply to your situation.  Sometimes you can recognise good advice by the people who offer it, in a small community such as a mailing list it&#8217;s easy to recognise the people who have a history of offering reasonable advice.  It seems that the main disadvantage of asking google when compared to asking a mailing list is that the google results will in most cases contain links to web sites written by people who you don&#8217;t know.</p>
<p>Sometimes the advice is easy to assess, for example if someone recommends a little-known and badly documented command-line option for a utility it&#8217;s easy to read the man page and not overly difficult to read the source to discover whether it is a useful solution.  Even testing a suggested solution is usually a viable option.  Also it&#8217;s often the case that doing a google search on a recommended solution will be very informative (sometimes you see web pages saying &#8220;here&#8217;s something I tried which failed&#8221;).  Recommendations based on personal experience are less reliable due to statistical issues (consider the the regular disagreements about the reliability of hard disks where some people claim that RAID is not necessary due to not having seen failures while others claim that RAID-5 is inadequate because it has failed them). There are also issues of different requirements, trivial issues such as the amount of money that can be spent will often determine which (if any) of the pieces of good advice can be adopted.</p>
<p>The fact that a large number of people (possibly the majority of Internet users) regularly forward as fact rumors that are debunked by <a href="http://www.snopes.com/">Snopes.com (the main site for debunking urban legends)</a> seems to indicate that it is always going to be impossible to increase the quality of advice beyond a certain level.  A significant portion of the people on the net are either unwilling to spend a small amount of effort in determining the accuracy of information that they send around or are so gullible that they believe such things beyond the possibility of doubt. Consider that the next time you ask for advice on a technical issue, you may receive a response from someone who forwarded a rumor that was debunked by Snopes.</p>
<p>Sometimes technical advice is just inherently dangerous because it is impossible to verify the integrity of some code that is being shared, or because it may be based on different versions of software.  In <a href="http://etbe.coker.com.au/2008/10/13/ec2-security/">a previous blog post I analyse some issues related to security of the Amazon EC2 service [1]</a>.  While the EC2 service is great in many ways (and implements a good well-documented set of security features on the servers) the unsigned code for managing it and the old versions of the images that they offer to customers raise some serious issues that provide avenues for attack.  Getting the EC2 management tools to work correctly on Debian is not trivial, I have released patches but will not release packages for legal reasons.  It seems most likely to me that someone will release packages based on my patches (either because they don&#8217;t care about the legal issues or they have legal advice suggesting that such things are OK &#8211; maybe due to residing in a different jurisdiction).  Then people who download such packages will have to determine whether they trust the person who built them.  They may also have the issue of Amazon offering a newer version of the software than that which is packaged for Debian (for all I know Amazon released a new version yesterday).</p>
<p>The <a href="http://en.wikipedia.org/wiki/Data_integrity">term integrity when applied to computers refers to either accidental or malicious damage to data [2]</a>.  In the context of mailing list discussions this means both poorly considered advice and acts of malice (which when you consider spam and undisclosed conflicts of interest are actually quite common).</p>
<p>If you ask for advice in any forum (and I use the term in it&#8217;s broadest sense to cover web &#8220;forums&#8221;, IRC, twitter, etc) then getting a useful result will depend on having the majority of members of the forum possessing sufficient integrity and skill, being able to recognise the people whose advice should be followed, or being able to recognise good advice on it&#8217;s own.</p>
<p>I can think of few examples of forums of which I have been involved where the level of skill was sufficient to provide quality answers (and refutations for bad answers) for all areas of discussion that were on topic.  People whose advice should generally be followed will often offer advice on areas where their skills are less well developed, someone whose advice can be blindly followed in regard to topic A may not be a reliable source for advice on topic B &#8211; which can cause confusion if the topics in question are closely related.</p>
<p>Finally a fundamental difference between &#8220;peer review&#8221; (as applied to conferences and academic journals) is that review for conferences and journals is conducted before the presentation.  Not only does the work have to be good enough to pass the review, but the people doing it will never be sure what the threshold is (and will generally want to do more than a minimal effort) so the quality will be quite high.  While peer review in mailing lists is mostly based around the presence or absence of flames.  A message which doesn&#8217;t attract flames will either have some minimal quality or be related to a topic that is not well known (so no-one regards it as being obviously wrong).</p>
<p>Update: The &#8220;peer review&#8221; process of publishing a post on my blog revealed that I had incorrectly used <b>who&#8217;s</b> instead of <b>whose</b>.</p>
<ul>
<li>[1] <a href="http://etbe.coker.com.au/2008/10/13/ec2-security/">http://etbe.coker.com.au/2008/10/13/ec2-security/</a></li>
<li>[2]<a href="http://en.wikipedia.org/wiki/Data_integrity"> http://en.wikipedia.org/wiki/Data_integrity</a></li>
</ul>
<p>Related posts:</p><ol>
<li><a href='http://etbe.coker.com.au/2008/10/03/dkim-and-mailing-lists/' rel='bookmark' title='DKIM and Mailing Lists'>DKIM and Mailing Lists</a> <small>Currently we have a problem with the Debian list server...</small></li>
<li><a href='http://etbe.coker.com.au/2006/08/13/the-waste-of-closed-lists/' rel='bookmark' title='the waste of closed lists'>the waste of closed lists</a> <small>As I mentioned in my first post the amount of...</small></li>
<li><a href='http://etbe.coker.com.au/2006/09/15/mailing-list-culture/' rel='bookmark' title='mailing list culture'>mailing list culture</a> <small>There is currently a big debate in progress in Debian....</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://etbe.coker.com.au/2008/11/02/integrity-mailing-lists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading a server to 64bit Xen</title>
		<link>http://etbe.coker.com.au/2008/10/22/upgrading-a-server-to-64bit-xen/</link>
		<comments>http://etbe.coker.com.au/2008/10/22/upgrading-a-server-to-64bit-xen/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 09:00:04 +0000</pubDate>
		<dc:creator>etbe</dc:creator>
				<category><![CDATA[Virtualisation]]></category>
		<category><![CDATA[Best Posts]]></category>

		<guid isPermaLink="false">http://etbe.coker.com.au/?p=866</guid>
		<description><![CDATA[I have access to a server in Germany that was running Debian/Etch i386 but needed to be running Xen with the AMD64 version of Debian/Lenny (well it didn&#8217;t really need to be Lenny but we might as well get two upgrades done at the same time). Most people would probably do a complete reinstall, but [...]]]></description>
			<content:encoded><![CDATA[<p>I have access to a server in Germany that was running Debian/Etch i386 but needed to be running Xen with the AMD64 version of Debian/Lenny (well it didn&#8217;t really need to be Lenny but we might as well get two upgrades done at the same time).  Most people would probably do a complete reinstall, but I knew that I could do the upgrade while the machine is in a server room without any manual intervention.  I didn&#8217;t achieve all my goals (I wanted to do it without having to boot the recovery system &#8211; we ended up having to boot it twice) but no dealings with the ISP staff were required.</p>
<p>The first thing to do is to get a 64bit kernel running.  Based on past bad experiences I&#8217;m not going to use the Debian Xen kernel on a 64bit system (in all my tests it has had kernel panics in the Dom0 when doing any serious disk IO).  So I chose the CentOS 5 kernel.</p>
<p>To get the kernel running I copied the kernel files (/boot/vmlinuz-2.6.18-92.1.13.el5xen /boot/System.map-2.6.18-92.1.13.el5xen /boot/config-2.6.18-92.1.13.el5xen) and the modules (/lib/modules/2.6.18-92.1.13.el5xen) from a CentOS machine.  I just copied a .tgz archive as I didn&#8217;t want to bother installing alien or doing anything else that took time.  Then I ran the Debian mkinitramfs program to create the initrd (the 32bit tools for creating an initrd work well with a 64bit kernel).  Then I created the GRUB configuration entry (just copied the one from the CentOS box and changed the <b>root=</b> kernel parameter and the <b>root</b> GRUB parameter), crossed my fingers and rebooted.  I tested this on a machine in my own computer room to make sure it worked before deploying it in Germany, but there was still some risk.</p>
<p>After rebooting it the command <b>arch</b> reported <b>x86_64</b> &#8211; so it had a 64bit Xen kernel running correctly.</p>
<p>The next thing was to create a 64bit Lenny image.  I got the Lenny Beta 2 image and used <b>debootstrap</b> to create the image (I consulted <a href="http://etbe.coker.com.au/2007/01/01/installing-xen-domu-on-debian-etch/">my blog post about creating Xen images for the syntax [1]</a> &#8211; one of the benefits of blogging about how you solve technical problems).  Then I used scp to copy a .tgz file of that to the server in Germany.  Unfortunately the people who had set up that server had used all the disk space in two partitions, one for root and one for swap.  While I can use regular files for Xen images (with performance that will probably suck a bit &#8211; Ext3 is not a great filesystem for big files) I can&#8217;t use them for a new root filesystem.  So I formatted the swap space as ext3.</p>
<p>Then to get it working I merely had to update the <b>/etc/fstab</b>, <b>/etc/network/interfaces</b>, and <b>/etc/resolv.conf</b> files to make it basically functional.  Of course ssh access is necessary to do anything with the server once it boots, so I chrooted into the environment and ran &#8220;<b>apt-get update ; apt-get install openssh-server udev ; apt-get dist-upgrade</b>&#8220;.</p>
<p>I stuffed this up and didn&#8217;t allow myself ssh access the first time, so the thing to do is to start sshd in the chroot environment and make sure that you can really login.  Without having udev running a ssh login will probably result in the message &#8220;<b>stdin: is not a tty</b>&#8220;, that is not a problem.  Getting that to work by the commands &#8216;<b>ssh root@server &#8220;mkdir /dev/pts&#8221;</b>&#8216; and &#8216;<b>ssh root@server &#8220;mount -t devpts devpts /dev/pts&#8221;</b>&#8216; is not a challenge.  But installing udev first is a better idea.</p>
<p>Then after that I added a new grub entry as the default which used the CentOS kernel and /dev/sda1 (the device formerly used for swap space) as root.  I initially used the CentOS Xen kernel (all Red Hat based distributions bundle the Xen kernel with the Linux kernel &#8211; which makes some sense).  But the Debian Xen utilities didn&#8217;t like that so I changed to the Debian Xen kernel.</p>
<p>Once I had this basically working I copied the 64bit installation to the original device and put the 32bit files in a subdirectory named &#8220;old&#8221; (so configuration can be copied).  When I changed the configuration and rebooted it worked until I installed SE Linux.  It seems that the Debian init scripts will in many situations quietly work when the root device is incorectly specified in <b>/etc/fstab</b>.  This however requires creating a device node somewhere else for <b>fsck</b> and the SE Linux policy version 2:0.0.20080702-12 was not permitting this.  I have since uploaded policy 2:0.0.20080702-13 to fix this bug and requested that the release team allow it in Lenny &#8211; I think that a bug which can make a server fail to boot is worthy of inclusion!</p>
<p>Finally to get the CentOS kernel working with Debian you need to load the following modules in the Dom0 (<a href="http://etbe.coker.com.au/2008/10/22/kernel-issues-with-debian-xen-and-centos-kernels/">as discussed in my previous post about kernel issues [2]</a>):<br />
<b>blktap<br />
blkbk<br />
netbk</b></p>
<p>It seems that the Debian Xen kernel has those modules linked in and the Debian Xen utilities expect that.</p>
<p>Currently I&#8217;m using Debian kernels 2.6.18 and 2.6.26 for the DomUs.  I have considered using the CentOS kernel but they decided that <b>/dev/console</b> is not good enough for the console of a DomU and decided to use something else.  Gratuitous differences are annoying (every other machine both real and virtual has <b>/dev/console</b>).  If I find problems with the Debian kernels in DomUs I will change to the CentOS kernel.  Incidentally one problem I have had with a CentOS kernel for a DomU (when running on a CentOS Dom0) was that the CentOS initrd seems to have some strange expectations of the root filesystem, when they are not met things go wrong &#8211; a common symptom is that the <b>nash</b> process will go in a loop and use 100% CPU time.</p>
<p>One of the problems I had was converting the configuration for the primary network device from eth0 to xenbr0.  In my first attempt I had not installed the <b>bridge-utils</b> package and the machine booted up without network access.  In future I will setup xenbr1 (a device for private networking that is not connected to an Ethernet device) first and test it, if it works then there&#8217;s a good chance that the xenbr0 device (which is connected to the main Ethernet port of the machine) will work.</p>
<p>After getting the machine going I found a number of things that needed to be fixed with the Xen SE Linux policy.  Hopefully the release team will let me get another version of the policy into Lenny (the current one doesn&#8217;t work).</p>
<ul>
<li>[1]<a href="http://etbe.coker.com.au/2007/01/01/installing-xen-domu-on-debian-etch/"> http://etbe.coker.com.au/2007/01/01/installing-xen-domu-on-debian-etch/</a></li>
<li>[2]<a href="http://etbe.coker.com.au/2008/10/22/kernel-issues-with-debian-xen-and-centos-kernels/"> http://etbe.coker.com.au/2008/10/22/kernel-issues-with-debian-xen-and-centos-kernels/</a></li>
</ul>
<p>Related posts:</p><ol>
<li><a href='http://etbe.coker.com.au/2007/07/23/modules-and-nfs-for-xen/' rel='bookmark' title='Modules and NFS for Xen'>Modules and NFS for Xen</a> <small>I&#8217;m just in the process of converting a multi-user system...</small></li>
<li><a href='http://etbe.coker.com.au/2008/10/22/kernel-issues-with-debian-xen-and-centos-kernels/' rel='bookmark' title='Kernel issues with Debian Xen and CentOS Kernels'>Kernel issues with Debian Xen and CentOS Kernels</a> <small>Last time I tried using a Debian 64bit Xen kernel...</small></li>
<li><a href='http://etbe.coker.com.au/2007/11/07/xen-for-training/' rel='bookmark' title='Xen for Training'>Xen for Training</a> <small>I&#8217;m setting up a training environment based on Xen. The...</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://etbe.coker.com.au/2008/10/22/upgrading-a-server-to-64bit-xen/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Kernel issues with Debian Xen and CentOS Kernels</title>
		<link>http://etbe.coker.com.au/2008/10/22/kernel-issues-with-debian-xen-and-centos-kernels/</link>
		<comments>http://etbe.coker.com.au/2008/10/22/kernel-issues-with-debian-xen-and-centos-kernels/#comments</comments>
		<pubDate>Wed, 22 Oct 2008 04:25:49 +0000</pubDate>
		<dc:creator>etbe</dc:creator>
				<category><![CDATA[Virtualisation]]></category>
		<category><![CDATA[Best Posts]]></category>

		<guid isPermaLink="false">http://etbe.coker.com.au/?p=860</guid>
		<description><![CDATA[Last time I tried using a Debian 64bit Xen kernel for Dom0 I was unable to get it to work correctly, it continually gave kernel panics when doing any serious disk IO. I&#8217;ve just tried to reproduce that problem on a test machine with a single SATA disk and it seems to be working correctly [...]]]></description>
			<content:encoded><![CDATA[<p>Last time I tried using a Debian 64bit Xen kernel for Dom0 I was unable to get it to work correctly, it continually gave kernel panics when doing any serious disk IO.  I&#8217;ve just tried to reproduce that problem on a test machine with a single SATA disk and it seems to be working correctly so I guess that it might be related to using software RAID and LVM (LVM is really needed for Xen and RAID is necessary for every serious server IMHO).</p>
<p>To solve this I am now experimenting with using a CentOS kernel on Debian systems.</p>
<p>There are some differences between the kernels that are relevant, the most significant one is the choice of which modules are linked in to the kernel and which ones have to be loaded with modprobe.  The Debian choice is to have the drivers <b>blktap blkbk and netbk</b> linked in while the Red Hat / CentOS choice was to have them as modules.  Therefore the Debian Xen utilities don&#8217;t try and load those modules and therefore when you use the CentOS kernel without them loaded Xen simply doesn&#8217;t work.</p>
<p><b>Error: Device 0 (vif) could not be connected. Hotplug scripts not working.</b></p>
<p>You will get the above error (after a significant delay) from the command &#8220;<b>xm create -c name</b>&#8221; if you try and start a DomU that has networking when the driver <b>netbk</b> is not loaded.</p>
<p><b>XENBUS: Timeout connecting to device: device/vbd/768 (state 3)</b></p>
<p>You will get the above error (or something similar with a different device number) for every block device from the kernel of the DomU if using one of the Debian 2.6.18 kernels, if using a 2.6.26 kernel then you get &#8220;<b>XENBUS: Waiting for devices to initialise</b>&#8220;.</p>
<p>Also one issue to note is that when you use a <b>file:</b> block device (IE a regular file) then Xen will use a loopback device (internally it seems to only like block devices).  If you are having this problem and you destroy the DomU (or have it abort after trying for 300 seconds) then it will leave the loopback device enabled (it seems that the code for freeing resources in the error path is buggy).  I have filed <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503044">Debian bug report #503044 [1]</a> requesting that the Xen packages change the kernel configuration to allow more loopback devices and <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503046">Debian bug report #503046 [2]</a> requesting that the resources be freed correctly.</p>
<p>Finally the following messages appear in <b>/var/log/daemon.log</b> if you don&#8217;t have the driver <b>blktap</b> installed:<br />
<b>BLKTAPCTRL[2150]: couldn&#8217;t find device number for &#8216;blktap0&#8242;<br />
BLKTAPCTRL[2150]: Unable to start blktapctrl</b></p>
<p>It doesn&#8217;t seem to cause a problem (in my tests I can&#8217;t find something I want to do with Xen that required blktap), but I have loaded the driver &#8211; even removing error messages is enough of a benefit.</p>
<p>Another issue is that the CentOS kernel packages include a copy of the Xen kernel, so you have a Linux kernel matching the Xen kernel.  So of course it is tempting to try and run that CentOS Xen kernel on a Debian system.  Unfortunately the Xen utilities in Debian/Lenny don&#8217;t match the Xen kernel used for CentOS 5 and you get messages such as the following in <b>/var/log/xen/xend-debug.log</b>:</p>
<p><b>sysctl operation failed &#8212; need to rebuild the user-space tool set?<br />
Exception starting xend: (13, &#8216;Permission denied&#8217;)</b></p>
<p>Update: Added a reference to another Debian bug report.</p>
<ul>
<li>[1]<a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503044"> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503044</a></li>
<li>[2]<a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503046"> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503046</a></li>
</ul>
<p>Related posts:</p><ol>
<li><a href='http://etbe.coker.com.au/2007/04/23/first-look-at-centos-5-xen/' rel='bookmark' title='first look at CentOS 5 Xen'>first look at CentOS 5 Xen</a> <small>I have just installed a machine running CentOS 5 as...</small></li>
<li><a href='http://etbe.coker.com.au/2007/07/23/modules-and-nfs-for-xen/' rel='bookmark' title='Modules and NFS for Xen'>Modules and NFS for Xen</a> <small>I&#8217;m just in the process of converting a multi-user system...</small></li>
<li><a href='http://etbe.coker.com.au/2008/01/16/differences-between-distribution-kernels/' rel='bookmark' title='Differences between Distribution Kernels'>Differences between Distribution Kernels</a> <small>It is not uncommon to run a Linux system with...</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://etbe.coker.com.au/2008/10/22/kernel-issues-with-debian-xen-and-centos-kernels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming and Games for Children</title>
		<link>http://etbe.coker.com.au/2008/10/16/programming-games-children/</link>
		<comments>http://etbe.coker.com.au/2008/10/16/programming-games-children/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 03:32:10 +0000</pubDate>
		<dc:creator>etbe</dc:creator>
				<category><![CDATA[School]]></category>
		<category><![CDATA[Best Posts]]></category>

		<guid isPermaLink="false">http://etbe.coker.com.au/?p=853</guid>
		<description><![CDATA[The design of levels for computer games is a form of programming, particularly for games with deterministic NPCs. It seems to me that for a large portion of the modern computer user-base the design of games levels will be their first experience of programming computers, the people who don&#8217;t start programming by creating games levels [...]]]></description>
			<content:encoded><![CDATA[<p>The design of levels for computer games is a form of programming, particularly for games with deterministic NPCs.  It seems to me that for a large portion of the modern computer user-base the design of games levels will be their first experience of programming computers, the people who don&#8217;t start programming by creating games levels would be writing spread-sheets.  Probably a few people start programming by writing &#8220;batch files&#8221; and shell scripts, but I expect that they form a minute portion of the user-base.</p>
<p>I believe that learning some type of programming is becoming increasingly important, not just for it&#8217;s own sake (most people can get through their life quite well without doing any form of programming) but because of the sense of empowerment it gives.  A computer is not a mysterious magic box that sometimes does things you want and sometimes doesn&#8217;t!  It&#8217;s a complex machine that you can control.  Knowing that you can control it gives you more options even if you don&#8217;t want to program it yourself, little things like knowing that you have an option of using a different choice of software or paying someone to write new software open significant possibilities to computer use in business environments.</p>
<p>Games which involve strategic or tactical thought seem to have some educational benefit (which may or may not outweigh the negative aspects of games).  To empower children and take full advantage of the educational possibilities I think that there are some features that are needed in games.</p>
<p>Firstly levels that are created by the user need to be first class objects in the game.  Having a game menu provide the option of playing predefined levels or user-defined levels clearly shows to the user that their work is somehow less important than that of the game designer.  While the game designer&#8217;s work will tend to be of a higher quality (by objective measures), by the subjective opinion of the user their own work is usually the most important thing.  So when starting a game the user should be given a choice of levels (and/or campaigns) to play with their levels being listed beside the levels of the game creator.  Having the users levels displayed at the top of the list (before the levels from the game designer) is also a good thing.  Games that support campaigns should allow the user to create their own campaigns.</p>
<p>The KDE game <a href="http://games.kde.org/game.php?game=kgoldrunner">kgoldrunner [1]</a> is the best example I&#8217;ve seen of this being implemented correctly (there may be better examples but I don&#8217;t recall seeing them).</p>
<p>In kgoldrunner when you start a game the game(s) that you created are at the bottom of the list.  While I believe that it would be better to have my own games at the top of the list, having them in the same list is adequate.</p>
<p>When a user is playing the game they should be able to jump immediately from playing a level to editing it.  For example in kgoldrunner you can use the <b>Edit Any Level</b> menu option at any time while playing and it will default to allowing you to edit the level you are playing (and give you a hint that you have to save it to your own level).   This is a tremendous encouragement for editing levels, any time you play a level and find it too hard, too easy, or not aesthetically pleasing you can change it with a single menu selection!</p>
<p>When editing a level every option should have a description.  There should be no guessing as to what an item does &#8211; it should not be assumed that the user has played the game enough to fully understand how each primary object works.  Kgoldrunner provides hover text to describe the building blocks.</p>
<p>Operations that seem likely to be performed reasonably often should have menu options.  While it is possible to move a level by loading it and saving it, having a <b>Move Level</b> menu option (as kgoldrunner does) is a really good feature.  Kgoldrunner&#8217;s <b>Edit Next Level</b> menu option is also a good feature.</p>
<p>Finally a game should support sharing levels with friends.  While kgoldrunner is great it falls down badly in this area.  While it&#8217;s OK for a game to use multiple files for a campaign underneath the directory it uses for all it&#8217;s configuration, but it should be able to export a campaign to a single file for sharing.  Being able to hook in to a MUA to enable sending a campaign as a file attached to an email as a single operation would also be a good feature.  <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502372">I have filed Debian bug #502372 [2]</a> requesting this feature.</p>
<ul>
<li>[1]<a href="http://games.kde.org/game.php?game=kgoldrunner"> http://games.kde.org/game.php?game=kgoldrunner</a></li>
<li>[2]<a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502372"> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502372</a></li>
</ul>
<p>Related posts:</p><ol>
<li><a href='http://etbe.coker.com.au/2008/10/08/future-video-games/' rel='bookmark' title='Future Video Games'>Future Video Games</a> <small>I just watched an interesting TED.com talk about video games...</small></li>
<li><a href='http://etbe.coker.com.au/2007/07/16/documentaries-about-gifted-children/' rel='bookmark' title='Documentaries about Gifted Children'>Documentaries about Gifted Children</a> <small>On several occasions I have watched part of a TV...</small></li>
<li><a href='http://etbe.coker.com.au/2006/09/11/c-the-suit-and-tie-of-programming/' rel='bookmark' title='C &#8211; the suit and tie of programming'>C &#8211; the suit and tie of programming</a> <small>I was watching some music videos recently and was amazed...</small></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://etbe.coker.com.au/2008/10/16/programming-games-children/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

