<?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>Niftiest Software</title>
	<atom:link href="http://www.niftiestsoftware.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.niftiestsoftware.com</link>
	<description>A blog about Linux, web development and more.</description>
	<lastBuildDate>Sun, 20 May 2012 17:41:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<div id='fb-root'></div>
					<script type='text/javascript'>
						window.fbAsyncInit = function()
						{
							FB.init({appId: null, status: true, cookie: true, xfbml: true});
						};
						(function()
						{
							var e = document.createElement('script'); e.async = true;
							e.src = document.location.protocol + '//connect.facebook.net/en_GB/all.js';
							document.getElementById('fb-root').appendChild(e);
						}());
					</script>	
						<item>
		<title>Upgrading Dell ESM firmware on an unsupported OS</title>
		<link>http://www.niftiestsoftware.com/2012/05/20/upgrading-dell-esm-firmware-on-an-unsupported-os/</link>
		<comments>http://www.niftiestsoftware.com/2012/05/20/upgrading-dell-esm-firmware-on-an-unsupported-os/#comments</comments>
		<pubDate>Sun, 20 May 2012 12:39:44 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.niftiestsoftware.com/?p=568</guid>
		<description><![CDATA[I recently received a free Dell Poweredge 1750 from work ( they were having a clearout of old hardware and I grabbed it first ), and naturally the first thing I installed was Funtoo ( essentially it&#8217;s an experimental version &#8230; <a href="http://www.niftiestsoftware.com/2012/05/20/upgrading-dell-esm-firmware-on-an-unsupported-os/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently received a free Dell Poweredge 1750 from work ( they were having a clearout of old hardware and I grabbed it first ), and naturally the first thing I installed was <a title="Funtoo Linux" href="http://www.funtoo.org" target="_blank">Funtoo</a> ( essentially it&#8217;s an experimental version of Gentoo ) .</p>
<p>Installation worked fine, but the only problem I have is the server is quite loud. Plugging in the second PSU dropped the noise considerably, but I would like it to be quieter. Googling around, I found a few suggestions to upgrade the BIOS and ESM firmware, upgrading the BIOS was simple &#8211; <a title="Dell PowerEdge 1750 BIOS" href="http://downloads.dell.com/bios/PE1750_BIOS_LX_A12.BIN" target="_blank">download the BIOS .bin file from Dell</a>, chmod +x and run, but the ESM upgrade isn&#8217;t as simple.<br />
<span id="more-568"></span></p>
<p>I attempted <a title="Dell PowerEdge 1750 ESM Firmware" href="http://downloads.dell.com/esm/PE1750-ESM-LX-A37.bin" target="_blank">downloading the ESM file from Dell</a> , and setting the execute permission on the file, it indicated some dependencies were missing:</p>
<pre>./spsetup.sh: Cannot find utilities on the system to execute package.
Make sure the following utilities are in the path:
sed stty cut fmt stat look lockfile tail rm mkdir mktemp chmod ls basename dirname sleep</pre>
<p>After satisfying the dependencies ( I had to install app-arch/rpm to satisfy rpm, and mail-filter/procmail to satisfy lockfile ), I re-ran the ESM script, and received this error:</p>
<pre>line 123: source: buildVer.sh: file not found</pre>
<p>Apparently the reason for this error is because the script from Dell doesn&#8217;t work with bash 4 ( in bash and earlier the &#8216;source&#8217; command looks in the same path as the running script, in bash 4 and later it doesn&#8217;t ).  I did try to modify the scripts and fix the bug ( ie replacing source buildVer.sh with source ./buildVer.sh ), which <em>did</em> fix that error, but just raised more.</p>
<p>In the end, I simply downloaded the CentOS-based <a title="Dell OpenManage Live CD" href="http://linux.dell.com/files/openmanage-contributions/omsa-55-live/omsa-55-022109.iso" target="_blank">Dell OSMA live cd</a>. I didn&#8217;t have a screen attached to the server, however luckily it runs SSH on boot &#8211; the only problem being I didn&#8217;t have the password to the live cd. In the end, I pressed ctrl+alt+f1 , then blindly typed:</p>
<pre>passwd
testpass
testpass</pre>
<p>Which reset the root password, and allowed me to log in via ssh to the server. I then ran:</p>
<pre>wget http://downloads.dell.com/esm/PE1750-ESM-LX-A37.bin
chmod +x PE1750-ESM-LX-A37.bin
./PE1750-ESM-LX-A37.bin</pre>
<p>After a few minutes the firmware upgrade was successfully installed:</p>
<pre>Collecting inventory...
......................................................................................................................
Running validation...

ESM

The version of this Update Package is the same as the currently installed version.
Software application name: Baseboard Management Controller
Package version: 1.84
Installed version: 1.84

The version of this Update Package is the same as the currently installed version.
Software application name: Primary System Backplane
Package version: 1.01
Installed version: 1.01

The version of this Update Package is the same as the currently installed version.
Software application name: Sensor Data Records
Package version: 0.33
Installed version: 0.33

Continue? Y/N:y
Y entered; update was forced by user
Executing update...
WARNING: DO NOT STOP THIS PROCESS OR INSTALL OTHER DELL PRODUCTS WHILE UPDATE IS IN PROGRESS.
THESE ACTIONS MAY CAUSE YOUR SYSTEM TO BECOME UNSTABLE!
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
The ESM firmware update completed successfully.
Would you like to reboot your system now?
Continue? Y/N:y</pre>
<p>After rebooting, the new firmware was installed.</p>
<div class="plus-one-wrap"><g:plusone size="medium" count="false" href="http://www.niftiestsoftware.com/2012/05/20/upgrading-dell-esm-firmware-on-an-unsupported-os/"></g:plusone></div><div class='wpfblike' style='height: 40px;'><fb:like href='http://www.niftiestsoftware.com/2012/05/20/upgrading-dell-esm-firmware-on-an-unsupported-os/' layout='button_count' show_faces='false' width='90' action='like' colorscheme='light' send='false' /></div> <p><a href="http://www.niftiestsoftware.com/?flattrss_redirect&amp;id=568&amp;md5=440b4594dd0c11361626acc2937ad705" title="Flattr" target="_blank"><img src="http://www.niftiestsoftware.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.niftiestsoftware.com/2012/05/20/upgrading-dell-esm-firmware-on-an-unsupported-os/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=netnifty&amp;popout=1&amp;url=http%3A%2F%2Fwww.niftiestsoftware.com%2F2012%2F05%2F20%2Fupgrading-dell-esm-firmware-on-an-unsupported-os%2F&amp;language=en_GB&amp;category=software&amp;title=Upgrading+Dell+ESM+firmware+on+an+unsupported+OS&amp;description=I+recently+received+a+free+Dell+Poweredge+1750+from+work+%28+they+were+having+a+clearout+of+old+hardware+and+I+grabbed+it+first+%29%2C+and+naturally+the+first+thing...&amp;tags=blog" type="text/html" />
	</item>
		<item>
		<title>file not recognized: File truncated</title>
		<link>http://www.niftiestsoftware.com/2012/05/12/file-not-recognized-file-truncated/</link>
		<comments>http://www.niftiestsoftware.com/2012/05/12/file-not-recognized-file-truncated/#comments</comments>
		<pubDate>Fri, 11 May 2012 23:13:15 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[pulseaudio]]></category>

		<guid isPermaLink="false">http://www.niftiestsoftware.com/?p=559</guid>
		<description><![CDATA[While attempting to upgrade one of my Gentoo Linux machines to the latest version of PulseAudio ( media-sound/pulseaudio-2.0 ) today I encountered the following error: libtool: install: /usr/bin/install -c .libs/libprotocol-cli.soT /var/tmp/portage/media-sound/pulseaudio-2.0/image//usr/lib64/pulse-2.0/modules/libprotocol-cli.so libtool: install: /usr/bin/install -c .libs/libprotocol-cli.lai /var/tmp/portage/media-sound/pulseaudio-2.0/image//usr/lib64/pulse-2.0/modules/libprotocol-cli.la libtool: install: warning: relinking &#8230; <a href="http://www.niftiestsoftware.com/2012/05/12/file-not-recognized-file-truncated/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>While attempting to upgrade one of my Gentoo Linux machines to the latest version of PulseAudio ( media-sound/pulseaudio-2.0 ) today I encountered the following error:<br />
<span id="more-559"></span></p>
<pre>
libtool: install: /usr/bin/install -c .libs/libprotocol-cli.soT /var/tmp/portage/media-sound/pulseaudio-2.0/image//usr/lib64/pulse-2.0/modules/libprotocol-cli.so
libtool: install: /usr/bin/install -c .libs/libprotocol-cli.lai /var/tmp/portage/media-sound/pulseaudio-2.0/image//usr/lib64/pulse-2.0/modules/libprotocol-cli.la
libtool: install: warning: relinking `libprotocol-simple.la'
libtool: install: (cd /var/tmp/portage/media-sound/pulseaudio-2.0/work/pulseaudio-2.0/src; /bin/sh /var/tmp/portage/media-sound/pulseaudio-2.0/work/pulseaudio-2.0/libtool  --silent --tag CC --mode=relink x86_64-pc-linux-gnu-gcc -std=gnu99 -I../src -I../src/modules -I../src/modules -pthread -DPA_ALSA_PATHS_DIR=\"/usr/share/pulseaudio/alsa-mixer/paths\" -DPA_ALSA_PROFILE_SETS_DIR=\"/usr/share/pulseaudio/alsa-mixer/profile-sets\" -march=core2 -msse4.1 -O2 -pipe -Wall -W -Wextra -Wno-long-long -Wvla -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing -Wwrite-strings -Wno-unused-parameter -ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common -fdiagnostics-show-option -Wl,-z,nodelete -avoid-version -Wl,-O1 -Wl,--as-needed -Wl,--no-as-needed -o libprotocol-simple.la -rpath /usr/lib64/pulse-2.0/modules protocol-simple.lo libpulsecore-2.0.la libpulsecommon-2.0.la libpulse.la -lgdbm -lcap -lrt -ldl -lm -inst-prefix-dir /var/tmp/portage/media-sound/pulseaudio-2.0/image/)
/var/tmp/portage/media-sound/pulseaudio-2.0/work/pulseaudio-2.0/src/.libs/libpulsecore-2.0.so: file not recognized: File truncated
collect2: ld returned 1 exit status
libtool: install: error: relink `libprotocol-simple.la' with the above command before installing it
make[4]: *** [install-modlibexecLTLIBRARIES] Error 1
</pre>
<p>As far as I can tell, the problem seems to be that ( on some machines, my other Gentoo machine installed the package without issue ) multiple threads are trying to access the same files at the same time and erroring. To work around this , I simply installed the package using one thread:</p>
<pre>
MAKEOPTS="-j1" emerge  media-sound/pulseaudio
</pre>
<div class="plus-one-wrap"><g:plusone size="medium" count="false" href="http://www.niftiestsoftware.com/2012/05/12/file-not-recognized-file-truncated/"></g:plusone></div><div class='wpfblike' style='height: 40px;'><fb:like href='http://www.niftiestsoftware.com/2012/05/12/file-not-recognized-file-truncated/' layout='button_count' show_faces='false' width='90' action='like' colorscheme='light' send='false' /></div> <p><a href="http://www.niftiestsoftware.com/?flattrss_redirect&amp;id=559&amp;md5=fb513bb7dae85f909248a54b1458c8b9" title="Flattr" target="_blank"><img src="http://www.niftiestsoftware.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.niftiestsoftware.com/2012/05/12/file-not-recognized-file-truncated/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=netnifty&amp;popout=1&amp;url=http%3A%2F%2Fwww.niftiestsoftware.com%2F2012%2F05%2F12%2Ffile-not-recognized-file-truncated%2F&amp;language=en_GB&amp;category=software&amp;title=file+not+recognized%3A+File+truncated&amp;description=While+attempting+to+upgrade+one+of+my+Gentoo+Linux+machines+to+the+latest+version+of+PulseAudio+%28%C2%A0media-sound%2Fpulseaudio-2.0+%29+today+I+encountered+the+following+error%3A+libtool%3A+install%3A+%2Fusr%2Fbin%2Finstall+-c+.libs%2Flibprotocol-cli.soT+%2Fvar%2Ftmp%2Fportage%2Fmedia-sound%2Fpulseaudio-2.0%2Fimage%2F%2Fusr%2Flib64%2Fpulse-2.0%2Fmodules%2Flibprotocol-cli.so...&amp;tags=pulseaudio%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Printing to Google Cloud Print using CUPS</title>
		<link>http://www.niftiestsoftware.com/2011/10/15/printing-to-google-cloud-print-using-cups/</link>
		<comments>http://www.niftiestsoftware.com/2011/10/15/printing-to-google-cloud-print-using-cups/#comments</comments>
		<pubDate>Sat, 15 Oct 2011 10:50:45 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[cups]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[printing]]></category>

		<guid isPermaLink="false">http://www.niftiestsoftware.com/?p=330</guid>
		<description><![CDATA[I previously blogged about allowing printing to local printers via Google Cloud Print on Gentoo , and recently I have been looking at the opposite of this &#8211; printing to Google Cloud Print from Linux. The main reason to want &#8230; <a href="http://www.niftiestsoftware.com/2011/10/15/printing-to-google-cloud-print-using-cups/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I previously blogged about allowing printing to local printers via <a title="Google Cloud Print on Gentoo" href="http://www.niftiestsoftware.com/2011/05/24/google-cloud-print-on-gentoo/">Google Cloud Print on Gentoo</a> , and recently I have been looking at the opposite of this &#8211; <a title="Google Cloud Print on Linux" href="http://ccp.niftiestsoftware.com/">printing to Google Cloud Print from Linux</a>.<br />
<span id="more-330"></span></p>
<p>The main reason to want to print to Google Cloud Print is for future compatibility with printers within Linux &#8211; it means that any &#8216;Cloud Ready Printer&#8217; can be printed to without having to install possibly closed-source, or non-existent printer drivers.</p>
<p>It also allows printing directly to Google Docs, so you can easily print documents from work straight into your Google Docs account, making archiving documents simple, and easily accessible.</p>
<p>With this in mind, I was looking for a simple CUPS driver, which would allow printing via the normal printing functionality of any application, however this didn&#8217;t seem to exist&#8230; so I decided to write a CUPS backend and driver to support it.</p>
<p>The github project is available <a title="CUPS Cloud Print" href="https://github.com/simoncadman/CUPS-Cloud-Print">here</a> , and I have produced packages for Gentoo ( Sabayon etc ), Debian ( Ubuntu, Mint etc ) , RedHat ( Fedora, Centos, SuSe etc ) and Arch Linux, with instructions <a title="CUPS Cloud Print" href="http://www.niftiestsoftware.com/cups-cloud-print/" target="_blank">here</a>.</p>
<div class="plus-one-wrap"><g:plusone size="medium" count="false" href="http://www.niftiestsoftware.com/2011/10/15/printing-to-google-cloud-print-using-cups/"></g:plusone></div><div class='wpfblike' style='height: 40px;'><fb:like href='http://www.niftiestsoftware.com/2011/10/15/printing-to-google-cloud-print-using-cups/' layout='button_count' show_faces='false' width='90' action='like' colorscheme='light' send='false' /></div> <p><a href="http://www.niftiestsoftware.com/?flattrss_redirect&amp;id=330&amp;md5=89ffff3e829a08e096c24ac4171e7701" title="Flattr" target="_blank"><img src="http://www.niftiestsoftware.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.niftiestsoftware.com/2011/10/15/printing-to-google-cloud-print-using-cups/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=netnifty&amp;popout=1&amp;url=http%3A%2F%2Fwww.niftiestsoftware.com%2F2011%2F10%2F15%2Fprinting-to-google-cloud-print-using-cups%2F&amp;language=en_GB&amp;category=software&amp;title=Printing+to+Google+Cloud+Print+using+CUPS&amp;description=I+previously+blogged+about+allowing+printing+to+local+printers+via+Google+Cloud+Print+on+Gentoo+%2C+and+recently+I+have+been+looking+at+the+opposite+of+this+%26%238211%3B+printing+to...&amp;tags=cloud%2Ccups%2CGentoo%2CLinux%2Cmac%2Cprinting%2Cblog" type="text/html" />
	</item>
		<item>
		<title>error: expected declaration specifiers or ‘&#8230;’ before ‘G_CONST_RETURN’</title>
		<link>http://www.niftiestsoftware.com/2011/09/30/error-expected-declaration-specifiers-or-%e2%80%98-%e2%80%99-before-%e2%80%98g_const_return%e2%80%99/</link>
		<comments>http://www.niftiestsoftware.com/2011/09/30/error-expected-declaration-specifiers-or-%e2%80%98-%e2%80%99-before-%e2%80%98g_const_return%e2%80%99/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 19:02:33 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[glib]]></category>
		<category><![CDATA[pango]]></category>

		<guid isPermaLink="false">http://www.niftiestsoftware.com/?p=318</guid>
		<description><![CDATA[After upgrading a few packages on one of my Gentoo machines, I was greeted with repeated errors like this one, whilst trying to emerge Avahi: /usr/include/pango-1.0/pango/pango-script.h:132: error: expected declaration specifiers or '...' before 'G_CONST_RETURN' /usr/include/pango-1.0/pango/pango-script.h:133: error: expected declaration specifiers or &#8230; <a href="http://www.niftiestsoftware.com/2011/09/30/error-expected-declaration-specifiers-or-%e2%80%98-%e2%80%99-before-%e2%80%98g_const_return%e2%80%99/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After upgrading a few packages on one of my Gentoo machines, I was greeted with repeated errors like this one, whilst trying to emerge Avahi:<br />
<span id="more-318"></span></p>
<pre>/usr/include/pango-1.0/pango/pango-script.h:132: error: expected declaration specifiers or '...' before 'G_CONST_RETURN'
/usr/include/pango-1.0/pango/pango-script.h:133: error: expected declaration specifiers or '...' before 'G_CONST_RETURN'
In file included from /usr/include/pango-1.0/pango/pango-script.h:138,
                 from /usr/include/pango-1.0/pango/pango-gravity.h:98,
                 from /usr/include/pango-1.0/pango/pango-types.h:91,
                 from /usr/include/pango-1.0/pango/pango-font.h:26,
                 from /usr/include/pango-1.0/pango/pango-attributes.h:25,
                 from /usr/include/pango-1.0/pango/pango.h:25,
                 from /usr/include/gtk-2.0/gdk/gdktypes.h:37,
                 from /usr/include/gtk-2.0/gdk/gdkscreen.h:32,
                 from /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:31,
                 from /usr/include/gtk-2.0/gdk/gdk.h:32,
                 from /usr/include/gtk-2.0/gtk/gtk.h:32,
                 from avahi-ui.c:30:</pre>
<p>After doing some research, the problem seems to be that I have recently upgraded to version 2.30.0 of dev-libs/glib, which has removed G_CONST_RETURN . I believe packages in the future will remove references to G_CONST_RETURN , but for now, the best solution is to mask ( or remove from keywords ):</p>
<pre>=dev-libs/glib-2.30.0</pre>
<p>and reinstall the current stable version:</p>
<pre>=dev-libs/glib-2.28.8</pre>
<p>.</p>
<div class="plus-one-wrap"><g:plusone size="medium" count="false" href="http://www.niftiestsoftware.com/2011/09/30/error-expected-declaration-specifiers-or-%e2%80%98-%e2%80%99-before-%e2%80%98g_const_return%e2%80%99/"></g:plusone></div><div class='wpfblike' style='height: 40px;'><fb:like href='http://www.niftiestsoftware.com/2011/09/30/error-expected-declaration-specifiers-or-%e2%80%98-%e2%80%99-before-%e2%80%98g_const_return%e2%80%99/' layout='button_count' show_faces='false' width='90' action='like' colorscheme='light' send='false' /></div> <p><a href="http://www.niftiestsoftware.com/?flattrss_redirect&amp;id=318&amp;md5=d6c2c6ab5e4a26be4f0ee927cf976023" title="Flattr" target="_blank"><img src="http://www.niftiestsoftware.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.niftiestsoftware.com/2011/09/30/error-expected-declaration-specifiers-or-%e2%80%98-%e2%80%99-before-%e2%80%98g_const_return%e2%80%99/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=netnifty&amp;popout=1&amp;url=http%3A%2F%2Fwww.niftiestsoftware.com%2F2011%2F09%2F30%2Ferror-expected-declaration-specifiers-or-%25e2%2580%2598-%25e2%2580%2599-before-%25e2%2580%2598g_const_return%25e2%2580%2599%2F&amp;language=en_GB&amp;category=software&amp;title=error%3A+expected+declaration+specifiers+or+%E2%80%98%26%238230%3B%E2%80%99+before+%E2%80%98G_CONST_RETURN%E2%80%99&amp;description=After+upgrading+a+few+packages+on+one+of+my+Gentoo+machines%2C+I+was+greeted+with+repeated+errors+like+this+one%2C+whilst+trying+to+emerge+Avahi%3A+%2Fusr%2Finclude%2Fpango-1.0%2Fpango%2Fpango-script.h%3A132%3A+error%3A+expected+declaration+specifiers...&amp;tags=compile%2CGentoo%2Cglib%2CLinux%2Cpango%2Cblog" type="text/html" />
	</item>
		<item>
		<title>Converting a VirtualBox VM to an EC2 AMI</title>
		<link>http://www.niftiestsoftware.com/2011/09/24/converting-a-virtualbox-vm-to-an-ec2-ami/</link>
		<comments>http://www.niftiestsoftware.com/2011/09/24/converting-a-virtualbox-vm-to-an-ec2-ami/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 15:05:18 +0000</pubDate>
		<dc:creator>Simon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://www.niftiestsoftware.com/?p=266</guid>
		<description><![CDATA[There are many ways to create a new AMI for use with Amazon EC2, the best solution is to simulate EC2 with a local Xen install, however this sometimes isn&#8217;t possible, so the next best thing is to create a &#8230; <a href="http://www.niftiestsoftware.com/2011/09/24/converting-a-virtualbox-vm-to-an-ec2-ami/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There are many ways to create a new AMI for use with Amazon EC2, the best solution is to simulate EC2 with a local Xen install, however this sometimes isn&#8217;t possible, so the next best thing is to create a VirtualBox based VM, then generate an EC2 AMI from it .<br />
<span id="more-266"></span></p>
<h2>Preparing the Virtual Machine</h2>
<p>The main special requirement for the VirtualBox based VM is that it needs to be configured to boot from a Xen-based kernel. Obviously VirtualBox can&#8217;t boot Xen-dependant kernels, so I usually have two similarly configured kernels, one with Xen support, one without.</p>
<p>Compiling a Linux kernel with Xen support ( at least on Gentoo ) results in a kernel image named &#8216;vmlinuz&#8217; whereas the normal kernel without Xen support creates a kernel ( assuming compressed with bzip ) called &#8216;bzImage&#8217;. I have a Grub config file which tries the Xen-based kernel , then falls back to the normal one if this fails. The only disadvantage to this is I have to compile a kernel twice, once with Xen support, once without, but it allows me to test a kernel with my own configuration before I upload it to the cloud:</p>
<pre>default 0
timeout 1
fallback 1

title Xen
root (hd0,0)
kernel /boot/vmlinuz spinlock=tickless root=/dev/sda1

title Local
root (hd0,0)
kernel /boot/bzImage spinlock=tickless root=/dev/sda1</pre>
<p>Next, remove all data which you don&#8217;t want to upload yourself ( all my sites I am hosting on the image are stored in SVN, which I will just &#8216;svn co&#8217; when the instance is running ), then clean the filesystem (  by filling the empty space with zeros ) to reduce the data we have to upload:</p>
<pre>cat /dev/zero &gt; /tmp/zerofill
sleep 1
sync
rm /tmp/zerofill
sleep 1
sync</pre>
<p>Power off the VM, and we can now create an image we can create an AMI from.</p>
<h2>Creating the Image</h2>
<p>Next, delete all the VirtualBox snapshots for the VM, so the changes get merged into the &#8216;root&#8217; image &#8211; if you do not do this then you get a version of your image before snapshots have happened ( I found this out the hard way when the VM booted with software running that I had long removed ).<br />
Convert the virtualbox VDI to a raw image ( the VDI file is found in ~/.VirtualBox/Machines/machinename/ ):</p>
<pre>VBoxManage internalcommands converttoraw vboximage.vdi ec2.img</pre>
<p>Compress the image, this reduced my image down from 10GB to ~400MB:</p>
<pre>tar cjf image.tar.bz2 ec2.img</pre>
<p>Delete the uncompressed image:</p>
<pre>rm ec2.img</pre>
<h2>Turning the Image into an AMI</h2>
<p>Start up a new Amazon EC2 instance ( you can use any standard EC2 Linux VM for this ), and upload the image using scp (or another method):</p>
<pre>scp image.tar.bz2 user@imagingserver:</pre>
<p>Through the AWS control panel, create a new EBS volume ( ideally the same size as the VirtualBox VM ) and attach it to the instance. Make a note of the volume device name ( in my case /dev/sdi ), and overwrite the EBS volume with the image we have just uploaded:</p>
<pre>tar xf image.tar.bz2 -O | dd of=/dev/sdi bs=10M</pre>
<p>The EC2 volume now has our VM on it. You may notice that although the data has completed being written to the disk, there is no entries in /dev for the partitions. We need to tell Linux to update it&#8217;s partition listing, simply run fdisk against the volume, print the partition table, then write the ( unchanged )  layout:</p>
<pre># fdisk /dev/sdi

Command (m for help): p

Disk /dev/sdi: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xeb52e322

   Device Boot      Start         End      Blocks   Id  System
/dev/sdi1              63    20964824    10482381   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.</pre>
<p>/dev/sdi1 ( in this case ) now exists. Mount the volume to check that it looks sane, then unmount it:</p>
<pre>mkdir /mnt/newimage
mount /dev/sdi1 /mnt/newimage
ls /mnt/newimage
...
umount /mnt/newimage</pre>
<p>Through the AWS control panel, detach the volume, take a snapshot and make a note of the snapshot id. You can delete the volume once the snapshot is complete. Also find the correct snapshot id for your instance from <a href="http://ec2-downloads.s3.amazonaws.com/user_specified_kernels.pdf">this guide</a> then register the image, replacing $SNAPSHOTID, $KERNELID, name and description with your values:</p>
<pre>ec2-register -a x86_64 -n "Name" -d "Description" --root-device-name /dev/sda1 -b /dev/sda=$SNAPSHOTID:10:true --kernel $KERNELID</pre>
<p>You should now be able to start the new instance and have it boot your own customized Linux EC2 AMI.</p>
<div class="plus-one-wrap"><g:plusone size="medium" count="false" href="http://www.niftiestsoftware.com/2011/09/24/converting-a-virtualbox-vm-to-an-ec2-ami/"></g:plusone></div><div class='wpfblike' style='height: 40px;'><fb:like href='http://www.niftiestsoftware.com/2011/09/24/converting-a-virtualbox-vm-to-an-ec2-ami/' layout='button_count' show_faces='false' width='90' action='like' colorscheme='light' send='false' /></div> <p><a href="http://www.niftiestsoftware.com/?flattrss_redirect&amp;id=266&amp;md5=5dd51db8fbb6c50234cdb83ced79fff4" title="Flattr" target="_blank"><img src="http://www.niftiestsoftware.com/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.niftiestsoftware.com/2011/09/24/converting-a-virtualbox-vm-to-an-ec2-ami/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="https://flattr.com/submit/auto?user_id=netnifty&amp;popout=1&amp;url=http%3A%2F%2Fwww.niftiestsoftware.com%2F2011%2F09%2F24%2Fconverting-a-virtualbox-vm-to-an-ec2-ami%2F&amp;language=en_GB&amp;category=software&amp;title=Converting+a+VirtualBox+VM+to+an+EC2+AMI&amp;description=There+are+many+ways+to+create+a+new+AMI+for+use+with+Amazon+EC2%2C+the+best+solution+is+to+simulate+EC2+with+a+local+Xen+install%2C+however+this+sometimes+isn%26%238217%3Bt...&amp;tags=amazon%2Cec2%2CLinux%2Cvirtualbox%2Cblog" type="text/html" />
	</item>
	</channel>
</rss>

