<?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>IONCANNON &#187; system administration</title>
	<atom:link href="http://www.ioncannon.net/category/system-administration/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ioncannon.net</link>
	<description>Thoughts on Software Development and Engineering</description>
	<lastBuildDate>Tue, 03 Jan 2012 13:59:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<atom:link rel='hub' href='http://www.ioncannon.net/?pushpress=hub'/>
		<item>
		<title>Example Git pre-receive and post-receive Hooks to Avoid a Signal 13 Error</title>
		<link>http://www.ioncannon.net/system-administration/1362/example-git-pre-receive-and-post-receive-hooks-to-avoid-a-signal-13-error/</link>
		<comments>http://www.ioncannon.net/system-administration/1362/example-git-pre-receive-and-post-receive-hooks-to-avoid-a-signal-13-error/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 01:26:33 +0000</pubDate>
		<dc:creator>carson</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[hook]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/?p=1362</guid>
		<description><![CDATA[Git has a very nice set of example hooks that you can find just by creating a new repo. The following is an easy way to see them all: If you do that you will end up with a list something like this: I recently did this thinking I would create a pre-receive hook. Since [...]]]></description>
			<content:encoded><![CDATA[<p>Git has a very nice set of example hooks that you can find just by creating a new repo. The following is an easy way to see them all:</p>
<pre class="brush: bash; title: ; notranslate">
mkdir myrepo
cd myrepo
git init
ls .git/hooks/
</pre>
<p>If you do that you will end up with a list something like this:</p>
<pre class="brush: plain; title: ; notranslate">
applypatch-msg.sample  post-commit.sample   post-update.sample     pre-commit.sample          pre-rebase.sample
commit-msg.sample      post-receive.sample  pre-applypatch.sample  prepare-commit-msg.sample  update.sample
</pre>
<p>I recently did this thinking I would create a pre-receive hook. Since there isn&#039;t a sample for pre-receive I went to the <a href="http://book.git-scm.com/5_git_hooks.html">git hooks reference</a> to see if there was anything special I needed to know. I didn&#039;t pay any attention to the fact that git will send something in on STDIN when it runs the hook and as it turns out that is important. In some instances if you don&#039;t read STDIN you will get an error message like the following when you try to push and the hook gets used:</p>
<pre class="brush: plain; title: ; notranslate">
fatal: The remote end hung up unexpectedly
error: error in sideband demultiplexer
error:  died of signal 13
</pre>
<p>The fix for this is to make sure you read STDIN when creating pre-receive and post-receive hooks. The following example shell script will show the commit information for each new revision id when you push and the hook is executed:</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/sh
while read oldrev newrev refname
do
  # Do something with $oldrev $newrev $refname
  git show --no-color --root -s --pretty=medium $newrev
done
</pre>
<p>The key part in the above is the &#034;while read&#034; that reads STDIN. So whatever language you write your hook in just make sure you read everything from STDIN before completing the script.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/system-administration/1362/example-git-pre-receive-and-post-receive-hooks-to-avoid-a-signal-13-error/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Minimal EC2 Linux Install Using TTYLinux</title>
		<link>http://www.ioncannon.net/system-administration/1310/minimal_ec2_linux_install_using_ttylinux/</link>
		<comments>http://www.ioncannon.net/system-administration/1310/minimal_ec2_linux_install_using_ttylinux/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 17:22:10 +0000</pubDate>
		<dc:creator>carson</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ttylinux]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/?p=1310</guid>
		<description><![CDATA[If you have ever wondered how to get a Linux EC2 node down to the bare minimum this post is for you. I have been wanting to do this for a long time but it wasn&#039;t possible until pv-grub support that was added recently. To make this even more exciting Amazon now offers EC2 micro [...]]]></description>
			<content:encoded><![CDATA[<p>If you have ever wondered how to get a Linux EC2 node down to the bare minimum this post is for you. I have been wanting to do this for a long time but it wasn&#039;t possible until pv-grub support that was added recently. To make this even more exciting Amazon now offers <a href="http://aws.typepad.com/aws/2010/09/new-amazon-ec2-micro-instances.html">EC2 micro instances</a> that will go well with this type of bare bones system.</p>
<p>You may wonder why you would want to do this. I&#039;ll give you at least two reasons. First there is speed. The configuration I ended up with will boot in about 14 seconds. Almost all of that time is spent waiting on the AWS DHCP server for an IP address. The second reason is security. There is little on this system that you don&#039;t need. The majority of what you need is provided by a single application that you can easily monitor for patches. That leaves you to worry about only the tools you must have to get your job done. I&#039;ll also include a couple downsides. First this isn&#039;t going to be easy for everyone and it can be fairly complicated. The second issue you will run into is that there is nothing in this distribution. If you need something like PHP you might spend a long time building all the support you need. There isn&#039;t much to be done about the complexity if you want to do this all yourself. Selection of tools can help you lessen the impact of the bare nature of the system, more on that in a future post.</p>
<p><span id="more-1310"></span></p>
<p>I picked <a href="http://minimalinux.org/ttylinux/">TTYLinux</a> because that is what I&#039;m most familiar with. I have used it a number of times and I believe it may be the most basic of all the small Linux distros. It really is bare and the large majority of the features are provided by <a href="http://www.busybox.net/">BusyBox</a>. Before attempting to build your own instance it may help to read some of the TTYLinux documentation. Although I haven&#039;t tried I assume that other small distros like DSL would probably work with the same general instructions.</p>
<p>A couple important prerequisites are needed before starting this. First look at the How_To_Build_ttylinux.txt file that comes with the TTYLinux source. It contains a lot of information about how you go about building the system. Next look at my post on <a href="http://www.ioncannon.net/system-administration/1290/how-to-build-compile-a-custom-linux-kernel-for-ec2/">compiling the Linux kernel for EC2</a> because you will need to do that for this TTYLinux instance. Finally you need to have to have gcc, g++ and yacc available on the machine you are going to use to build on.</p>
<p>I have also created a public AMI that anyone can use with the name TTYLinuxBase and AMI ID of ami-0cfe0b65. Be sure to boot it with the correct hd0 kernel for your region. The password for root on this AMI is just password so be sure to change it when you fire it up. I have created the AMI so that the EBS volume gets deleted when it is terminated.</p>
<ol>
<li>Grab the source from <a href="http://minimalinux.org/ttylinux/source.html">the TTYLinux source page</a>:
<pre class="brush: plain; title: ; notranslate">
wget http://minimalinux.org/ttylinux/Download/ttylinux-src-mp3.tar.bz2
tar xvjf ttylinux-src-mp3.tar.bz2
</pre>
</li>
<li>The kernel that comes with the current version of TTYLinux isn&#039;t new enough to work on EC2 so the configuration and build scripts need to be changed to get a more recent version that will. The first step is to create a kernel configuration and put it in the correct location:
<pre class="brush: plain; title: ; notranslate">
ttylinux-src-mp3/config/platform_pc/kernel-2.6.35.4-i686.cfg
</pre>
<p>You can create this configuration by doing a make menuconfig on the kernel you want to use and then saving the kernel configuration to a file. You may also download the <a href="http://www.ioncannon.net/examples/ec2ttylinux/kernel-2.6.35.4-i686.cfg">kernel config</a> I used:</p>
<pre class="brush: plain; title: ; notranslate">
wget http://www.ioncannon.net/examples/ec2ttylinux/kernel-2.6.35.4-i686.cfg
cp kernel-2.6.35.4-i686.cfg ttylinux-src-mp3/config/platform_pc/kernel-2.6.35.4-i686.cfg
</pre>
<p>There is a lot of the kernel that can be pruned from the kernel configuration so if you do this by hand take time to turn things off that you won&#039;t need. Doing so will speed up the kernel compile and make the system boot faster. The above kernel configuration is pruned down quite a bit.
</li>
<li>Copy the packages configuration to one that matches the kernel version:
<pre class="brush: plain; title: ; notranslate">
cp ttylinux-src-mp3/config/platform_pc/packages-2.11-2.6.30.5.txt ttylinux-src-mp3/config/platform_pc/packages-2.11-2.6.35.4.txt
</pre>
</li>
<li>Modify the kernel build script to apply the XSAVE patch. Start by adding the following line to line 132 of the ttylinux-src-mp3/scripts/build-kernel.sh build script:
<pre class="brush: plain; title: ; notranslate">
patch -p1 &lt; /tmp/kernel.patch
</pre>
<p>You should end up with the following around it:</p>
<pre class="brush: plain; title: ; notranslate">
echo -n &quot;b.&quot; &gt;&amp;${CONSOLE_FD}
cp &quot;${kcfg}&quot; &quot;linux-${kver}/.config&quot;
cd &quot;linux-${kver}&quot;
patch -p1 &lt; /tmp/kernel.patch
sed --in-place scripts/mod/sumversion.c \
        --expression=&quot;s|&lt;string.h&gt;| &lt;limits.h&gt;\n#include &lt;string.h&gt;|&quot;
source &quot;${TTYLINUX_XTOOL_DIR}/_xbt_env_set&quot;
</pre>
<p>Create the patch file /tmp/kernel.patch with the following in it:</p>
<pre class="brush: plain; title: ; notranslate">
--- a/arch/x86/xen/enlighten.c  2010-08-05 20:35:13.000000000 -0400
+++ b/arch/x86/xen/enlighten.c  2010-08-05 20:35:22.000000000 -0400
@@ -776,6 +776,7 @@
 {
 	cr4 &amp;= ~X86_CR4_PGE;
 	cr4 &amp;= ~X86_CR4_PSE;
+	cr4 &amp;= ~X86_CR4_OSXSAVE;

 	native_write_cr4(cr4);
 }
</pre>
<p>Note that the above patch file has tabs in it. Make sure there is a tab before each cr4 line and the native_write_cr4 line or download the <a href="http://www.ioncannon.net/examples/ec2ttylinux/kernel.patch">kernel patch</a> file I created.
</li>
<li>Select the correct build target in the ttylinux-src-mp3/ttylinux.dist-config.sh file. Find the TTYLINUX_TARGET lines, comment them all out and then add the following line:
<pre class="brush: plain; title: ; notranslate">
TTYLINUX_TARGET=&quot;i686:pc:2.11-2.6.35.4&quot;
</pre>
</li>
<li>Set up the cross compile tools build directory:
<pre class="brush: plain; title: ; notranslate">
cp -Rp ttylinux-src-mp3/cross-tools-2.11-2.6.30.5/ ttylinux-src-mp3/cross-tools-2.11-2.6.35.4/
</pre>
<p>Find XBT_KERNEL in the script ttylinux-src-mp3/cross-tools-2.11-2.6.35.4/_scripts/xbt-versions.sh and change it to:</p>
<pre class="brush: plain; title: ; notranslate">
XBT_KERNEL=&quot;linux-2.6.35.4&quot;
</pre>
</li>
<li>Build the cross compile tools:
<pre class="brush: plain; title: ; notranslate">
cd ttylinux-src-mp3/cross-tools-2.11-2.6.35.4
make setup
make dload
make i686
cd ..
</pre>
</li>
<li>Build the entire TTYLinux distro:
<pre class="brush: plain; title: ; notranslate">
make dist
</pre>
<p>From this point the instructions are just like the last few posts I have made. The distribution created in here needs to be transferred to an EBS volume and made into an AMI.
</li>
<li>Using a temporary EC2 instance create a volume that will be used to boot the install and give it a file system:
<pre class="brush: plain; title: ; notranslate">
ec2-create-volume -z us-east-1a -s 1
ec2-attach-volume volume-id -i instance-id -d /dev/sdh
mkfs.ext3 /dev/sdh
</pre>
</li>
<li>Transfer the TTYLinux distribution image that was created to the temporary EC2 instance. Then copy the image to the boot volume:
<pre class="brush: plain; title: ; notranslate">
mkdir /mnt/dest
mkdir /mnt/src
mount /dev/sdh /mnt/dest
mount -o loop img/file_sys-i686-11.2.img /mnt/src
cd /mnt/src
find . | cpio -pvd /mnt/dest
cd -
cp config/boot/* /mnt/dest/boot/
umount /mnt/src
</pre>
<p>In the above the boot volume is mounted, the TTYLinux distribution image is mounted via a loop device and then all the files are copied from the image to the boot volume. I do a copy here because the default boot image that the TTYLinux build creates is only 8M and the smallest EBS volume you can create is 1G so it is better to use what you have to have.
</li>
<li>While the boot volume is mounted there are a number of things that need to be configured that are different than some of the previous examples of booting custom systems in EC2. First set the password for root by using chroot:
<pre class="brush: plain; title: ; notranslate">
chroot /mnt/dest/ passwd
</pre>
<p>Next change the root device in fstab:</p>
<pre class="brush: plain; title: ; notranslate">
cat &lt;&lt;EOF &gt; /mnt/dest/etc/fstab
/dev/xvda1    /            ext3       defaults                      0 0
tmpfs         /dev         tmpfs      noauto                        0 0
devpts        /dev/pts     devpts     gid=5,mode=0620               0 0
tmpfs         /dev/shm     tmpfs      rw,noexec,nosuid,size=24k     0 0
proc          /proc        proc       noauto                        0 0
sysfs         /sys         sysfs      noauto                        0 0
EOF
</pre>
<p>Then modify the inittab to only create one terminal:</p>
<pre class="brush: plain; title: ; notranslate">
cat &lt;&lt;EOF &gt; /mnt/dest/etc/inittab
::sysinit:/etc/rc.d/rc.sysinit

tty1::respawn:/sbin/getty 38400 tty1

::ctrlaltdel:/sbin/reboot
::shutdown:/etc/rc.d/rc.sysdone
EOF
</pre>
<p>Then configure the network to start on boot:</p>
<pre class="brush: plain; title: ; notranslate">
cat &lt;&lt;EOF &gt; /mnt/dest/etc/sysconfig/network-scripts/ifcfg-eth0
ENABLE=yes
NAME=Ethernet
IPADDRESS=192.168.1.20
CIDRLEN=24
NETWORK=192.168.1.0
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
BROADCAST=192.168.1.255
DHCP=yes
EOF
</pre>
<p>Finally, If you want to get rid of the warnings about setting the hardware clock you can edit /mnt/dest/etc/rc.d/rc.sysdone and comment out the part that tries to set it:</p>
<pre class="brush: plain; title: ; notranslate">
# Disabled for XenU use
#if [[ &quot;$(uname -m)&quot; != armv5tej* ]]; then
#     action $&quot;syncing hardware clock to system time&quot; hwclock ${HWCLOCKARGS}
#fi
</pre>
<p>and you will also want to do the same to /mnt/dest/etc/rc.d/rc.sysinit:</p>
<pre class="brush: plain; title: ; notranslate">
# Disabled for XenU
#if [[ &quot;$(uname -m)&quot; != armv5tej* ]]; then hwclock ${HWCLOCKARGS}; fi
</pre>
</li>
<li>To tell pv-grub what to boot you will need a /boot/grub/menu.lst file with the following in it:
<pre class="brush: plain; title: ; notranslate">
mkdir /mnt/dest/boot/grub

cat &lt;&lt;EOF &gt; /mnt/dest/boot/grub/menu.lst
default 0
timeout 0
title TTYOS
        root (hd0)
        kernel /boot/vmlinuz root=/dev/xvda1
EOF
</pre>
<p>Unmount the boot image:</p>
<pre class="brush: plain; title: ; notranslate">
umount /mnt/dest/
</pre>
</li>
<li>Snapshot the volume and register it as an AMI:
<pre class="brush: plain; title: ; notranslate">
ec2-create-snapshot -d &quot;Volume Description&quot; volume-id
ec2-register -n &quot;AMIName&quot; -d &quot;AMI Description&quot; --root-device-name /dev/sda1 -b /dev/sda1=snap-id:1:true
</pre>
</li>
<li>Boot it using the hd0 kernel for your region (in my case that is aki-407d9529):
<pre class="brush: plain; title: ; notranslate">
ec2-run-instances -z us-east-1a -g your-group -k your-keypair -n 1 --kernel pv-grub-kernel-id ami-from-step-13
</pre>
</li>
</ol>
<p>There are a few final notes that might be interesting. The smallest you can create is 1G and that is about 950M too large. This is probably not a real issue since you will most likely want space to put your application but it is interesting to note. The instructions assume you are building a i386 instance but they are almost the same for a 64 bit instance.</p>
<p>With the kernel config I provide you will see boot times from start to init in about 0.3 seconds. That is pretty fast. From init to login is fast as well but depends completely on how long it takes to get an IP from the DHCP server. This type of system could potentially boot in just a second or two if it didn&#039;t have to wait for any AWS parts.</p>
<p>A few people have created <a href="http://minimalinux.org/ttylinux/addons.html">TTY addons</a> to make compiling code for TTYLinux easier. You may want to check those out. Baring that you will find instructions on building anything with the cross compiling system in the TTYLinux howto documentation. Of course you may be able to bypass any pain there by compiling static binaries or even using something like Java.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/system-administration/1310/minimal_ec2_linux_install_using_ttylinux/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Build and Compile a Custom Linux Kernel for EC2</title>
		<link>http://www.ioncannon.net/system-administration/1290/how-to-build-compile-a-custom-linux-kernel-for-ec2/</link>
		<comments>http://www.ioncannon.net/system-administration/1290/how-to-build-compile-a-custom-linux-kernel-for-ec2/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 14:55:58 +0000</pubDate>
		<dc:creator>carson</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/?p=1290</guid>
		<description><![CDATA[I have a long running goal that I&#039;m trying to reach with all these pv-grub for EC2 posts. That goal is to find the smallest/tightest usable node that can be created for EC2. The next step in that path requires a custom Linux kernel. What follows is how to build the latest Linux kernel so [...]]]></description>
			<content:encoded><![CDATA[<p>I have a long running goal that I&#039;m trying to reach with all these <a href="http://aws.typepad.com/aws/2010/07/use-your-own-kernel-with-amazon-ec2.html">pv-grub for EC2</a> posts. That goal is to find the smallest/tightest usable node that can be created for EC2. The next step in that path requires a custom Linux kernel. What follows is how to build the latest Linux kernel so that it works on EC2 using pv-grub.</p>
<p>It is important to have a recent kernel since most of what is needed to get a kernel to work on EC2 is now incorporated into the source. These instructions assume the latest kernel is 2.6.35.4 and I&#039;ve used them with 2.6.35 as well but keep that in mind since the one patch that is required could eventually be merged in. Before getting started it may help to read over how to <a href="http://www.faqs.org/docs/Linux-HOWTO/Kernel-HOWTO.html">compile the Linux kernel</a> normally and then my post on <a href="http://www.ioncannon.net/system-administration/1205/installing-cent-os-5-5-on-ec2-with-the-cent-os-5-5-kernel/">running CentOS 5.5 on EC2 using pv-grub</a>.</p>
<p><span id="more-1290"></span></p>
<p>Before you begin you will need a place to build the kernel. For these instructions I used an EC2 instance to build the kernel but you don&#039;t have to. I also installed the kernel on the same EC2 instance when I was done. The AMI I used was Amazon&#039;s EBS boot starter ( ami-b232d0db : amazon/getting-started-with-ebs-boot ).</p>
<p>The following steps go over building and installing the kernel in detail:</p>
<ol>
<li>Download the latest <a href="http://www.kernel.org/">Linux kernel</a> or the version I&#039;m using:
<pre class="brush: plain; title: ; notranslate">
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.35.4.tar.bz2
</pre>
</li>
<li>Configure the source to run on EC2:
<pre class="brush: plain; title: ; notranslate">
make menuconfig
</pre>
<p>You will need to make sure the following options are set in the configuration:</p>
<ul>
<li>&#034;Processor type and features&#034; -> &#034;High Memory Support&#034; -> Make sure it is set to 64GB</li>
<li>&#034;Processor type and features&#034; -> &#034;PAE (Physical Address Extension) Support&#034; -> enable</li>
<li>&#034;Processor type and features&#034; -> &#034;Paravirtualized guest support&#034; -> enable</li>
<li>&#034;Processor type and features&#034; -> &#034;Paravirtualized guest support&#034; -> &#034;Xen guest support&#034; -> enable</li>
<li>&#034;Device Drivers&#034; -> &#034;Block devices&#034; -> &#034;Xen virtual block device support&#034; -> enable either as a module or built in</li>
<li>&#034;Device Drivers&#034; -> &#034;Network device support&#034; -> &#034;Xen network device frontend driver&#034; -> enable either as a module or built in</li>
</ul>
<p> <br/></p>
<p>If you want you can make the device drivers modules but you have to have them so it is probably best to just compile them into the kernel itself. If you want to compare your config file with the one I used you can download mine here: <a href="http://www.ioncannon.net/examples/ec2kernel/kernel-2.6.35.4-i686.config">kernel-2.6.35.4-i686.config</a>.</p>
<p>The starter AMI I used needed ncurses development libraries and gcc installed for menuconfig to work:</p>
<pre class="brush: plain; title: ; notranslate">
yum install ncurses-devel gcc
</pre>
<p>If you want to know a little more about what is being enabled in this step see the &#034;Building with domU support&#034; section of <a href="http://wiki.xensource.com/xenwiki/XenParavirtOps">XenParavirtOps</a>.
</li>
<li>Apply the following patch to disable XSAVE:
<pre class="brush: plain; title: ; notranslate">
--- a/arch/x86/xen/enlighten.c	2010-08-05 20:35:13.000000000 -0400
+++ b/arch/x86/xen/enlighten.c	2010-08-05 20:35:22.000000000 -0400
@@ -776,6 +776,7 @@
 {
 	cr4 &amp;= ~X86_CR4_PGE;
 	cr4 &amp;= ~X86_CR4_PSE;
+	cr4 &amp;= ~X86_CR4_OSXSAVE;

 	native_write_cr4(cr4);
 }

cd /path/to/root/of/kernel/source

patch -p1 &lt; /tmp/kernel.patch
</pre>
<p>Note that the above patch file has tabs in it. Make sure there is a tab before each cr4 line and the native_write_cr4 line. If you want to you can download a copy of the <a href="http://www.ioncannon.net/examples/ec2kernel/kernel.patch">patch with the tabs in it</a> to be sure.
</li>
<li>Build the kernel and install it if you are on the same machine you want to install it on. If you need help compiling the kernel refer to the kernel compile howto. <br/><br/>
<p>After this step you have a kernel, modules and initrd that you can use. The remaining steps go over using it.
</li>
<li>Configure the /boot/grub/menu.lst file on the target AMI to use the new kernel, the following is an example of the contents of the file:
<pre class="brush: plain; title: ; notranslate">
default 0
timeout 1
title Test
     root (hd0)
     kernel /boot/vmlinuz-2.6.35.4 root=/dev/xvda1
     initrd /boot/initrd-2.6.35.4.img
</pre>
<p>Note that the root device here is /dev/xvda1 instead of /dev/sda1. This is caused by the XSAVE patch.
</li>
<li>Verify that your /etc/fstab file is correct. If your previous root device was /dev/sda1 it is going to be /dev/xvda1 now. The contents of the fstab file I used follow:
<pre class="brush: plain; title: ; notranslate">
/dev/xvda1                              /                       ext3    defaults 1 1
/dev/mapper/swapVG-swapFS               swap                    swap    defaults 0 0
/dev/mapper/storageVG-storageFS         /mnt                    ext3    defaults 0 0
none                                    /dev/pts                devpts  gid=5,mode=620 0 0
none                                    /dev/shm                tmpfs   defaults 0 0
none                                    /proc                   proc    defaults 0 0
none                                    /sys                    sysfs   defaults 0 0
</pre>
</li>
<li>Make a snapshot of the volume and register it as an AMI:
<pre class="brush: plain; title: ; notranslate">
ec2-create-snapshot -d &quot;Snapshot Description&quot; volume-id
ec2-register -n &quot;CustomKernel&quot; -d &quot;Custom kernel AMI&quot; --root-device-name /dev/sda1 -b /dev/sda1=snap-id:15:true
</pre>
<p>Note that the devices here are /dev/sda1 and not /dev/xvda1. That is a little confusing but the AWS system doesn&#039;t see the devices in the same way your AMI will once it is booted.
</li>
<li>Start the instance. In my case using the hd0 pv-grub kernel:
<pre class="brush: plain; title: ; notranslate">
ec2-run-instances -z us-east-1a -g your-group -k your-keypair -n 1 --kernel aki ami-from-step-7
</pre>
</li>
</ol>
<p>If all goes well you should be able to run dmesg and see a boot message something like the following at the top:</p>
<pre class="brush: plain; title: ; notranslate">
Reserving virtual address space above 0xf5800000
Linux version 2.6.35.4 (root@domU) (gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)) #2 SMP Mon Aug 23 20:00:01 EDT 2010
BIOS-provided physical RAM map:
 Xen: 0000000000000000 - 00000000000a0000 (usable)
 Xen: 00000000000a0000 - 0000000000100000 (reserved)
 Xen: 0000000000100000 - 000000006a400000 (usable)
NX (Execute Disable) protection: active
...
</pre>
<p>With the ability to create a custom kernel for EC2 the next step is to prune the OS itself down to the bare minimum.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/system-administration/1290/how-to-build-compile-a-custom-linux-kernel-for-ec2/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Converting from VirtualBox or VMWare to EC2 now Easier than Ever</title>
		<link>http://www.ioncannon.net/system-administration/1246/converting-from-virtualbox-or-vmware-to-ec2-now-easier-than-ever/</link>
		<comments>http://www.ioncannon.net/system-administration/1246/converting-from-virtualbox-or-vmware-to-ec2-now-easier-than-ever/#comments</comments>
		<pubDate>Wed, 25 Aug 2010 13:19:48 +0000</pubDate>
		<dc:creator>carson</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[VirtualBox]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/?p=1246</guid>
		<description><![CDATA[The new PV-Grub ability introduced by Amazon for EC2 has opened the door for more than just custom kernels, it also makes it a lot easier to turn VirtualBox and VMWare instances into EC2 instances. In the past I have written about transfering VirtualBox images to Xen but to do that with EC2 required a [...]]]></description>
			<content:encoded><![CDATA[<p>The new PV-Grub ability introduced by Amazon for EC2 has opened the door for more than just custom kernels, it also makes it a lot easier to turn <a href="http://www.virtualbox.org/">VirtualBox</a> and <a href="http://www.vmware.com/">VMWare</a> instances into EC2 instances. In the past I have written about <a href="http://www.ioncannon.net/system-administration/80/how-to-transfer-linux-from-virtualbox-to-xen/">transfering VirtualBox images to Xen</a> but to do that with EC2 required a matching kernel exist for your VirtualBox installed OS that was blessed by Amazon. With PV-Grub as long as you can get a kernel for your existing system that is compatible with the EC2 infrastructure you can transfer it. A lot of the most popular distributions already have compatible kernels so that shouldn&#039;t be an issue and if you had to you could always compile the kernel by hand.</p>
<p>Some of what follows is exactly the same as my post about <a href="http://www.ioncannon.net/system-administration/1205/installing-cent-os-5-5-on-ec2-with-the-cent-os-5-5-kernel/">installing CentOS 5.5 on EC2 with the stock kernel</a>. Once you get the hang of it you can install just about anything Linux based to EC2. I&#039;ve broken this post into two parts to try and separate the generic transfer information from the specifics of an example. The first part that goes over the basics of what needs to be done to transfer any VirtualBox or VMWare box to EC2. The second part is an example of transferring an Ubuntu Server install to from VirtualBox to EC2. </p>
<p><span id="more-1246"></span></p>
<p>The following steps should work for any Linux OS but the main sticking point is that the kernel needs to be compatible with EC2 (see the <a href="http://aws.typepad.com/aws/2010/07/use-your-own-kernel-with-amazon-ec2.html">anouncment</a> for a list of some distros that have compatible kernels and remember you can always compile by hand as well).</p>
<ol>
<li>Make sure your VirtualBox or VMWare install has a kernel that is able to boot on EC2.</li>
<li>Make sure you have grub installed and set up your /boot/grub/menu.lst file to point to the correct Xen kernel and initrd file. See the Ubuntu instructions that follow for an example menu.lst.</li>
<li>Make sure you have your /boot directory in the correct place. If your disk is just one big partition you shouldn&#039;t need to do anything (use the hd0 PV-Grub kernel in the last step when booting). If you have a partition for /boot you will need to make sure it is the first partition on the disk and you will also need to copy the directory into /boot/boot so that the menu.lst file would be in /boot/boot/grub/menu.lst after the copy. For an example of this see the Ubuntu instructions that follow (use the hd00 PV-Grub kernel in the last step when booting).</li>
<li>Export the image to a raw form. This includes the partition table and everything. For VMWare you can use qemu-img to convert the VMDK to a raw image with the following command:
<pre class="brush: plain; title: ; notranslate">
   qemu-img convert -O raw vmware-image.vmdk myosimage.raw
</pre>
<p>Or if you are using VirtualBox you would use the VBoxManage command (I&#039;m currently using VirtualBox 3.2.6 and since the VBoxManage command has changed before that might be important for those reading this at a later date):</p>
<pre class="brush: plain; title: ; notranslate">
   VBoxManage internalcommands converttoraw myosimage.vdi myosimage.img
</pre>
<p>In both cases you should be able to run fdisk against the resulting raw image file and see a partition table:</p>
<pre class="brush: plain; title: ; notranslate">
   fdisk -lu myosimage.img
</pre>
</li>
<li>Create an EBS volume that is the same size or larger than the raw disk image created in step 4 and then attach it to a running EC2 instance:
<pre class="brush: plain; title: ; notranslate">
ec2-create-volume -z us-east-1a -s 2
ec2-attach-volume volume-id -i instance-id -d /dev/sdh
</pre>
<p>Note: The instance you attach the volume to is just a place used to copy the image file onto the volume. There is no need to be too picky about the type of instance it is as long as you have access to the dd command that should be all you need.
</li>
<li>Transfer the exported VirtualBox or VMWare disk image to the running EC2 instance created in step 5 and then copy it to the volume with the following dd command (this example assumes the volume is attached to the /dev/sdh device):
<pre class="brush: plain; title: ; notranslate">
dd if=myosimage.img of=/dev/sdh bs=10M
</pre>
<p>Note: It may make sense to compress your raw image before transferring it since any free space will be represented in the raw file and will compress down a lot.
</li>
<li>Make a snapshot of the volume:
<pre class="brush: plain; title: ; notranslate">
ec2-create-snapshot -d &quot;Volume Description&quot; volume-id
</pre>
</li>
<li>Register the snapshot as a new AMI:
<pre class="brush: plain; title: ; notranslate">
ec2-register -n &quot;AMIName&quot; -d &quot;AMI Description&quot; --root-device-name /dev/sda2 -b /dev/sda=snap-id:2:true
</pre>
</li>
<li>Boot the new AMI using the correct PV-Grub kernel. The correct kernel will depend on how your partition structure. For more information see the <a href="http://developer.amazonwebservices.com/connect/entry.jspa?categoryID=174&#038;externalID=3967">AWS PV-Grub documentation</a>. The main thing to know is that if you have /boot on its own partition use the hd00 kernel otherwise use the hd0 kernel:
<pre class="brush: plain; title: ; notranslate">
ec2-run-instances -z us-east-1a -g your-group -k your-keypair -n 1 --kernel pv-grub-kernel-id ami-from-step-19
</pre>
</li>
</ol>
<p>The following is a specific example of converting an existing <a href="http://www.ubuntu.com/server">Ubuntu 10.04 LTS Server</a> installed on VirtualBox to a bootable EC2 AMI. Note that steps 1 to 4 of the following create my &#034;existing&#034; Ubuntu Server so skip those if you have something that already exists. The last portion of this will look just like the above generic steps:</p>
<ol>
<li>Use the Ubuntu Server ISO to install Ubuntu on a fresh VirtualBox VM. For this example I used 512M of memory and a 2G disk. This is what my VirtualBox setup looked like:<br/><br/>
<p><a href="http://www.ioncannon.net/wp-content/uploads/2010/08/EC2UbuntuVMSummary.png"><img src="http://www.ioncannon.net/wp-content/uploads/2010/08/EC2UbuntuVMSummary.png" alt="" title="EC2 Ubuntu VirtualBox Summary" width="699" height="453" class="alignnone size-full wp-image-1248" /></a>
</li>
<li>Because I wanted /boot to be on its own partition I used the manual partition creation option:<br/><br/>
<p><a href="http://www.ioncannon.net/wp-content/uploads/2010/08/EC2UbuntuManualPartitions.png"><img src="http://www.ioncannon.net/wp-content/uploads/2010/08/EC2UbuntuManualPartitions.png" alt="" title="EC2 Ubuntu Manual Partitions" width="648" height="555" class="alignnone size-full wp-image-1251" /></a></p>
<p>You don&#039;t have to do this but I wanted these instructions to align with my previous post for CentOS 5.5. In this case I made the first partition mount at /boot and the second partition was everything else mounted at / and the result looked like:<br/></p>
<p><a href="http://www.ioncannon.net/wp-content/uploads/2010/08/EC2UbuntuPartitionTable.png"><img src="http://www.ioncannon.net/wp-content/uploads/2010/08/EC2UbuntuPartitionTable.png" alt="" title="EC2 Ubuntu Partition Table" width="648" height="555" class="alignnone size-full wp-image-1249" /></a></p>
<p>Notice that I didn&#039;t include any swap, that is something you probably want to put on the EC2 instance&#039;s ephemeral storage.
</li>
<li>For Ubuntu you are prompted to install other software after the base install and setting up a user. Make sure you install OpenSSH server:<br/><br/>
<p><a href="http://www.ioncannon.net/wp-content/uploads/2010/08/EC2UbuntuOpenSSHServer.png"><img src="http://www.ioncannon.net/wp-content/uploads/2010/08/EC2UbuntuOpenSSHServer.png" alt="" title="EC2 Ubuntu OpenSSH Server" width="648" height="555" class="alignnone size-full wp-image-1250" /></a>
</li>
<li>When prompted to install grub answer yes.</li>
<li>At this point you should have a bootable Ubuntu system either from following the previous steps or from an existing bootable install. You will need to install the libuuid-perl package so that the EC2 compatible Xen kernels will be installable:
<pre class="brush: plain; title: ; notranslate">
   sudo apt-get install libuuid-perl
</pre>
</li>
<li>Grab a Xen kernel and initrd that are compatible with EC2:
<pre class="brush: plain; title: ; notranslate">
wget http://ftp.debian.org/debian/pool/main/l/linux-2.6/linux-base_2.6.32-20_all.deb
wget http://ftp.debian.org/debian/pool/main/l/linux-2.6/linux-image-2.6.32-5-xen-686_2.6.32-20_i386.deb

sudo dpkg -i linux-base_2.6.32-20_all.deb linux-image-2.6.32-5-xen-686_2.6.32-20_i386.deb
</pre>
<p>Notes: I was unable to find a compatible kernel that was apt-get installable from Ubuntu and that is why I grab the two above from the Debian site. Also, If you want to continue to boot the system outside of EC2 then make sure to edit the /boot/grub/grub.cfg file so that it has the correct kernel set to boot by default.
</li>
<li>Create a menu.lst file that points to the correct kernel and initrd that were just installed:
<pre class="brush: plain; title: ; notranslate">
   sudo vi /boot/grub/menu.lst
</pre>
<p>For this example mine contains:</p>
<pre class="brush: plain; title: ; notranslate">
default 0
timeout 1
title UBEC2
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.32-5-xen-686 root=/dev/xvda2
        initrd /boot/initrd.img-2.6.32-5-xen-686
</pre>
<p>Notes: The grub root command is pointing to hard disk 0 and partition 0 because I put the boot directory on the first partition. The root parameter for the kernel is pointing to /dev/xvda2 and not /dev/sda2 because the kernel patch to disable XSAVE changes the names of the devices.
</li>
<li>Copy everything from /boot into /boot/boot, this is just the easiest way of making things work since EC2 PV-Grub looks for the menu.lst file /boot/boot/grub/ when you specify the hd00 kernel:
<pre class="brush: plain; title: ; notranslate">
sudo cp -Rp /boot/ /boot/boot
</pre>
</li>
<li>Shut the VirtualBox system down and extract the hard drive image with the following command:
<pre class="brush: plain; title: ; notranslate">
VBoxManage internalcommands converttoraw ~/.VirtualBox/HardDisks/YourHardDiskName.vdi /tmp/myosimage.img
</pre>
<p>Notes: The raw image that results will be the full size of the disk as it was seen by VirtualBox so if you have a lot of free disk space on your image you will probably want to compress it before you transfer it to EC2. At this point the commands are exactly as they are for the generic instructions above.
</li>
<li>Start a temporary EC2 instance and transfer your image:
<pre class="brush: plain; title: ; notranslate">
ec2-run-instances -z us-east-1a -g your-group -k your-keypair -n 1 ami-84db39ed
</pre>
</li>
<li>Create an EBS volume of the correct size to put your image onto and attach it to the previously created temporary EC2 instance:
<pre class="brush: plain; title: ; notranslate">
ec2-create-volume -z us-east-1a -s 2
ec2-attach-volume volume-id -i instance-id -d /dev/sdh
</pre>
</li>
<li>Transfer the image to the volume:
<pre class="brush: plain; title: ; notranslate">
dd if=myosimage.img of=/dev/sdh bs=10M
</pre>
</li>
<li>Create a snapshot of the volume:
<pre class="brush: plain; title: ; notranslate">
ec2-create-snapshot -d &quot;Volume Description&quot; volume-id
</pre>
</li>
<li>Register the snapshot as an AMI:
<pre class="brush: plain; title: ; notranslate">
ec2-register -n &quot;AMIName&quot; -d &quot;AMI Description&quot; --root-device-name /dev/sda2 -b /dev/sda=snap-id:2:true
</pre>
</li>
<li>Boot the AMI:
<pre class="brush: plain; title: ; notranslate">
ec2-run-instances -z us-east-1a -g your-group -k your-keypair -n 1 --kernel pv-grub-kernel-id ami-from-step-19
</pre>
<p>Note: Because the partition table contains /boot on hd00 I used the kernel named aki-4c7d9525 for the east region.
</li>
</ol>
<p>Once you get the hang of transferring the image these steps aren&#039;t as complicated as they seem. It may help to imagine the extracted disk image as a physical hard drive that you are moving around. The main pain points are selecting the correct PV-Grub kernel and making sure your grub menu.lst file is in the correct location on the partition.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/system-administration/1246/converting-from-virtualbox-or-vmware-to-ec2-now-easier-than-ever/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Installing Cent OS 5.5 on EC2 with the Cent OS 5.5 Kernel</title>
		<link>http://www.ioncannon.net/system-administration/1205/installing-cent-os-5-5-on-ec2-with-the-cent-os-5-5-kernel/</link>
		<comments>http://www.ioncannon.net/system-administration/1205/installing-cent-os-5-5-on-ec2-with-the-cent-os-5-5-kernel/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 10:51:37 +0000</pubDate>
		<dc:creator>carson</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/?p=1205</guid>
		<description><![CDATA[Amazon recently introduced the ability to boot a custom kernel using pv-grub on EC2. This opens the door for all kinds of interesting ideas that I&#039;ve been thinking about for a while, like seeing if I can boot right into a web server and skip all that extra junk that comes with Linux distributions, but [...]]]></description>
			<content:encoded><![CDATA[<p>Amazon recently introduced the ability to <a href="http://aws.typepad.com/aws/2010/07/use-your-own-kernel-with-amazon-ec2.html">boot a custom kernel</a> using pv-grub on EC2. This opens the door for all kinds of interesting ideas that I&#039;ve been thinking about for a while, like seeing if I can boot right into a web server and skip all that extra junk that comes with Linux distributions, but that is just me. The main door it is going to open for most people interested in EC2 will be the ability to upgrade the kernel that comes with their distribution. That brings us to how to install Cent OS 5.5 on EC2 and use the kernel that is part of the distribution.</p>
<p>For those who might just be interested in booting a custom kernel using EC2 pv-grub I will try to produce a few more posts with more details on that but for now here are the main things to know:</p>
<ul>
<li>The pv-grup kernels named with hd00 will look on the first partition of the registered device in the /boot/boot/grub directory for a menu.lst file. Use this type of kernel if you create want to use a partitioned disk.</li>
<li>The pv-grup kernels named with hd0 will look on the registered device in the /boot/grub directory for a menu.lst file. Use this type of kernel if you don&#039;t have a partition on your disk.</li>
<li>You won&#039;t get anything meaningful back from the boot attempt if your grub menu.lst file is in the wrong place or is not valid. See the end of the post for what a pv-grub error message looks like and some tips on what to do if you see it.</li>
<li>The kernel you use does matter but the current mainline Linux kernel (2.6.35) contains everything you need except for a small change to turn off XSAVE. The main thing to know is that not every distribution may have made the change needed to work on EC2.</li>
<li>I have tried non-Linux kernels to no avail. See the end of the post for a little more information.</li>
</ul>
<p><span id="more-1205"></span></p>
<p>A lot of what follows is similar, both steps and concepts, to the &#034;from scratch&#034; section of my post on <a href="http://www.ioncannon.net/system-administration/894/fedora-12-bootable-root-ebs-on-ec2/">Fedora 12 on EC2 using a root EBS</a>. I&#039;ve also bundled all the instance building commands up into one <a href="http://www.ioncannon.net/examples/centos5.5.sh">script (centos5.5.sh)</a>. If you want to use that script then do 1 and 2 of what follows, make sure to change the password used for root in the script and then pick back up at 18. The following steps should not be taken as the only way to do this but more of a recipe:</p>
<ol>
<li>
Start an EC2 instance that has yum on it to be used as a setup box. A RedHat based box, Fedora or CentOS will work best unless you want to install yum. For the following steps I used a Fedora 8 based EC2 node.</p>
<pre class="brush: plain; title: ; notranslate">
ec2-run-instances -z us-east-1a -g your-group -k your-keypair -n 1 ami-84db39ed
</pre>
</li>
<li>
Create a new EBS volume to install to and map it to the running instance from step 1. Your volume should be greater than 2G for a base install. I mapped this new volume to the /dev/sdh device on the setup machine so you will notice that in the following steps (if you are using the script you will want to make sure you map to /dev/sdh as well):</p>
<pre class="brush: plain; title: ; notranslate">
ec2-create-volume -z us-east-1a -s 2
ec2-attach-volume volume-id -i instance-id -d /dev/sdh
</pre>
</li>
<li>
<p>Create a <a href="http://tldp.org/HOWTO/Partition/fdisk_partitioning.html">partion table using fdisk</a> on the volume you are going to install to.</p>
<p>I created both a /boot and / partion on /dev/sdh1 and /dev/sdh2 respecivly. I also made the /dev/sdh1 partition active so it is exactly as it would be if it had been installed on a real machine.</p>
<p>Note that this step is optional but I am going to include it because I think it makes for a more natural setup and is more in line with what you would get if you did a VirtualBox install and then transfered the image.
</li>
<li>
Format your partition(s) and mount them into /mnt. For me that was done with the following:</p>
<pre class="brush: plain; title: ; notranslate">
echo &quot;y&quot; | mkfs.ext3 /dev/sdh1
echo &quot;y&quot; | mkfs.ext3 /dev/sdh2
mount /dev/sdh2 /mnt
mkdir /mnt/boot
mkdir /mnt/dev
mkdir /mnt/proc
mkdir /mnt/etc
mount /dev/sdh1 /mnt/boot
mount -t proc none /mnt/proc
</pre>
</li>
<li>
Create a base device setup for the new instance:</p>
<pre class="brush: plain; title: ; notranslate">
for i in console null zero ; do /sbin/MAKEDEV -d /mnt/dev -x $i ; done
</pre>
</li>
<li>
Create a base fstab file in /mnt/etc/fstab. The following is the one I used:</p>
<pre class="brush: plain; title: ; notranslate">
/dev/sda1               /boot                   ext3    defaults 1 1
/dev/sda2               /                       ext3    defaults 1 2
none                    /dev/pts                devpts  gid=5,mode=620 0 0
none                    /dev/shm                tmpfs   defaults 0 0
none                    /proc                   proc    defaults 0 0
none                    /sys                    sysfs   defaults 0 0
/dev/sdc1               /mnt                    ext3    defaults 0 0
/dev/sdc2               swap                    swap    defaults 0 0
</pre>
</li>
<li>
Create the yum repo configuration, prepare for the yum install and then install the base OS onto the new volume.<br/><br/></p>
<p>The following is the yum configuration file I used:</p>
<pre class="brush: plain; title: ; notranslate">
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
exclude=*-debuginfo
gpgcheck=0
obsoletes=1
reposdir=/dev/null

[os]
name=CentOS 5.5 - i386 - OS
mirrorlist=http://mirrorlist.centos.org/?release=5&amp;arch=i386&amp;repo=os
enabled=1

[updates]
name=CentOS 5.5 - i386 - Updates
mirrorlist=http://mirrorlist.centos.org/?release=5&amp;arch=i386&amp;repo=updates
enabled=1
</pre>
<p>The following command will install the base of Cent OS 5.5 into /mnt (note that I created the above config file as /tmp/yumec2.conf):</p>
<pre class="brush: plain; title: ; notranslate">
yum -c /tmp/yumec2.conf --installroot=/mnt -y groupinstall Base
</pre>
</li>
<li>
Install sshd, grub, the Cent OS Xen kernel and then clean the repo to free up disk space:</p>
<pre class="brush: plain; title: ; notranslate">
yum -c /tmp/yumec2.conf --installroot=/mnt -y install openssh-server
yum -c /tmp/yumec2.conf --installroot=/mnt -y install grub
yum -c /tmp/yumec2.conf --installroot=/mnt -y install kernel-xen.i686

yum -c /tmp/yumec2.conf --installroot=/mnt -y clean packages
</pre>
</li>
<li>
Disable DNS checks and allow root to log in via SSH:</p>
<pre class="brush: plain; title: ; notranslate">
echo &quot;UseDNS no&quot; &gt;&gt; /mnt/etc/ssh/sshd_config
echo &quot;PermitRootLogin yes&quot; &gt;&gt; /mnt/etc/ssh/sshd_config
</pre>
</li>
<li>
Set up networking by creating the /mnt/etc/sysconfig/network file. The contents for this example are:</p>
<pre class="brush: plain; title: ; notranslate">
NETWORKING=yes
</pre>
<p>As well as the /mnt/etc/sysconfig/network-scripts/ifcfg-eth0 file. The contents for this example are:</p>
<pre class="brush: plain; title: ; notranslate">
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet
USERCTL=yes
PEERDNS=yes
IPV6INIT=no
</pre>
</li>
<li>
I&#039;m not sure if this is needed still but in the past there have been some /dev file missing on boot so I always add the following to the startup script to make sure they are available. The first two are the random devices and the last three are where the ephimeral drive is usually mapped:</p>
<pre class="brush: plain; title: ; notranslate">
echo &quot;/sbin/MAKEDEV /dev/urandom&quot; &gt;&gt; /mnt/etc/rc.sysinit
echo &quot;/sbin/MAKEDEV /dev/random&quot; &gt;&gt; /mnt/etc/rc.sysinit
echo &quot;/sbin/MAKEDEV /dev/sdc&quot; &gt;&gt; /mnt/etc/rc.sysinit
echo &quot;/sbin/MAKEDEV /dev/sdc1&quot; &gt;&gt; /mnt/etc/rc.sysinit
echo &quot;/sbin/MAKEDEV /dev/sdc2&quot; &gt;&gt; /mnt/etc/rc.sysinit
</pre>
</li>
<li>
Change the root password for the new instance. This is optional as you could create scripts to download your SSH key from EC2 but for these instructions setting the root password is the easiest:</p>
<pre class="brush: plain; title: ; notranslate">
chroot /mnt
pwconv
passwd
exit
</pre>
</li>
<li>
Change the network settings so that the NetworkManager is off and network is on</p>
<pre class="brush: plain; title: ; notranslate">
chroot /mnt chkconfig --level 2345 NetworkManager off
chroot /mnt chkconfig --level 2345 network on
</pre>
</li>
<li>
Disable a few things that are enabled by default but won&#039;t do any good for an EC2 instance:</p>
<pre class="brush: plain; title: ; notranslate">
chroot /mnt chkconfig --level 2345 avahi-daemon off
chroot /mnt chkconfig --level 2345 firstboot off
</pre>
</li>
<li>
The stock CentOS Xen initrd doesn&#039;t load the Xen block or net drivers and those are required to boot. I unpacked the installed initrd and created a modified version by hand using the following commands (note that as soon as the CentOS Xen kernel version changes this will stop functioning):</p>
<pre class="brush: plain; title: ; notranslate">
cp /mnt/boot/initrd-2.6.18-194.8.1.el5xen.img /mnt/boot/initrd-2.6.18-194.8.1.el5xen.img.orig
mkdir /tmp/initrdextract
cd /tmp/initrdextract
gzip -dc /mnt/boot/initrd-2.6.18-194.8.1.el5xen.img | cpio -id
cp /mnt/lib/modules/2.6.18-194.8.1.el5xen/kernel/drivers/xen/blkfront/xenblk.ko lib
cp /mnt/lib/modules/2.6.18-194.8.1.el5xen/kernel/drivers/xen/netfront/xennet.ko lib
chmod -x lib/xenblk.ko
chmod -x lib/xennet.ko
cat &lt;&lt;EOL &gt; init
#!/bin/nash

mount -t proc /proc /proc
setquiet
echo Mounting proc filesystem
echo Mounting sysfs filesystem
mount -t sysfs /sys /sys
echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
mkdir /dev/shm
mkdir /dev/mapper
echo Creating initial device nodes
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mknod /dev/urandom c 1 9
mknod /dev/systty c 4 0
mknod /dev/tty c 5 0
mknod /dev/console c 5 1
mknod /dev/ptmx c 5 2
mknod /dev/rtc c 10 135
mknod /dev/tty0 c 4 0
mknod /dev/tty1 c 4 1
mknod /dev/tty2 c 4 2
mknod /dev/tty3 c 4 3
mknod /dev/tty4 c 4 4
mknod /dev/tty5 c 4 5
mknod /dev/tty6 c 4 6
mknod /dev/tty7 c 4 7
mknod /dev/tty8 c 4 8
mknod /dev/tty9 c 4 9
mknod /dev/tty10 c 4 10
mknod /dev/tty11 c 4 11
mknod /dev/tty12 c 4 12
mknod /dev/ttyS0 c 4 64
mknod /dev/ttyS1 c 4 65
mknod /dev/ttyS2 c 4 66
mknod /dev/ttyS3 c 4 67
echo Setting up hotplug.
hotplug
echo Creating block device nodes.
mkblkdevs
echo &quot;Loading jbd.ko module&quot;
insmod /lib/jbd.ko
echo &quot;Loading ext3.ko module&quot;
insmod /lib/ext3.ko
echo &quot;Loading xenblk.ko module&quot;
insmod /lib/xenblk.ko
echo &quot;Loading xennet.ko module&quot;
insmod /lib/xennet.ko
mkblkdevs
echo Scanning and configuring dmraid supported devices
resume /dev/sdc2
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/sda1
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
setuproot
echo Switching to new root and running init.
switchroot
EOL
find ./ | cpio -H newc -o | gzip &gt; /mnt/boot/initrd-2.6.18-194.8.1.el5xen.img
cd -
</pre>
</li>
<li>
Install grub on the new instance, move the boot directory into a subdirectory and create a grub menu.lst file that points to the CentOS kernel and initrd file:</p>
<pre class="brush: plain; title: ; notranslate">
chroot /mnt grub-install /dev/sdh

mkdir /mnt/boot/boot/
mv /mnt/boot/* /mnt/boot/boot/ 2&gt; /dev/null &gt; /dev/null
</pre>
<p>Put the following in /mnt/boot/boot/grub/menu.lst  (note that as soon as the CentOS Xen kernel version changes this will be incorrect):</p>
<pre class="brush: plain; title: ; notranslate">
default 0
timeout 1
title CentOS5.5
     root (hd0,0)
     kernel /boot/vmlinuz-2.6.18-194.8.1.el5xen root=/dev/sda2
     initrd /boot/initrd-2.6.18-194.8.1.el5xen.img
</pre>
<p>Note that this goes in /mnt/boot/boot/grub and that isn&#039;t the normal spot you would expect it in. This is where the AWS EC2 pv-grub expects to find the file on the first partition and moving the boot directory around just keeps everything in line with those expectations.
</li>
<li>
Make sure everything is written to disk and unmount the volume. At this point you have a CentOS 5.5 install that is almost ready to boot.</p>
<pre class="brush: plain; title: ; notranslate">
sync
umount /mnt/proc
umount /mnt/boot
umount /mnt
</pre>
</li>
<li>
Make a snapshot of the volume you just installed to, you will need to volume ID that came from step 2:</p>
<pre class="brush: plain; title: ; notranslate">
ec2-create-snapshot -d &quot;Volume Description&quot; volume-id
</pre>
</li>
<li>
Use the snapshot from step 18 along with the ec2-register command to register your instance:</p>
<pre class="brush: plain; title: ; notranslate">
ec2-register -n &quot;AMIName&quot; -d &quot;AMI Description&quot; --root-device-name /dev/sda2 -b /dev/sda=snap-id:2:true
</pre>
<p>There are a number of things to take note of with the above command:</p>
<ol>
<li>Running this command will result in output something like: IMAGE   ami-a5ae9bb</li>
<li>The -b option can now assign a snapshot to a block device, the options in this example tell EC2 to generate 2G of space for the snapshot and to delete the volume it creates from the snapshot if the instance terminates. If you plan to use an instance long term you should replace that true at the end with a false to keep EC2 from deleting the volume when the instance terminates.</li>
<li>Notice that the -b option is assigning the snapshot to the device and not to a partition of the device, that is /dev/sda instead of /dev/sda1. You can still assign a snapshot directly to a partition but now you can also assign a block device to a raw partitioned disk. Because I created the partition table earlier the snapshot is the raw disk device here.</li>
<li>Also note that we are missing the kernel configuration option. As of this post using it with a pv-grub kernel causes the register command to fail. It isn&#039;t a big issue but just keep that in mind when you fire the AMI up otherwise it won&#039;t boot with the correct pv-grub kernel.</li>
</ol>
<p><br/>
</li>
<li>
Start an instance of the fresh CentOS 5.5 install. One key thing here is picking the correct pv-grub kernel to boot from. There are currently 4 different kernels at each location, see the <a href="http://developer.amazonwebservices.com/connect/entry.jspa?categoryID=174&#038;externalID=3967">Enabling User Provided Kernels in Amazon EC2</a> document for a full list of kernels in each availability zone. In this case because the root disk was created with a partition table I used the &#034;ec2-public-images/pv-grub-hd00-V1.01-i386.gz.manifest.xml&#034; kernel to boot with (on US-East-1 that is kernel id aki-4c7d9525). For example:</p>
<pre class="brush: plain; title: ; notranslate">
ec2-run-instances -z us-east-1a -g your-group -k your-keypair -n 1 --kernel pv-grub-kernel-id ami-from-step-19
</pre>
</li>
</ol>
<p><b>Tips on debugging the boot process</b></p>
<p>If your instance won&#039;t boot you can use the ec2-get-console-output command to get the console output created from the pv-grub boot process. If your console output ends up like the following there are a number of things you may have done wrong.</p>
<ul>
<li>You may have selected the wrong kernel and it is trying to boot from a non-existant partition. Make sure you are using the correct pv-grub kernel hd0 vs hd00.</li>
<li>You forgot to install grub or installed grub in the wrong place. Make sure you have either /boot/grub/menu.lst or /boot/boot/grub/menu.lst</li>
<li>You have a bad menu.lst file. One mistake I made was giving a boot item a title with a space in it. Make the menu.lst as simple as you can until you get it to boot.</li>
</ul>
<pre class="brush: plain; title: ; notranslate">
    Xen Minimal OS!
  start_info: 0xb10000(VA)
    nr_pages: 0x6a400
  shared_inf: 0x002f9000(MA)
     pt_base: 0xb13000(VA)
nr_pt_frames: 0x9
    mfn_list: 0x967000(VA)
   mod_start: 0x0(VA)
     mod_len: 0
       flags: 0x0
    cmd_line:  root=/dev/sda1 ro 4
  stack:      0x946780-0x966780
MM: Init
      _text: 0x0(VA)
     _etext: 0x621f5(VA)
   _erodata: 0x76000(VA)
     _edata: 0x7b6d4(VA)
stack start: 0x946780(VA)
       _end: 0x966d34(VA)
  start_pfn: b1f
    max_pfn: 6a400
Mapping memory range 0xc00000 - 0x6a400000
setting 0x0-0x76000 readonly
skipped 0x1000
MM: Initialise page allocator for e6c000(e6c000)-0(6a400000)
MM: done
Demand map pfns at 6a401000-7a401000.
Heap resides at 7a402000-ba402000.
Initialising timer interface
Initialising console ... done.
gnttab_table mapped at 0x6a401000.
Initialising scheduler
Thread &quot;Idle&quot;: pointer: 0x7a402008, stack: 0x6a030000
Initialising xenbus
Thread &quot;xenstore&quot;: pointer: 0x7a402478, stack: 0x6a040000
Dummy main: start_info=0x966880
Thread &quot;main&quot;: pointer: 0x7a4028e8, stack: 0x6a050000
&quot;main&quot; &quot;root=/dev/sda1&quot; &quot;ro&quot; &quot;4&quot;
vbd 2048 is hd0
******************* BLKFRONT for device/vbd/2048 **********

backend at /local/domain/0/backend/vbd/2111/2048
Failed to read /local/domain/0/backend/vbd/2111/2048/feature-barrier.
Failed to read /local/domain/0/backend/vbd/2111/2048/feature-flush-cache.
12582912 sectors of 0 bytes
**************************
vbd 2051 is hd1
******************* BLKFRONT for device/vbd/2051 **********

backend at /local/domain/0/backend/vbd/2111/2051
Failed to read /local/domain/0/backend/vbd/2111/2051/feature-barrier.
Failed to read /local/domain/0/backend/vbd/2111/2051/feature-flush-cache.
1835008 sectors of 0 bytes
**************************

    [H
    [J

    GNU GRUB  version 0.97  (1740800K lower / 0K upper memory)

       [ Minimal BASH-like line editing is supported.   For

         the   first   word,  TAB  lists  possible  command

         completions.  Anywhere else TAB lists the possible

         completions of a device/filename. ]

grubdom&gt;
    [9;10H
</pre>
<p><br/><br/></p>
<p><b>Booting non-Linux OSes with EC2</b></p>
<p>I have attempted both FreeBSD and NetBSD in particular with no luck. </p>
<p>FreeBSD is tricky because it really wants to use its loader and while you can do that with the grub chainloader command it results in a grub error from EC2 about needing to load the kernel before booting:</p>
<pre class="brush: plain; title: ; notranslate">
root (hd0,1)

 Filesystem type unknown, partition type 0xa5

chainloader +1

Error 8: Kernel must be loaded before booting

Press any key to continue...
</pre>
<p>I was also able to try a modified version of FreeBSD that should boot without the loader but with that I get an error claiming the kernel isn&#039;t bziped:</p>
<pre class="brush: plain; title: ; notranslate">
root (hd0,1,a)

 Filesystem type is ufs2, partition type 0xa5

kernel /boot/loader

xc_dom_probe_bzimage_kernel: kernel is not a bzImage
ERROR Invalid kernel: xc_dom_find_loader: no loader found

xc_dom_core.c:523: panic: xc_dom_find_loader: no loader found
xc_dom_parse_image returned -1

Error 9: Unknown boot failure

Press any key to continue...
</pre>
<p>For NetBSD the result is actually a completely blank console log so I assume it causes some catastrophic failure that keeps the EC2 system from even being able to pull back a log.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/system-administration/1205/installing-cent-os-5-5-on-ec2-with-the-cent-os-5-5-kernel/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Upgrade to Fedora 13 from Fedora 12</title>
		<link>http://www.ioncannon.net/system-administration/1136/upgrade-to-fedora-13-from-fedora-12/</link>
		<comments>http://www.ioncannon.net/system-administration/1136/upgrade-to-fedora-13-from-fedora-12/#comments</comments>
		<pubDate>Thu, 27 May 2010 10:53:40 +0000</pubDate>
		<dc:creator>carson</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/?p=1136</guid>
		<description><![CDATA[After a week delay Fedora 13 has been released and it is time to upgrade of course. As always there are a decent number of features in this release but here are a few that stand out to me: boot.fedoraproject.org &#8211; A small bootable image to start the install from. IntelliJ IDEA &#8211; IntelliJ IDEA [...]]]></description>
			<content:encoded><![CDATA[<p>After a week delay <a href="http://docs.fedoraproject.org/en-US/Fedora/13/html/Release_Notes/index.html">Fedora 13</a> has been released and it is time to upgrade of course. As always there are a decent number of features in this release but here are a few that stand out to me:</p>
<ul>
<li><a href="http://boot.fedoraproject.org/">boot.fedoraproject.org</a> &#8211; A small bootable image to start the install from.</li>
<li><a href="https://fedoraproject.org/wiki/Features/IntelliJ_IDEA">IntelliJ IDEA</a> &#8211; IntelliJ IDEA community edition. I&#039;m glad to see my favorite IDE make it in along with Netbeans and Eclipse even if it is just the stripped down version.</li>
<li><a href="https://fedoraproject.org/wiki/Features/Python3F13">Python 3</a> &#8211; Running along side Python 2.</li>
<li><a href="https://fedoraproject.org/wiki/Features/NouveauDisplayPort">Nouveau DisplayPort</a> &#8211; Support for NVIDIA cards with a DisplayPort.</li>
<li><a href="https://fedoraproject.org/wiki/Features/RadeonDisplayPort">Radeon DisplayPort</a> &#8211; Support for Radeon cards with a DisplayPort.</li>
<li><a href="https://fedoraproject.org/wiki/Features/NetworkManagerCmdline">NetworkManager Command Line</a> &#8211; A command line interface for NetworkManager. As much as I find myself hating NetworkManager maybe this will help.</li>
<li><a href="http://library.gnome.org/misc/release-notes/2.30/">Gnome 2.30</a> &#8211; The latest stable version of Gnome.</li>
<li><a href="http://www.kde.org/announcements/announce-4.4.3.php">KDE 4.4</a> &#8211; The latest stable version of KDE.</li>
</ul>
<p>Check out the <a href="http://fedoraproject.org/wiki/Releases/13/FeatureList">Fedora 13 feature list<a> for all the major features in this release.</p>
<p><span id="more-1136"></span></p>
<p>I&#039;m continuing with the trend of using <a href="http://fedoraproject.org/wiki/Features/PreUpgrade">PreUpdate</a> to do the upgrade:</p>
<ol>
<li>Make sure you are using a Fedora 12 install. If you need instructions on getting to Fedora 12 then start with <a href="http://www.ioncannon.net/system-administration/719/upgrade-to-fedora-12-from-fedora-11/">upgrading from Fedora 11 to Fedora 12</a>.</li>
<li>yum clean all</li>
<li>yum update</li>
<li>Make sure you have plenty of space free in the /boot partition. I learned this lesson the last time I upgraded.</li>
<li>I always back up my xorg.conf file since because it seems to disappear sometimes.</li>
<li>preupgrade-cli &#034;Fedora 13 (Goddard)&#034; &#8211; My Fedora 12 to Fedora 13 upgrade weighed in at 1.0GB</li>
<li>reboot and wait</li>
</ol>
<p>No dependency issues when upgrading this time making it two in a row. I was tempted to try out the Nouveau NVIDIA drivers this time around but the driver from NVIDIA are not too hard to upgrade now so I haven&#039;t found a real reason. If you don&#039;t want to compile the NVIDIA drivers by hand you can get them from <a href="http://www.atrpms.net/">atrpms</a>, make sure to remove the Nouveau drivers first. The Fedora 13 version of <a href="http://www.virtualbox.org/wiki/Linux_Downloads">Virtualbox</a> was also needed.</p>
<p>I did run into a small issue with xorg after the upgrade. The NVIDIA driver requires the ignoreABI flag be sent to the X server on startup. I was able to modify startx but I always forget how to modify GDM. It turns out that you can also just put the flag in the xorg.conf file like this:</p>
<pre class="brush: plain; title: ; notranslate">
Section &quot;ServerFlags&quot;
        Option      &quot;ignoreABI&quot; &quot;true&quot;
EndSection
</pre>
<p>If you prefer the yum upgrade option here are the steps for that as well:</p>
<ol>
<li>yum clean all</li>
<li>yum update</li>
<li>rpm -Uvh http://mirrors.kernel.org/fedora/releases/13/Fedora/i386/os/Packages/fedora-release-13-1.noarch.rpm http://mirrors.kernel.org/fedora/releases/13/Fedora/i386/os/Packages/fedora-release-notes-13-3.fc13.noarch.rpm</li>
<li>yum clean all</li>
<li>yum -y update</li>
<li>You may need to resolve dependencies and then do another yum -y update or in my case I had to use &#8211;skip-broken to resolve some issues with packages I&#039;ve installed from atrpm.</li>
<li>reboot</li>
</ol>
<p>I needed to use the &#8211;skip-broken flag on yum this time but I didn&#039;t have to resolve any dependency issues. The resulting update was about 1.2G so it took a little while to apply. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/system-administration/1136/upgrade-to-fedora-13-from-fedora-12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fedora 12 Bootable Root EBS on EC2</title>
		<link>http://www.ioncannon.net/system-administration/894/fedora-12-bootable-root-ebs-on-ec2/</link>
		<comments>http://www.ioncannon.net/system-administration/894/fedora-12-bootable-root-ebs-on-ec2/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 12:30:13 +0000</pubDate>
		<dc:creator>carson</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[EBS]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[Fedora]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/?p=894</guid>
		<description><![CDATA[I recently needed to create a clean EC2 AMI using a fairly new linux distro. It has been a while since I&#039;ve needed to create a new AMI so I also wanted to move away from the older pre-packaged AMI and boot using EBS. After taking a look at what was currently available publicly I [...]]]></description>
			<content:encoded><![CDATA[<p>I recently needed to create a clean EC2 AMI using a fairly new linux distro. It has been a while since I&#039;ve needed to create a new AMI so I also wanted to move away from the older pre-packaged AMI and boot using EBS. After taking a look at what was currently available publicly I decided I would just create my own EBS bootable AMI using Fedora 12. It wasn&#039;t all that complicated but there are a decent number of steps so I figured I would document them for anyone else who might want to give it a try.</p>
<p>I&#039;m going to assume you already understand how to do things like create instances, create EBS volumes and ssh into your running instance using key based authentication. I use the AWS management console for a lot of what follows with the exception of needing to register the AMI and for that you will need the <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351">Amazon EC2 API Tools</a> and <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=368">Amazon EC2 AMI Tools</a> </p>
<p><span id="more-894"></span></p>
<p>There are two ways to get to a bootable EBS backed Fedora 12 instance and they start off the same. The first thing to do is fire up the AMI named &#034;Basic Fedora Core 8 (AMI Id: ami-84db39ed)&#034; that is provided by Amazon.</p>
<p>Once the Fedora Core 8 EC2 instance is ready ssh into it. Fedora 12 requries a newer version of RPM to install so you now need to upgrade the instance to Fedora 10. This is pretty easy and can be done by following my instructions on <a href="http://www.ioncannon.net/system-administration/142/upgrading-from-fedora-9-to-fedora-10-with-yum/">upgrading from Fedora 9 to Fedora 10</a> (don&#039;t worry about skipping 9 it will work). Here are the commands needed to do the upgrade:</p>
<pre class="brush: bash; title: ; notranslate">
yum clean all
rpm -Uhv http://archive.kernel.org/fedora-archive/releases/10/Fedora/i386/os/Packages/fedora-release-10-1.noarch.rpm http://archive.kernel.org/fedora-archive/releases/10/Fedora/i386/os/Packages/fedora-release-notes-10.0.0-1.noarch.rpm
yum -y update
</pre>
<p>After a few minutes the instance will be upgraded and ready for the next step. This is where the two paths diverge depending on how you want the final product constructed. The options are to install Fedora 12 on a freshly minted volume or continue upgrading the instance you just created.</p>
<p><b>Upgrade path</b></p>
<p>I will start with the upgrade path since that is probably the easier of the two although may leave you with a messier instances after it is done. The next step for the upgrade path is to do what I outline in <a href="http://www.ioncannon.net/system-administration/358/upgrading-to-fedora-11-from-fedora-10/">upgrading from Fedora 10 to Fedora 11</a> and <a href="http://www.ioncannon.net/system-administration/719/upgrade-to-fedora-12-from-fedora-11/">upgrading from Fedora 11 to Fedora 12</a>. Here are the commands all in one place to make it easy:</p>
<pre class="brush: bash; title: ; notranslate">
yum clean all
rpm -Uvh http://mirrors.usc.edu/pub/linux/distributions/fedora/linux/releases/11/Fedora/i386/os/Packages/fedora-release-11-1.noarch.rpm http://mirrors.usc.edu/pub/linux/distributions/fedora/linux/releases/11/Fedora/i386/os/Packages/fedora-release-notes-11.0.0-2.fc11.noarch.rpm
yum -y update
yum clean all
rpm -Uvh http://mirrors.kernel.org/fedora/releases/12/Fedora/i386/os/Packages/fedora-release-notes-12.0.0-4.fc12.noarch.rpm http://mirrors.kernel.org/fedora/releases/12/Fedora/i386/os/Packages/fedora-release-12-1.noarch.rpm
yum -y update
</pre>
<p>Once you have everything upgraded to Fedora 12 you will have a 15G root partition that has less than 2G used. This may not suite your needs very well if you really don&#039;t need that extra 13G but thankfully if you want to shrink the root EBS partition you can. </p>
<p>I found some instructions in this article on <a href="http://www.elastician.com/2009/12/creating-ebs-backed-ami-from-s3-backed.html">EBS backed AMI</a>s that describes using the following command to copy the entire file system over. Assuming you have created a smaller volume and attached it to the instance as sdh you should be able to do something like the following to copy everything to the new volume:</p>
<pre class="brush: bash; title: ; notranslate">
mkfs.ext3 /dev/sdh
mount /dev/sdh /mnt
tar cpS / | cpipe -vt -b 1024 | gzip -c | tar zxpS -C /mnt
rm -rf /mnt/mnt/*
rm -rf /mnt/proc/*
umount /mnt
</pre>
<p>One thing to note in the above is that the entire sdh drive is formatted for the file system (you will actually get a prompt asking if that is ok). As far as I can tell this is the way it has to be or the instance will not boot correctly. I assume this is because the root device is hidden behind a partition already as /dev/sda1 and so shouldn&#039;t have a second partition table.</p>
<p>Skip to the common part now to learn how to make the final bootable AMI.</p>
<p><b>From scratch path</b></p>
<p>This path is similar to and mostly an update/extension to my post on creating a <a href="http://www.ioncannon.net/system-administration/128/how-to-create-a-fedora-7-instance-for-ec2/">Fedora 7 AMI setup</a>. I&#039;m going to leave out most of the details and just provide you with a script that will take an empty volume (assumed to be attached as /dev/sdh) and turn it into a bootable EBS backed Fedora 12 volume. Download the script <a href="http://www.ioncannon.net/examples/createfedora12bootebs.sh">createfedora12bootebs.sh</a> instead of trying to cut and paste the following, it gets formatted in such a way as to lose a newline that is important. Please note that you will need at least 1G of space on the given volume.</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/sh

echo &quot;y&quot; | mkfs.ext3 /dev/sdh
mount /dev/sdh /mnt

mkdir /mnt/dev
mkdir /mnt/proc
mkdir /mnt/etc

for i in console null zero ; do /sbin/MAKEDEV -d /mnt/dev -x $i ; done

cat &lt;&lt;EOL &gt; /mnt/etc/fstab
/dev/sda1               /                       ext3    defaults 1 1
none                    /dev/pts                devpts  gid=5,mode=620 0 0
none                    /dev/shm                tmpfs   defaults 0 0
none                    /proc                   proc    defaults 0 0
none                    /sys                    sysfs   defaults 0 0
/dev/sdc1               /mnt                    ext3    defaults 0 0
/dev/sdc2               swap                    swap    defaults 0 0
EOL

mount -t proc none /mnt/proc

cat &lt;&lt;EOL &gt; /tmp/yumec2.conf
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
exclude=*-debuginfo
gpgcheck=0
obsoletes=1
reposdir=/dev/null

[base]
name=Fedora 12 – i386 – Base
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-12&amp;arch=i386
enabled=1

[updates-released]
name=Fedora 12 – i386 – Released Updates
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f12&amp;arch=i386
enabled=1
EOL

yum -c /tmp/yumec2.conf --installroot=/mnt -y groupinstall Base
yum -c /tmp/yumec2.conf --installroot=/mnt -y install openssh-server

yum -c /tmp/yumec2.conf --installroot=/mnt -y clean packages

echo &quot;UseDNS no&quot; &gt;&gt; /mnt/etc/ssh/sshd_config
echo &quot;PermitRootLogin without-password&quot; &gt;&gt; /mnt/etc/ssh/sshd_config

cp /etc/rc.local /mnt/etc/
cp /etc/sysconfig/network /mnt/etc/sysconfig/network
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /mnt/etc/sysconfig/network-scripts/ifcfg-eth0
cp /usr/local/sbin/* /mnt/usr/local/sbin/
cp -Rp /lib/modules/2.6.21.7-2.fc8xen/ /mnt/lib/modules/

echo &quot;/sbin/MAKEDEV /dev/urandom&quot; &gt;&gt; /mnt/etc/rc.sysinit
echo &quot;/sbin/MAKEDEV /dev/random&quot; &gt;&gt; /mnt/etc/rc.sysinit
echo &quot;/sbin/MAKEDEV /dev/sdc&quot; &gt;&gt; /mnt/etc/rc.sysinit
echo &quot;/sbin/MAKEDEV /dev/sdc1&quot; &gt;&gt; /mnt/etc/rc.sysinit
echo &quot;/sbin/MAKEDEV /dev/sdc2&quot; &gt;&gt; /mnt/etc/rc.sysinit

cat &lt;&lt;EOF &gt;&gt; /mnt/etc/rc.sysinit
# The following will partition the local drive and set up swap
cat &lt;&lt;EOL | fdisk /dev/sdc
n
p
1
1
+140G
n
p
2

w
EOL
mkswap /dev/sdc2
EOF

mv /mnt/lib/tls /mnt/lib/tls.disabled
echo &quot;hwcap 0 nosegneg&quot; &gt;&gt; /mnt/etc/ld.so.conf.d/kernelcap-2.6.21.7-2.fc8.conf

chroot /mnt chkconfig --level 2345 NetworkManager off
chroot /mnt chkconfig --level 2345 network on

sync
umount /mnt/proc
umount /mnt
</pre>
<p><b>Common wrap up</b></p>
<p>At this point you will need to create a snapshot of the volume that was created for one of the paths above. Once the snapshot is available you will need to then register the snapshot as an AMI that is bootable from EBS. To do that you would issue something like the following command substituting the correct data in where it relates to your volume and snapshot.</p>
<pre class="brush: bash; title: ; notranslate">
ec2-register -n &quot;AMIName&quot; -d &quot;AMI Description&quot; --block-device-mapping /dev/sdc=ephemeral0 --snapshot your-snapname --architecture i386 --kernel aki-a71cf9ce --ramdisk ari-a51cf9cc
</pre>
<p>One thing to note in this command is the &#8211;block-device-mapping option. That option is what gives you access to the local drive on your node once it is booted. This gives you extra storage for things you don&#039;t need to keep after the life of the running node. In the from scratch option I&#039;m turning part of the local drive into swap as well as creating a partition that could be used as a large temporary storage. If you want to know more details on the ephermeral storage look at <a href="http://developer.amazonwebservices.com/connect/thread.jspa?messageID=155916">this post</a></p>
<p>After all that you should have a bootable EBS backed Fedora 12 install to work with.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/system-administration/894/fedora-12-bootable-root-ebs-on-ec2/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Building Chromium and Chrome OS with EC2</title>
		<link>http://www.ioncannon.net/system-administration/771/building-chromium-and-chrome-os-with-ec2/</link>
		<comments>http://www.ioncannon.net/system-administration/771/building-chromium-and-chrome-os-with-ec2/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 21:17:59 +0000</pubDate>
		<dc:creator>carson</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[chrome os]]></category>
		<category><![CDATA[chromium]]></category>
		<category><![CDATA[ec2]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/?p=771</guid>
		<description><![CDATA[When the initial cut of the Chromium OS source was released last week I decided to use the opportunity to see if it would run on my EEE PC 900 netbook (check out EEE PC 900 running Chrome OS on Youtube to see the final result). The first roadblock I hit with the build instructions [...]]]></description>
			<content:encoded><![CDATA[<p>When the initial cut of the <a href="http://www.chromium.org/chromium-os">Chromium OS</a> source was released last week I decided to use the opportunity to see if it would run on my EEE PC 900 netbook (check out <a href="http://www.youtube.com/watch?v=gfQ6Qef5DWk">EEE PC 900 running Chrome OS</a> on Youtube to see the final result). The first roadblock I hit with the <a href="http://sites.google.com/a/chromium.org/dev/chromium-os/building-chromium-os/build-instructions">build instructions</a> was the Ubuntu requirement (I did give a little effort to getting it working on Fedora first). I don&#039;t have an Ubuntu box so I started out trying to use VirtualBox but that was going to take forever so I decided to move things to EC2 and what follows is the result. This isn&#039;t meant to be a replacement for the build docs since they are surely going to change, it is more of a cookbook to build <a href="http://www.chromium.org/Home">Chromium</a> (the browser) and Chromium OS using EC2 (EBS is used as well if you want to cache the source over time).</p>
<p>When I first started down the path of using EC2 I thought I would grab the source each time I wanted to build. I quickly ran into a snag however because it took forever to sync the source and download the Ubuntu repo. Once I had the initial sync of the source I decided I would copy it all to an EBS volume and keep that volume up to date. Using EBS to store the source feels better too since I assume Google expects people to be syncing changes only as opposed to pulling the entire source tree down every time they want to build.</p>
<p>I started out by finding this <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1952&#038;categoryID=101">Ubuntu AMI</a> for a base to work from. For the most efficient compile times I ended up using the High CPU (c1.medium) instance. I started with the default small instance but it was just too slow. With the high cpu instance you are looking at about 45 minutes to build the OS after you have the source synced for the first time and if you add building Chromium in there you are looking at around 55 additional minutes. All told you can have a complete build in less than 2 hours even if there are some source updates needed. For EBS you need a 3G volume for the Chrome OS source plus Ubuntu package repo and a 4G volume for the Chromium source. </p>
<p><span id="more-771"></span></p>
<p>I&#039;ve bundled everything up into one script called <a href="http://www.ioncannon.net/examples/builder.sh">builder.sh</a> and if you don&#039;t care to know the details you can download it and give it a try. There are some things you need to know about it however even if you don&#039;t want to follow all the details. First there are some of the assumptions made by the script:</p>
<ol>
<li>The EC2 AMI ami-ccf615a5 image is used on the node it is run on.</li>
<li>If you are storing the source then you have attached the EBS volumes and you have initialized a filesystem on both with mkfs.ext3 </li>
<li>If you are storing the source then you have attached the EBS volumes and indicated what devices they are using OSVOLDEV and BROWSERVOLDEV in the following config section</li>
<li>You are running the script as the root user</li>
</ol>
<p>Next is a small configuration area at the top of the script that lets it know what devices the two volumes will be mounted on. If you don&#039;t intend on having stored source then you don&#039;t need to worry about setting them to anything as long as what they are set to doesn&#039;t match a real device.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="re2">OSVOLDEV</span>=<span class="sy0">/</span>dev<span class="sy0">/</span>sdf1<br />
<span class="re2">BROWSERVOLDEV</span>=<span class="sy0">/</span>dev<span class="sy0">/</span>sdg1</div>
</div>
<p><br/></p>
<p>There are a few command line options that will let you tune the script if you want to skip parts of the build process:</p>
<ul>
<li>&#45;-skip-sync &#8211; This will skip trying to sync any of the repos. If you aren&#039;t using EBS to store the source the script will fail if you use this option since there will be nothing to build.</li>
<li>&#45;-skip-chrome-build &#8211; This will skip trying to build chrome. You have to build chrome at least once for the chrome os build to work.</li>
<li>&#45;-skip-chrome-os-build &#8211; This will skip trying to build chrome os.</li>
</ul>
<p>Here are a few other important things to make note of:</p>
<ul>
<li>The build script adds a user named &#034;gogo&#034; that can be used to log in if you don&#039;t want to use your Google login.</li>
<li>The build script sets the password for root access to &#034;gogo&#034;.</li>
<li>Running the build script should result in an image named /mnt/builder/<BUILDID>.usb.img.bz when everything is done. This is a compressed bootable image that can be written to a USB key (use something like dd if=usb.img of=/dev/usbkeydevice bs=10M).</li>
<li> I could imagine the same instructions and script being re-purposed for building on a non-EC2 system too.</li>
<li>The script can be run multiple times on the same node and will skip the parts that should only be done once.</li>
<li>There are probably ways to speed up the build to make it even faster. With some more effort the build for the browser could be kicked off while the source for the OS was still be synced. I also wondered if using a 64 bit EC2 node and creating a large ramdisk would help but I didn&#039;t want to fiddle with 64 bit builds of Chrome, I may revisit if I find time.</li>
<li>I was tempted to build an AMI that included all the prerequisites but it only takes 5 minutes to pull all of those together so I decided not to. It could streamline things to do that but I&#039;m not sure that it is worth the effort.</li>
</ul>
<p>If you are looking for more information about the script, places where it might make sense to modify the script and the build process in general then read on. </p>
<p>To get started there are a number of prerequisites that need to be installed. These are the required parts for both Chromium and Chromium OS. One note here is that there is some issue with lighttpd on Ubuntu that causes it to die while the apt-get is downloading all the packages so I had to resort to installing Apache as well. I make sure lighttpd isn&#039;t running since the prerequisites install it.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re5">-f</span> <span class="sy0">/</span>var<span class="sy0">/</span>run<span class="sy0">/</span>chromepre <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; <span class="kw3">echo</span> <span class="st0">&quot;Prereqs already installed, skipping&#8230;&quot;</span><br />
&nbsp; <span class="kw3">return</span><br />
<span class="kw1">fi</span></p>
<p><span class="kw2">touch</span> <span class="sy0">/</span>var<span class="sy0">/</span>run<span class="sy0">/</span>chromepre</p>
<p><span class="kw2">apt-get</span> <span class="re5">-y</span> <span class="re5">&#8211;force-yes</span> update<br />
<span class="kw2">apt-get</span> <span class="re5">-y</span> <span class="re5">&#8211;force-yes</span> upgrade<br />
<span class="kw2">wget</span> http:<span class="sy0">//</span>src.chromium.org<span class="sy0">/</span>svn<span class="sy0">/</span>trunk<span class="sy0">/</span>src<span class="sy0">/</span>build<span class="sy0">/</span>install-build-deps.sh <span class="re5">-O</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>install-build-deps.sh<br />
<span class="kw2">chmod</span> +x <span class="sy0">/</span>tmp<span class="sy0">/</span>install-build-deps.sh<br />
<span class="kw3">echo</span> <span class="st0">&quot;yy&quot;</span> <span class="sy0">|</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>install-build-deps.sh <span class="co0"># (requires y twice)</span><br />
<span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>lighttpd stop<br />
<span class="kw2">apt-get</span> <span class="re5">-y</span> <span class="re5">&#8211;force-yes</span> <span class="kw2">install</span> git-core apache2 apt-mirror <span class="kw2">zip</span></p>
<p><span class="kw2">cat</span> <span class="sy0">&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>apt<span class="sy0">/</span>mirror.list <span class="sy0">&lt;&lt;</span>__EOF__<br />
<span class="kw1">set</span> base_path &nbsp; &nbsp;<span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chromeos<span class="sy0">/</span>repo<br />
<span class="kw1">set</span> mirror_path &nbsp;<span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chromeos<span class="sy0">/</span>repo<span class="sy0">/</span>mirror<br />
<span class="kw1">set</span> skel_path &nbsp; &nbsp;<span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chromeos<span class="sy0">/</span>repo<span class="sy0">/</span>skel<br />
<span class="kw1">set</span> nthreads &nbsp; &nbsp; 20<br />
<span class="kw1">set</span> _tilde 0<br />
deb http:<span class="sy0">//</span>build.chromium.org<span class="sy0">/</span>buildbot<span class="sy0">/</span>packages<span class="sy0">/</span> chromeos main restricted universe multiverse<br />
deb http:<span class="sy0">//</span>build.chromium.org<span class="sy0">/</span>buildbot<span class="sy0">/</span>packages<span class="sy0">/</span> chromeos_dev main restricted universe multiverse<br />
clean http:<span class="sy0">//</span>build.chromium.org<span class="sy0">/</span>buildbot<span class="sy0">/</span>packages<span class="sy0">/</span><br />
__EOF__</p>
<p><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="sy0">!</span> <span class="re5">-b</span> <span class="sy0">/</span>dev<span class="sy0">/</span>loop6 <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; <span class="kw2">mknod</span> <span class="re5">-m660</span> <span class="sy0">/</span>dev<span class="sy0">/</span>loop6 b 7 6<br />
<span class="kw1">fi</span></p>
<p><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="sy0">!</span> <span class="re5">-b</span> <span class="sy0">/</span>dev<span class="sy0">/</span>loop7 <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; <span class="kw2">mknod</span> <span class="re5">-m660</span> <span class="sy0">/</span>dev<span class="sy0">/</span>loop7 b 7 7<br />
<span class="kw1">fi</span></div>
</div>
<p><br/></p>
<p>The next step is to create a user that will actually run the build. It turns out to be important that this user is not root so that is why there are some hoops being jumped here. The two source volumes get mounted into the user&#039;s home directory here as well. The last part of this section builds a filesystem to be used as temporary storage for output images. The way they build is set up it will push the final images into the source tree and because that is stored on EBS it could end up eating up a lot of room, there is more to this later in the Chrome OS build section.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re5">-d</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; <span class="kw3">echo</span> <span class="st0">&quot;Build user already created, skipping&#8230;&quot;</span><br />
&nbsp; <span class="kw3">return</span><br />
<span class="kw1">fi</span></p>
<p>useradd <span class="re5">-G</span> disk <span class="re5">-u</span> 1001 <span class="re5">-s</span> <span class="sy0">/</span>bin<span class="sy0">/</span><span class="kw2">bash</span> <span class="re5">-d</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder <span class="re5">-m</span> builder<br />
<span class="kw3">echo</span> <span class="st0">&quot;builder &nbsp; &nbsp;ALL=NOPASSWD: ALL&quot;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>etc<span class="sy0">/</span>sudoers</p>
<p><span class="kw2">mkdir</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chromeos<br />
<span class="kw2">chown</span> builder.builder <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chromeos<span class="sy0">/</span><br />
<span class="kw2">mkdir</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chrome<br />
<span class="kw2">chown</span> builder.builder <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chrome<span class="sy0">/</span></p>
<p><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re5">-b</span> <span class="re1">$OSVOLDEV</span> <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; <span class="kw2">mount</span> <span class="re1">$OSVOLDEV</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chromeos<span class="sy0">/</span><br />
<span class="kw1">fi</span><br />
<span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re5">-b</span> <span class="re1">$BROWSERVOLDEV</span> <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; <span class="kw2">mount</span> <span class="re1">$BROWSERVOLDEV</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chrome<span class="sy0">/</span><br />
<span class="kw1">fi</span></p>
<p><span class="kw3">echo</span> <span class="st0">&quot;export PATH=<span class="es1">\$</span>PATH:/mnt/builder/chromeos/depot_tools/&quot;</span> <span class="sy0">&gt;&gt;</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>.bashrc</p>
<p><span class="kw2">ln</span> <span class="re5">-s</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chromeos<span class="sy0">/</span>repo<span class="sy0">/</span>mirror<span class="sy0">/</span>build.chromium.org<span class="sy0">/</span>buildbot<span class="sy0">/</span>packages<span class="sy0">/</span> <span class="sy0">/</span>var<span class="sy0">/</span>www<span class="sy0">/</span>packages</p>
<p><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="sy0">!</span> <span class="re5">-f</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>images.img <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; <span class="kw2">dd</span> <span class="kw1">if</span>=<span class="sy0">/</span>dev<span class="sy0">/</span>zero <span class="re2">of</span>=<span class="sy0">/</span>mnt<span class="sy0">/</span>images.img <span class="re2">bs</span>=1 <span class="re2">count</span>=0 <span class="re2">seek</span>=10G<br />
&nbsp; losetup <span class="sy0">/</span>dev<span class="sy0">/</span>loop6 <span class="sy0">/</span>mnt<span class="sy0">/</span>images.img<br />
&nbsp; mkfs.ext3 <span class="sy0">/</span>dev<span class="sy0">/</span>loop6<br />
<span class="kw1">fi</span></p>
<p><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="sy0">!</span> <span class="re5">-d</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chromeos<span class="sy0">/</span>depot_tools<span class="sy0">/</span> <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; <span class="kw2">su</span> &#8211; builder <span class="re5">-c</span> <span class="st0">&quot;cd /mnt/builder/chromeos/; svn co http://src.chromium.org/svn/trunk/tools/depot_tools&quot;</span><br />
<span class="kw1">fi</span></div>
</div>
<p><br/></p>
<p>The next sections each sync either source or the apt-get repository. The first is syncing the apt-get repository using apt-mirror. In case you missed it the mirror was defined in the prerequisites section above.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="kw2">su</span> &#8211; builder <span class="re5">-c</span> apt-mirror</div>
</div>
<p><br/></p>
<p>The next is the Chromium OS source repository.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="kw3">cd</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chromeos<span class="sy0">/</span>chromiumos<span class="sy0">/</span><br />
<span class="kw1">if</span> <span class="br0">&#91;</span> <span class="sy0">!</span> <span class="re5">-f</span> .gclient <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; <span class="kw2">su</span> &#8211; builder <span class="re5">-c</span> <span class="st0">&quot;cd /mnt/builder/chromeos/chromiumos/; /mnt/builder/chromeos/depot_tools/gclient config http://src.chromium.org/git/chromiumos.git&quot;</span><br />
<span class="kw1">fi</span></p>
<p><span class="kw2">su</span> &#8211; builder <span class="re5">-c</span> <span class="st0">&quot;cd /mnt/builder/chromeos/chromiumos/; /mnt/builder/chromeos/depot_tools/gclient sync&quot;</span></div>
</div>
<p><br/></p>
<p>There are a few extra parts to syncing the Chromium browser. One of those extras is to make sure the third party test suites don&#039;t get synced since they are large.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="kw2">cat</span> <span class="sy0">&gt;</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>scs.sh <span class="sy0">&lt;&lt;</span>__EOF__<br />
<span class="kw3">export</span> <span class="re2">GYP_DEFINES</span>=<span class="st0">&quot;chromeos=1 target_arch=ia32&quot;</span><br />
<span class="kw3">export</span> <span class="re2">GYP_GENERATORS</span>=<span class="kw2">make</span><br />
<span class="kw3">cd</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chrome<span class="sy0">/</span></p>
<p><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="sy0">!</span> <span class="re5">-f</span> .gclient <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chromeos<span class="sy0">/</span>depot_tools<span class="sy0">/</span>gclient config http:<span class="sy0">//</span>src.chromium.org<span class="sy0">/</span>svn<span class="sy0">/</span>trunk<span class="sy0">/</span>src<br />
&nbsp; <span class="kw2">awk</span> <span class="re5">-f</span> &#8211; .gclient <span class="sy0">&lt;&lt;</span> __END__<br />
<span class="br0">&#123;</span> print <span class="br0">&#125;</span><br />
<span class="sy0">/</span><span class="st0">&quot; &nbsp; &nbsp;&quot;</span>custom_deps<span class="st0">&quot; : {&quot;</span><span class="sy0">/</span> <span class="br0">&#123;</span> <br />
&nbsp; &nbsp; print <span class="st0">&quot; &nbsp; &nbsp;<span class="es1">\&quot;</span>custom_deps<span class="es1">\&quot;</span> : {<span class="es1">\n</span><span class="es1">\&quot;</span>src/third_party/WebKit/LayoutTests<span class="es1">\&quot;</span>: None,&quot;</span> <br />
<span class="br0">&#125;</span><br />
__END__<br />
<span class="kw1">fi</span></p>
<p><span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chromeos<span class="sy0">/</span>depot_tools<span class="sy0">/</span>gclient <span class="kw2">sync</span> <span class="re5">&#8211;deps</span>=<span class="st0">&quot;chromeos,unix&quot;</span></p>
<p><span class="kw3">exit</span><br />
__EOF__</p>
<p><span class="kw2">chmod</span> +x <span class="sy0">/</span>tmp<span class="sy0">/</span>scs.sh</p>
<p><span class="kw2">su</span> &#8211; builder <span class="re5">-c</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>scs.sh</div>
</div>
<p><br/></p>
<p>Building the Chromium browser. This isn&#039;t needed every time. When it is done it sticks the browser in place for the Chromium OS build.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="sy0">!</span> <span class="re5">-d</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chrome.tmp <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; <span class="kw2">su</span> &#8211; builder <span class="re5">-c</span> <span class="st0">&quot;cp -Rp /mnt/builder/chrome /mnt/builder/chrome.tmp&quot;</span><br />
<span class="kw1">fi</span><br />
<span class="kw2">su</span> &#8211; builder <span class="re5">-c</span> <span class="st0">&quot;export PATH=<span class="es2">$PATH</span>:/mnt/builder/chromeos/depot_tools/; /mnt/builder/chromeos/chromiumos/chromiumos.git/src/scripts/build_chrome.sh &#8211;chrome_dir /mnt/builder/chrome.tmp/&quot;</span></div>
</div>
<p><br/></p>
<p>Finally the place where the OS actually gets compiled. The majority of this is right out of the build instructions. One thing to understand here is that the build process creates a chroot environment and then maps the source into that before the build starts. The build is done inside the chroot environment so the build script has to create a temporary script with all the commands that need to run there. One other note here is that the images filesystem created above has to be mapped into the chroot environment and I did that by setting it up as a loopback device then mounting it from inside the chroot environment. After the build is complete I can then get to the filesystem outside of the chroot environment to grab the final image. If you want to change the test user, the system password or get rid of either of those options this is the section to change.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="kw2">su</span> &#8211; builder <span class="re5">-c</span> <span class="st0">&quot;/mnt/builder/chromeos/chromiumos/chromiumos.git/src/scripts/make_chroot.sh &#8211;mirror http://localhost/packages/ &#8211;chroot /mnt/builder/chroot &#8211;replace&quot;</span></p>
<p><span class="kw2">cat</span> <span class="sy0">&gt;</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chroot<span class="sy0">/</span>tmp<span class="sy0">/</span>go.sh <span class="sy0">&lt;&lt;</span> __EOF__<br />
<span class="co0">#!/bin/sh</span><br />
<span class="kw2">rm</span> <span class="re5">-f</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>go.sh</p>
<p><span class="kw3">cd</span> ..<span class="sy0">/</span>platform<span class="sy0">/</span>pam_google <span class="sy0">&amp;&amp;</span> .<span class="sy0">/</span>enable_localaccount.sh gogo<br />
<span class="kw3">cd</span> -<br />
<span class="kw3">echo</span> <span class="st0">&quot;gogo&quot;</span> <span class="sy0">|</span> .<span class="sy0">/</span>set_shared_user_password.sh</p>
<p>.<span class="sy0">/</span>build_platform_packages.sh<br />
.<span class="sy0">/</span>build_kernel.sh</p>
<p><span class="kw2">sudo</span> <span class="kw2">mount</span> <span class="sy0">/</span>dev<span class="sy0">/</span>loop6 <span class="sy0">/</span>home<span class="sy0">/</span>builder<span class="sy0">/</span>trunk<span class="sy0">/</span>src<span class="sy0">/</span>build<span class="sy0">/</span>images<span class="sy0">/</span><br />
<span class="kw2">sudo</span> <span class="kw2">chown</span> builder.adm <span class="sy0">/</span>home<span class="sy0">/</span>builder<span class="sy0">/</span>trunk<span class="sy0">/</span>src<span class="sy0">/</span>build<span class="sy0">/</span>images</p>
<p>.<span class="sy0">/</span>build_image.sh <span class="re5">&#8211;mirror</span> http:<span class="sy0">//</span>localhost<span class="sy0">/</span>packages<span class="sy0">/</span></p>
<p><span class="kw2">sudo</span> <span class="kw2">umount</span> <span class="sy0">/</span>home<span class="sy0">/</span>builder<span class="sy0">/</span>trunk<span class="sy0">/</span>src<span class="sy0">/</span>build<span class="sy0">/</span>images<span class="sy0">/</span></p>
<p><span class="kw3">exit</span><br />
__EOF__</p>
<p><span class="kw2">chown</span> builder.builder <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chroot<span class="sy0">/</span>tmp<span class="sy0">/</span>go.sh<br />
<span class="kw2">chmod</span> +x <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chroot<span class="sy0">/</span>tmp<span class="sy0">/</span>go.sh</p>
<p><span class="kw2">su</span> &#8211; builder <span class="re5">-c</span> <span class="st0">&quot;/mnt/builder/chromeos/chromiumos/chromiumos.git/src/scripts/enter_chroot.sh &#8211;chroot /mnt/builder/chroot /tmp/go.sh&quot;</span></p>
<p><span class="kw2">mkdir</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>mnt<span class="sy0">/</span><br />
<span class="kw2">mount</span> <span class="sy0">/</span>dev<span class="sy0">/</span>loop6 <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>mnt<br />
<span class="re2">NEWEST</span>=<span class="sy0">`</span><span class="kw2">ls</span> <span class="re5">-tadr</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>mnt<span class="sy0">/*/</span> <span class="sy0">|</span> <span class="kw2">tail</span> <span class="re5">-1</span> <span class="sy0">|</span> <span class="kw2">head</span> -1<span class="sy0">`</span><br />
<span class="re2">BUILDID</span>=<span class="sy0">`</span><span class="kw2">basename</span> <span class="re1">$NEWEST</span><span class="sy0">`</span><br />
<span class="kw2">dd</span> <span class="kw1">if</span>=<span class="sy0">/</span>dev<span class="sy0">/</span>zero <span class="re2">of</span>=<span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span><span class="re1">$BUILDID</span>.usb.img <span class="re2">bs</span>=1 <span class="re2">count</span>=0 <span class="re2">seek</span>=4G<br />
losetup <span class="sy0">/</span>dev<span class="sy0">/</span>loop7 <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span><span class="re1">$BUILDID</span>.usb.img<br />
<span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>chromeos<span class="sy0">/</span>chromiumos<span class="sy0">/</span>chromiumos.git<span class="sy0">/</span>src<span class="sy0">/</span>scripts<span class="sy0">/</span>image_to_usb.sh <span class="re5">-y</span> <span class="re5">&#8211;from</span>=<span class="re1">$NEWEST</span> <span class="re5">&#8211;to</span>=<span class="sy0">/</span>dev<span class="sy0">/</span>loop7<br />
losetup <span class="re5">-d</span> <span class="sy0">/</span>dev<span class="sy0">/</span>loop7<br />
<span class="kw2">umount</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span>mnt<br />
<span class="kw2">bzip2</span> <span class="re5">-9</span> <span class="sy0">/</span>mnt<span class="sy0">/</span>builder<span class="sy0">/</span><span class="re1">$BUILDID</span>.usb.img</div>
</div>
<p><br/></p>
<p>A final bit of glue looks for command line arguments ties everything together.</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="re2">SKIP_SYNC</span>=<span class="kw2">false</span><br />
<span class="re2">SKIP_CHROME_BUILD</span>=<span class="kw2">false</span><br />
<span class="re2">SKIP_CHROME_OS_BUILD</span>=<span class="kw2">false</span></p>
<p><span class="kw1">set</span> <span class="re5">&#8211;</span> $<span class="br0">&#40;</span><span class="kw2">getopt</span> <span class="re5">-l</span> skip-sync,skip-chrome-build,skip-chrome-os-build abc: <span class="st0">&quot;$@&quot;</span><span class="br0">&#41;</span><br />
<span class="kw1">while</span> <span class="br0">&#91;</span> <span class="re4">$#</span> <span class="re5">-gt</span> 0 <span class="br0">&#93;</span><br />
<span class="kw1">do</span><br />
&nbsp; <span class="kw1">case</span> <span class="st0">&quot;$1&quot;</span> <span class="kw1">in</span><br />
&nbsp; &nbsp; <span class="br0">&#40;</span>&#8211;skip-sync<span class="br0">&#41;</span> <span class="re2">SKIP_SYNC</span>=<span class="kw2">true</span>; <span class="kw3">break</span><span class="sy0">;;</span><br />
&nbsp; &nbsp; <span class="br0">&#40;</span>&#8211;skip-chrome-build<span class="br0">&#41;</span> <span class="re2">SKIP_CHROME_BUILD</span>=<span class="kw2">true</span>; <span class="kw3">break</span><span class="sy0">;;</span><br />
&nbsp; &nbsp; <span class="br0">&#40;</span>&#8211;skip-chrome-os-build<span class="br0">&#41;</span> <span class="re2">SKIP_CHROME_OS_BUILD</span>=<span class="kw2">true</span>; <span class="kw3">break</span><span class="sy0">;;</span><br />
&nbsp; &nbsp; <span class="br0">&#40;</span>&#8211;<span class="br0">&#41;</span> <span class="kw3">shift</span>; <span class="kw3">break</span><span class="sy0">;;</span><br />
&nbsp; &nbsp; <span class="br0">&#40;</span>&#8211;<span class="sy0">*</span><span class="br0">&#41;</span> <span class="kw3">echo</span> <span class="st0">&quot;$0: error &#8211; unrecognized option $1&quot;</span> 1<span class="sy0">&gt;&amp;</span><span class="nu0">2</span>; <span class="kw3">exit</span> <span class="nu0">1</span><span class="sy0">;;</span><br />
&nbsp; &nbsp; <span class="br0">&#40;</span><span class="sy0">*</span><span class="br0">&#41;</span> &nbsp;<span class="kw3">break</span><span class="sy0">;;</span><br />
&nbsp; <span class="kw1">esac</span><br />
&nbsp; <span class="kw3">shift</span><br />
<span class="kw1">done</span></p>
<p>install_prereqs<br />
create_build_user</p>
<p><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="st0">&quot;<span class="es2">$SKIP_SYNC</span>&quot;</span> <span class="sy0">!</span>= <span class="st0">&quot;true&quot;</span> <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; sync_apt<br />
&nbsp; sync_chrome<br />
&nbsp; sync_chrome_os<br />
<span class="kw1">fi</span></p>
<p><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="st0">&quot;<span class="es2">$SKIP_CHROME_BUILD</span>&quot;</span> <span class="sy0">!</span>= <span class="st0">&quot;true&quot;</span> <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; build_chrome<br />
<span class="kw1">fi</span></p>
<p><span class="kw1">if</span> <span class="br0">&#91;</span> <span class="st0">&quot;<span class="es2">$SKIP_CHROME_BUILD</span>&quot;</span> <span class="sy0">!</span>= <span class="st0">&quot;true&quot;</span> <span class="br0">&#93;</span><br />
<span class="kw1">then</span><br />
&nbsp; build_chrome_os<br />
<span class="kw1">fi</span></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/system-administration/771/building-chromium-and-chrome-os-with-ec2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upgrade to Fedora 12 from Fedora 11</title>
		<link>http://www.ioncannon.net/system-administration/719/upgrade-to-fedora-12-from-fedora-11/</link>
		<comments>http://www.ioncannon.net/system-administration/719/upgrade-to-fedora-12-from-fedora-11/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 11:56:18 +0000</pubDate>
		<dc:creator>carson</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/?p=719</guid>
		<description><![CDATA[Fedora 12 was just released and it is time to upgrade again of course. I almost thought this was going to be a version to yawn at but then I saw that there was going to be a new version of Fedora based on Moblin and it seemed exciting again. Of course that isn&#039;t the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://docs.fedoraproject.org/release-notes/f12/en-US/html/">Fedora 12</a> was just released and it is time to upgrade again of course. I almost thought this was going to be a version to yawn at but then I saw that there was going to be a new version of Fedora based on <a href="http://moblin.org/">Moblin</a> and it seemed exciting again. Of course that isn&#039;t the only thing being upgraded in the latest version of Fedora. Some of the more notable changes in this version:</p>
<ul>
<li>Updated window managers <a href="http://www.fedoraproject.org/wiki/Features/Gnome2.28">Gnome 2.28</a>, <a href="http://www.fedoraproject.org/wiki/Features/KDE43">KDE 4.3</a> and <a href="http://www.fedoraproject.org/wiki/Features/FedoraMoblin">Fedora Moblin</a></li>
<li><a href="http://fedoraproject.org/wiki/Features/Presto">Delta RPM support</a></li>
<li><a href="http://www.fedoraproject.org/wiki/Features/F12X86Support">i686 as the base architecture</a></li>
<li>Lots of virtualization changes: <a href="http://www.fedoraproject.org/wiki/Features/KSM">KSM</a>, <a href="http://www.fedoraproject.org/wiki/Features/KVM_Huge_Page_Backed_Memory">KVM huge page support</a>, <a href="http://www.fedoraproject.org/wiki/Features/KVM_NIC_Hotplug>KVM NIC hotplug</a>, <a href="http://www.fedoraproject.org/wiki/Features/KVM_qcow2_Performance">KVM QCow2 performance improvements</a>, <a href="http://www.fedoraproject.org/wiki/Features/KVM_Stable_Guest_ABI">KVM Stable Guest ABI</a>, <a href="http://www.fedoraproject.org/wiki/Features/libguestfs">libguestfs</a>, <a href="http://www.fedoraproject.org/wiki/Features/Network_Interface_Management">Virtual network management</a> and <a href="http://www.fedoraproject.org/wiki/Features/VirtPrivileges">improved virtual privileges</a> to name a few</li>
<li>An easier to use bug reporting interface <a href="http://www.fedoraproject.org/wiki/Features/ABRTF12">Abrt 1.0</a></li>
<li><a href="http://www.fedoraproject.org/wiki/Features/BetterWebcamSupportF12">Better Webcam Support</a></li>
</ul>
<p>You can find the complete list of <a href="http://www.fedoraproject.org/wiki/Releases/12/FeatureList">Fedora 12 enhancements</a> as well if you want more details.</p>
<p><span id="more-719"></span></p>
<p>I&#039;m again starting with <a href="http://fedoraproject.org/wiki/Features/PreUpgrade">PreUpdate</a> since it worked well last time. The steps are pretty much the same as last time but I did have more problems after the upgrade:</p>
<ol>
<li>You have to be at Fedora11 before you try this. If you aren&#039;t there follow the <a href="http://www.ioncannon.net/system-administration/358/upgrading-to-fedora-11-from-fedora-10/">steps to get to Fedora11</a>.</li>
<li>yum clean all</li>
<li>yum udpate</li>
<li>Make sure to back up your xorg.conf since it can disappear with the upgrade.</li>
<li>preupgrade-cli &#034;Fedora 12 (Constantine)&#034; The total download for the upgrade from Fedora 11 to Fedora 12 was 1.1GB for me</li>
<li>After I rebooted the first time I got an error that the /boot directory didn&#039;t have enough space. It turns out I needed about 27M of free space so I ended up having to delete old kernels until I had 28M of free space.</li>
<li>reboot and wait</li>
</ol>
<p>I lucked out again and didn&#039;t have to remove anything to fix dependency issues. I recompiled my existing NVIDIA driver but I ran into an issue with the nouveau NVIDIA driver that comes with Fedora 12. I needed to remove the nouveau package, rebuild initrd and reboot before I could build the NVIDIA driver:</p>
<div class="codesnip-container" >
<div class="text codesnip" style="font-family:monospace;">yum remove xorg-x11-drv-nouveau.i686<br />
rm /boot/initramfs-2.6.31.5-127.fc12.i686.img<br />
mkinitrd /boot/initramfs-2.6.31.5-127.fc12.i686.img 2.6.31.5-127.fc12.i686</div>
</div>
<p>If that is too much work you can also get the NVIDIA driver from <a href="http://www.atrpms.net/">atrpms</a> but you will still need to remove the nouveau driver first. I also needed to pull down the Fedora 12 version of <a href="http://www.virtualbox.org/wiki/Linux_Downloads">Virtualbox</a> but so far that was all.</p>
<p>If you prefer the yum upgrade option here are the steps for that as well:</p>
<ol>
<li>yum clean all</li>
<li>yum update</li>
<li>rpm -Uvh http://mirrors.kernel.org/fedora/releases/12/Fedora/i386/os/Packages/fedora-release-notes-12.0.0-4.fc12.noarch.rpm http://mirrors.kernel.org/fedora/releases/12/Fedora/i386/os/Packages/fedora-release-12-1.noarch.rpm</li>
<li>yum clean all</li>
<li>yum -y update</li>
<li>You may need to resolve dependencies and then do another yum -y update</li>
<li>reboot</li>
</ol>
<p>I had to resolve dependencies to get this to work. I had to remove tigervnc-server-1.0.0-2.fc11.i586 and VirtualBox-3.0.10_54097_fedora11-1.i586. The resulting update was about 1.4G so it took a little while to apply.</p>
<p>I&#039;ve also put together a few <a href="http://www.ioncannon.net/projects/miscellaneous-projects/fedora-12-screenshots-and-videos/">videos and screenshots</a> if you want to get a quick preview of what the different versions available look like. You can also view the videos on Youtube: <a href="http://www.youtube.com/watch?v=W6rTVTyjQ1Q&#038;feature=player_embedded">Moblin</a>, <a href="http://www.youtube.com/watch?v=F0UlVnoUtbw&#038;feature=player_embedded">KDE</a> and <a href="http://www.youtube.com/watch?v=GZ8tSxMJTr8&#038;feature=player_embedded">Gnome</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/system-administration/719/upgrade-to-fedora-12-from-fedora-11/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Upgrading to Fedora 11 from Fedora 10</title>
		<link>http://www.ioncannon.net/system-administration/358/upgrading-to-fedora-11-from-fedora-10/</link>
		<comments>http://www.ioncannon.net/system-administration/358/upgrading-to-fedora-11-from-fedora-10/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 10:40:54 +0000</pubDate>
		<dc:creator>carson</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.ioncannon.net/?p=358</guid>
		<description><![CDATA[It is time again to upgrade if you are using Fedora. Fedora 11 was released a few days ago and contains some nice enhancements. For people who can a complete re-install is probably best. One reason for that is the inclusion of ext4 in Fedora11. You won&#039;t get the benefit of ext4 unless you do [...]]]></description>
			<content:encoded><![CDATA[<p>It is time again to upgrade if you are using Fedora. <a href="http://docs.fedoraproject.org/release-notes/f11/">Fedora 11</a> was <a href="http://press.redhat.com/2009/06/09/fedora-11-rapid-innovation-available-today/">released</a> a few days ago and contains some nice <a href="http://fedoraproject.org/wiki/Fedora_11_tour">enhancements</a>.</p>
<p>For people who can a complete re-install is probably best. One reason for that is the inclusion of ext4 in Fedora11. You won&#039;t get the benefit of ext4 unless you do a fresh install or <a href="http://www.cyberciti.biz/tips/linux-convert-ext3-to-ext4-file-system.html">upgrade from ext3 to ext4</a>. If you read the <a href="http://docs.fedoraproject.org/install-guide/f11/en-US/html/ch-upgrade-x86.html">upgrade guide</a> that Fedora produces it recommends not doing an upgrade.</p>
<p><span id="more-358"></span></p>
<p>This time around I decided to go with <a href="http://fedoraproject.org/wiki/Features/PreUpgrade">PreUpdate</a> right off the bat and it worked great. Here are the condensed steps. I think this will be the last time I do an upgrade post since they have it down to almost nothing now.</p>
<ol>
<li>You have to be at Fedora10 before you try this. If you aren&#039;t there follow the <a href="http://www.ioncannon.net/system-administration/142/upgrading-from-fedora-9-to-fedora-10-with-yum/">steps to get to Fedora10</a>.</li>
<li>yum clean all</li>
<li>yum udpate</li>
<li>preupgrade-cli &#034;Fedora 11 (Leonidas)&#034;</li>
<li>reboot and wait</li>
</ol>
<p>It seems like the days of conflicts before upgrades are gone now so that is a good thing. I didn&#039;t have to remove anything to make dependencies work out. The only fallout I had from this upgrade was my NVIDIA configuration for xorg got wiped and I had to pull it from backup. So take note to back up your xorg.conf if you have a custom one.</p>
<p>Tags: <a href="http://technorati.com/tag/linux" rel="tag">linux</a>, <a href="http://technorati.com/tag/fedora" rel="tag"> fedora</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ioncannon.net/system-administration/358/upgrading-to-fedora-11-from-fedora-10/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

