<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>S3hh&#039;s Blog</title>
	<atom:link href="http://s3hh.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://s3hh.wordpress.com</link>
	<description>Just another WordPress.com site</description>
	<lastBuildDate>Wed, 19 Jun 2013 13:15:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='s3hh.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>S3hh&#039;s Blog</title>
		<link>http://s3hh.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://s3hh.wordpress.com/osd.xml" title="S3hh&#039;s Blog" />
	<atom:link rel='hub' href='http://s3hh.wordpress.com/?pushpress=hub'/>
		<item>
		<title>2013 Linux Security Summit CFP closing soon</title>
		<link>http://s3hh.wordpress.com/2013/06/13/2013-linux-security-summit-cfp-closing-soon/</link>
		<comments>http://s3hh.wordpress.com/2013/06/13/2013-linux-security-summit-cfp-closing-soon/#comments</comments>
		<pubDate>Thu, 13 Jun 2013 12:31:26 +0000</pubDate>
		<dc:creator>s3hh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://s3hh.wordpress.com/?p=381</guid>
		<description><![CDATA[Just a short reminder that if you were interested in submitting a talk for the linux security summit, the call for participation (at http://kernsec.org/wiki/index.php/Linux_Security_Summit_2013) will be closing tomorrow, Friday Jun 14. The summit will be held September 19-20 in New &#8230; <a href="http://s3hh.wordpress.com/2013/06/13/2013-linux-security-summit-cfp-closing-soon/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=381&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Just a short reminder that if you were interested in submitting a talk for the linux security summit, the call for participation (at <a href="http://kernsec.org/wiki/index.php/Linux_Security_Summit_2013" rel="nofollow">http://kernsec.org/wiki/index.php/Linux_Security_Summit_2013</a>) will be closing tomorrow, Friday Jun 14.</p>
<p>The summit will be held September 19-20 in New Orleans, co-located with LinuxCon.  Hope to see you there!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s3hh.wordpress.com/381/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s3hh.wordpress.com/381/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=381&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s3hh.wordpress.com/2013/06/13/2013-linux-security-summit-cfp-closing-soon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b3ecb5cf5a86116e89b6ce738bd4091e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s3hh</media:title>
		</media:content>
	</item>
		<item>
		<title>Introducing lxc-snap</title>
		<link>http://s3hh.wordpress.com/2013/05/06/introducing-lxc-snap/</link>
		<comments>http://s3hh.wordpress.com/2013/05/06/introducing-lxc-snap/#comments</comments>
		<pubDate>Mon, 06 May 2013 04:55:58 +0000</pubDate>
		<dc:creator>s3hh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[LXC]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://s3hh.wordpress.com/?p=374</guid>
		<description><![CDATA[lxc-snap: lxc container snapshot management tool BACKGROUND Lxc supports containers backed by overlayfs snapshots. The way this is typically done is to create a container backed by a regular directory, then create a new container which mounts the first container&#8217;s &#8230; <a href="http://s3hh.wordpress.com/2013/05/06/introducing-lxc-snap/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=374&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>lxc-snap: lxc container snapshot management tool</p>
<p>BACKGROUND</p>
<p>Lxc supports containers backed by overlayfs snapshots.  The way this is<br />
typically done is to create a container backed by a regular directory,<br />
then create a new container which mounts the first container&#8217;s rootfs<br />
as a read-only lower mount, with a new private delta directory as<br />
its read-write upper mount.  For instance, you could</p>
<p>	sudo lxc-create -t ubuntu -n r0 # create a normal directory<br />
	sudo lxc-clone -B overlayfs -s r0 o1 # create overlayfs clone</p>
<p>The second container, o1, when started up will mount /var/lib/lxc/o1/delta0<br />
as a writeably overlay on top of /var/lib/lxc/r0/rootfs, and use that as its<br />
root filesystem.</p>
<p>From here you can clone o1 to a new container o2.  This simply copies the<br />
the overlayfs delta from o1 to o2, and you is done with</p>
<p>	sudo lxc-clone -s o1 o2</p>
<p>LXC-SNAP</p>
<p>One of the obvious use cases of these snapshot clones is to support<br />
incremental development of rootfs images.  Make some changes, snapshot,<br />
make some more changes, snapshot, revert&#8230;</p>
<p>lxc-snap is a small program using the lxc API to more easily support<br />
this use case.  You begin with a overlayfs backed container, make some<br />
changes, snapshot, make some changes, snapshot&#8230;  This is a simpler<br />
model than manually using clone because you continue developing the same<br />
container, o1, while the snapshots are kept away until you need them.</p>
<p>EXAMPLE</p>
<p>Create your first container</p>
<p>	sudo lxc-create -t ubuntu -n base<br />
	sudo lxc-clone -s -B overlayfs base mysql</p>
<p>Now make initial customizations, and snapshot:</p>
<p>	sudo lxc-snap mysql</p>
<p>This will create a snapshot container /var/lib/lxcsnaps/mysql_0.  You can actually<br />
start it up if you like using &#8216;sudo lxc-start -P /var/lib/lxcsnaps -n mysql_0&#8242;.<br />
(However, that is not recommended, as it will cause changes in the rootfs)</p>
<p>Next, make some more changes.  Write a comment about the changes you made in this<br />
version,</p>
<p>echo &#8220;Initial definition of table doomahicky&#8221; &gt; /tmp/comment</p>
<p>	sudo lxc-snap -c /tmp/comment mysql</p>
<p>Do this a few times.  Now you realize you lost something you needed.  You can<br />
see the list of containers which have snapshots using</p>
<p>	lxc-snap -l</p>
<p>and the list of versions of container mysql using</p>
<p>	lxc-snap -l mysql</p>
<p>Note that it shows you the time when the snapshot was created, and any comments<br />
you logged with the snapshot.  You see that what you wanted was version 2, so<br />
recover that snapshot.  You can destroy container mysql and restore version 2<br />
to it, or (I would recommend) use a different name to restore the snapshot to.</p>
<p>Use a different name with:</p>
<p>	sudo lxc-snap -r mysql_2 mysql_tmp</p>
<p>or destroy mysql and restore the snapshot to it using</p>
<p>	sudo lxc-destroy -n mysql<br />
	sudo lxc-snap -r mysql_2 mysql</p>
<p>When you&#8217;d like to export a container, you can clone it back to a directory<br />
backed container and tar it up:</p>
<p>	sudo lxc-clone -B dir mysql mysql_ship<br />
	sudo tar zcf /srv/mysql_ship.tar.gz /var/lib/lxc/mysql_ship</p>
<p>BUILD AND INSTALL</p>
<p>To use lxc-snap, you currently need to be using lxc from the ubuntu-lxc<br />
daily ppa.  On an ubuntu system (at least 12.04) you can</p>
<p>	sudo add-apt-repository ppa:ubuntu-lxc/daily<br />
	sudo apt-get update<br />
	sudo apt-get dist-upgrade<br />
	sudo apt-get install lxc</p>
<p>lxc-snap will either become a part of the lxc package, or will become a<br />
separate package.  Currently it is available at<br />
git://github.com/hallyn/lxc-snap.  Fetch it using:</p>
<p>	git clone git://github.com/hallyn/lxc-snap</p>
<p>Then build lxc-snap by typing &#8216;make&#8217;.</p>
<p>	cd lxc-snap<br />
	make</p>
<p>Install into /usr/bin by typing</p>
<p>	sudo DESTDIR=/usr make install</p>
<p>or install into /home/$USER/bin by typing</p>
<p>	mkdir /home/$USER/bin<br />
	DESTDIR=/home/$USER make install</p>
<p>Note that lxc-snap is in very early development.  It&#8217;s usage may<br />
change over time, and as it currently ships a copy of liblxc .h<br />
files it needs, it may occasionally break and need to be updated<br />
from git and rebuilt.  Using a package (as soon as it becomes<br />
available) is recommended.</p>
<p>Note that lxc-snap is in very early development.  It&#8217;s usage may<br />
change over time, and as it currently ships a copy of liblxc .h<br />
files it needs, it may occasionally break and need to be updated<br />
from git and rebuilt.  Using a package (as soon as it becomes<br />
available) is recommended.<br />
 lxc package, or will become a<br />
separate package.  Currently it is available at<br />
git://github.com/hallyn/lxc-snap.  Fetch it using:</p>
<p>	git clone git://github.com/hallyn/lxc-snap</p>
<p>Then build lxc-snap by typing &#8216;make&#8217;.</p>
<p>	cd lxc-snap<br />
	make</p>
<p>Install into /usr/bin by typing</p>
<p>	sudo DESTDIR=/usr make install</p>
<p>or install into /home/$USER/bin by typing</p>
<p>	mkdir /home/$USER/bin<br />
	DESTDIR=/home/$USER make install</p>
<p>Note that lxc-snap is in very early development.  It&#8217;s usage may<br />
change over time, and as it currently ships a copy of liblxc .h<br />
files it needs, it may occasionally break and need to be updated<br />
from git and rebuilt.  Using a package (as soon as it becomes<br />
available) is recommended.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s3hh.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s3hh.wordpress.com/374/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=374&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s3hh.wordpress.com/2013/05/06/introducing-lxc-snap/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b3ecb5cf5a86116e89b6ce738bd4091e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s3hh</media:title>
		</media:content>
	</item>
		<item>
		<title>LXC &#8211; improved clone support</title>
		<link>http://s3hh.wordpress.com/2013/05/02/lxc-improved-clone-support/</link>
		<comments>http://s3hh.wordpress.com/2013/05/02/lxc-improved-clone-support/#comments</comments>
		<pubDate>Thu, 02 May 2013 20:58:14 +0000</pubDate>
		<dc:creator>s3hh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[LXC]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://s3hh.wordpress.com/?p=368</guid>
		<description><![CDATA[Recently I took some time to work on implementing container clones through the lxc API. lxc-clone previously existed as a shell script which could create snapshot clones of lvm and btrfs containers. There were several shortcomings to this: 1. clone &#8230; <a href="http://s3hh.wordpress.com/2013/05/02/lxc-improved-clone-support/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=368&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Recently I took some time to work on implementing container clones through the lxc API.  lxc-clone previously existed as a shell script which could create snapshot clones of lvm and btrfs containers.  There were several shortcomings to this:</p>
<p>1. clone was not exportable through the API (to be used in python, lua, go and c programs).  Now it is, so a Go program can create a container clone in one function call.<br />
2. expanding the set of supported clone types became unsavory<br />
3. overlayfs was only supported as &#8216;ephemeral containers&#8217;, which could be made persistent through the use of pre-mount hooks.  They were not first class citizens.  Now they are.</p>
<p>The result is now in upstream git as well as in the packages at the <a href="https://launchpad.net/~ubuntu-lxc/+archive/daily">ubuntu-lxc/daily ppa</a>.  Supported backing store types currently include dir (directory), lvm, btrfs, overlayfs, and zfs.  Hopefully loop and qemu-nbd will be added soon.  They each are somewhat different due to the nature of the backing store itself, so I&#8217;ll go over each.  However in my opinion the coolest thing you can do with this is:</p>
<p>	# create a stock directory backed container<br />
	sudo lxc-create -t ubuntu -n dir1<br />
	# create an overlayfs snapshot of it<br />
	sudo lxc-clone -s -B overlayfs dir1 s1</p>
<p>The -s argument asks for a snapshot (rather than copy) clone, and -B specifies the backing store type for the new container.  When container s1 starts, it will mount a private writeable overlay (/var/lib/lxc/dir1/delta0) over a readonly mount of the original /var/lib/lxc/dir1/rootfs.</p>
<p>Now make some changes to start customizing s1.  Checkpoint that state by cloning it:</p>
<p>	sudo lxc-clone -s s1 s2</p>
<p>This will reference the same rootfs (/var/lib/lxc/dir1/rootfs) and rsync the overlayfs delta from s1 to s2.  Now you can keep working on s1, keeping s2 as a checkpoint.  Make more changes, and create your next snapshot</p>
<p>	sudo lxc-clone -s s1 s3<br />
	&#8230;<br />
	sudo lxc-clone -s s1 s4<br />
	&#8230;</p>
<p>If at some point you realize you need to go back to an older snapshot, say s3, then you can</p>
<p>	sudo lxc-clone -s s1 s1_bad  # just to make sure<br />
	sudo lxc-destroy -n s1<br />
	sudo lxc-clone -s s3 s1</p>
<p>and pick up where you left off.  Finally, if you&#8217;re happy and want to tar up what you have to ship it or copy to another machine, clone it back to a directory backed container:</p>
<p>	sudo lxc-clone -B dir s1 dir_ship<br />
	sudo tar zcf /var/lib/lxc/dir_ship.tgz /var/lib/lxc/dir_ship</p>
<p>So far I&#8217;ve shown dir (directory) backing store and overlayfs.  Specific to directory backed containers is that they cannot be snapshotted, except by converting them to overlayfs backed containers.  Specific to overlayfs containers is that the original directory backed container must not be deleted, since the snapshot depends on it.  (I&#8217;ll address this soon, marking the snapshotted container so that lxc-destroy will leave it alone, but that is not yet done)</p>
<p>To use btrfs containers, the entire lxc configuration path must be btrfs.  However since the configuration path is flexible, that&#8217;s not as bad as it used to be.  For instance, I mounted a btrfs at $HOME/lxcbase, then did</p>
<p>	sudo lxc-create -t ubuntu -P $HOME/lxcbase -n b1</p>
<p>(The &#8216;-P&#8217; argument chooses a custom &#8216;lxcpath&#8217;, or lxc configuration path, than the default /var/lib/lxc.  You can also specify a global default other than /var/lib/lxc in /etc/lxc/lxc.conf.) lxc-create detects the btrfs and automatically makes the container a new subvolume, which can then be snapshotted</p>
<p>	sudo lxc-clone -s b1 b2</p>
<p>For zfs, a zfsroot can be specified in /etc/lxc/lxc.conf.  I created a zfs pool called &#8216;lxc&#8217; (which is actually the default for the lxc tools, so I did not list it in /etc/lxc/lxc.conf), then did</p>
<p>	sudo lxc-create -B zfs -t ubuntu -n z1<br />
or<br />
	sudo lxc-clone -B zfs dir1 z1</p>
<p>This created &#8216;lxc/z1&#8242; as a new zfs fs and mounted it under /var/lib/lxc/z1/rootfs.  Next I could</p>
<p>	sudo lxc-clone -s z1 z2</p>
<p>Now lxc-destroy needs some smarts still built-in to make zfs backed containers easier to destroy.  That is because when lxc-clone creates z2 from z1, it must first create a snapshot &#8216;lxc/z1@z2&#8242;, then clone that to &#8216;lxc/z2&#8242;.  So before you can destroy z1, you currently must</p>
<p>	sudo lxc-destroy -n z2<br />
	sudo zfs destroy lxc/z1@x2</p>
<p>Finally, you can also use LVM.  LVM snapshot container clones have been supported longer than any others (with btrfs being second).  I like the fact that you can use any filesystem inside the LV.  However, the two major shortcomings are that you cannot snapshot a snapshot, and that you must (depending at least on the filesystem type) choose a filesystem size in advance.</p>
<p>To clone LVM conatiners, you either need a vg called &#8216;lxc&#8217;, or you can specify a default vg in /etc/lxc/lxc.conf.  You can create the initial lvm container with</p>
<p>	sudo lxc-create -t ubuntu -n lvm1 &#8211;fssize 2G &#8211;fstype xfs<br />
or<br />
	sudo lxc-clone -B lvm dir1 lvm1</p>
<p>Then snapshot it using</p>
<p>	sudo lxc-clone -s lvm1 lvm2</p>
<p>Note that unlike overlayfs, snapshots in zfs, btrfs, and lvm are safe from having the base container destroyed.  In btrfs, that is because the btrfs snapshot is metadata based, so destroying the base container simply does not delete any of the data in use by the snapshot container.  LVM and zfs both will note that there are active snapshots of the base rootfs and prevent the base container from being destroyed.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s3hh.wordpress.com/368/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s3hh.wordpress.com/368/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=368&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s3hh.wordpress.com/2013/05/02/lxc-improved-clone-support/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b3ecb5cf5a86116e89b6ce738bd4091e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s3hh</media:title>
		</media:content>
	</item>
		<item>
		<title>gtd &#8211; managing projects</title>
		<link>http://s3hh.wordpress.com/2013/04/19/gtd-managing-projects/</link>
		<comments>http://s3hh.wordpress.com/2013/04/19/gtd-managing-projects/#comments</comments>
		<pubDate>Fri, 19 Apr 2013 03:05:04 +0000</pubDate>
		<dc:creator>s3hh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gtd]]></category>

		<guid isPermaLink="false">http://s3hh.wordpress.com/?p=363</guid>
		<description><![CDATA[I learned about GTD 5 or 8 years ago, and pretty immediately was trying to use it. Ever since then I keep all of my information in one gtd folder, with Projects and Reference folders, a nextactions file, etc. I&#8217;ve &#8230; <a href="http://s3hh.wordpress.com/2013/04/19/gtd-managing-projects/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=363&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I learned about GTD 5 or 8 years ago, and pretty immediately was trying to use it.  Ever since then I keep all of my information in one gtd folder, with Projects and Reference folders, a nextactions file, etc.  I&#8217;ve blogged before about my tickler file, which frankly rocks and never lets me down.</p>
<p>However, a few months ago I decided I wasn&#8217;t happy with my nextactions file.  Sitting down for a bit to think about it, it was clear that the following happens:  some new project comes in.  I only have time to jot a quick note, so I do so in nextactions.  Later, another piece of information comes in, so I add it there.  Over time, my nextactions files grows and is no longer a nextactions file.</p>
<p>I briefly tried simply not using the Projects/ directory, and keeping a indented/formatted structure in the nextactions file.  But that does not work out &#8211; I spend most of my time either gazing at too much information, or/and ignoring parts which I hadn&#8217;t been working on recently.  (I also briefly tried <a href="http://people.duke.edu/~dgraham/ETM/">ETM</a> and <a href="http://vicerveza.homeunix.net/~viric/soft/bug/">bug</a> which both are *very* neat, but they similarly didn&#8217;t work for me for GTD.)</p>
<p>I have a Projects directory, so why am I not using it?  Doing so takes several steps (think of a name, make the directory, open a file in it, make the notes, exit) and after that I don&#8217;t have a good system for managing the project files.  Looking at a project again involves several steps &#8211; cd into gtd/Projects, look around, cd , look again.  Clearly, project files needed better tools.</p>
<p>So I wrote up a simple &#8216;project&#8217; script, with a corresponding bash_completion file.  If info comes in for a trip I have to take in a few months, I can simply</p>
<pre>
	project start trip-sandiego-201303
</pre>
<p>or</p>
<pre>
	p s trip-sandiego-201303
</pre>
<p>This creates the project directory and opens vim with three buffers, for each of the three files &#8211; a summary, actions, and log.  (&#8216;project new&#8217; will create without pulling up vim with those files.)  Later, I can</p>
<pre>
	project list
</pre>
<p>or (for short)</p>
<pre>
	p l
</pre>
<p>to list all open projects,</p>
<pre>
	p e tr&lt;tab&gt;
</pre>
<p>to edit the project &#8211; which again opens the same files, or</p>
<pre>
	p cat tr&lt;tab&gt;
</pre>
<p>to cat the files to stdout.  I&#8217;ve added a &#8216;Postponed&#8217; directory for projects which are on hold, so I can</p>
<pre>
	project postpone trip-sandiego-201303
</pre>
<p>or just</p>
<pre>
	p po tr&lt;tab&gt;
</pre>
<p>to temporarily move the project folder into Postponed, or</p>
<pre>
	p complete tr&lt;tab&gt;
</pre>
<p>to move the project folder into the Completed/ directory.</p>
<p>I&#8217;ve been using this for a few months now, and am very happy with the result.  The scipt and completion file are in <a href="https://code.launchpad.net/~serge-hallyn/+junk/gtdproject">lp:~serge-hallyn/+junk/gtdproject</a>.  It&#8217;s really not much, but so useful!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s3hh.wordpress.com/363/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s3hh.wordpress.com/363/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=363&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s3hh.wordpress.com/2013/04/19/gtd-managing-projects/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b3ecb5cf5a86116e89b6ce738bd4091e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s3hh</media:title>
		</media:content>
	</item>
		<item>
		<title>Qemu updates in raring</title>
		<link>http://s3hh.wordpress.com/2013/03/11/qemu-updates-in-raring/</link>
		<comments>http://s3hh.wordpress.com/2013/03/11/qemu-updates-in-raring/#comments</comments>
		<pubDate>Mon, 11 Mar 2013 18:32:32 +0000</pubDate>
		<dc:creator>s3hh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[kvm]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://s3hh.wordpress.com/?p=351</guid>
		<description><![CDATA[The raring feature freeze took effect last week. What&#8217;s been happening with qemu in the meantime? A lot! I&#8217;ll touch on the following main changes in this post: package reorg, spice support, hugepages, uefi, and rbd support. * package reorg &#8230; <a href="http://s3hh.wordpress.com/2013/03/11/qemu-updates-in-raring/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=351&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The raring feature freeze took effect last week.  What&#8217;s been happening with qemu in the meantime?</p>
<p>A lot!  I&#8217;ll touch on the following main changes in this post:  package reorg, spice support, hugepages, uefi, and rbd support.</p>
<p>* package reorg</p>
<p>Perhaps best to begin with a bit of Ubuntu qemu packaging history.  In hardy (before my time) Ubuntu shipped with separate qemu and kvm packages.  This reflected the separate upstream qemu and kvm source trees.  In August of 2009, upstream was already talking about merging the two trees, and Dustin Kirkland started a new qemu-kvm Ubuntu package which provided both qemu and kvm.</p>
<p>In 2010, a new &#8216;qemu-linaro&#8217; source package was created in universe, to provide qemu with more bleeding-edge arm support from linaro.  Eventually the qemu-kvm package provided the i386 and amd64 qemu-system binaries, qemu-common, and qemu-utils.  All other target architecture system binaries, plus all qemu-user binaries, plus qemu-kvm-spice, came from qemu-linaro.  This is clearly non-ideal from many viewpoints, and especially QA testing and bug duplication.  But any reorganization would have to make sure that upgrades work seamlessly for raring-raring, quantal-raring, and future LTS-to-LTS upgrades, for the many commonly used packages (qemu-kvm, qemu on various packages, and qemu-user).</p>
<p>In the traditional 6-month-plus-LTS Ubuntu cycle, raring was a good time (not too close to next LTS) to try to straighten that out.  It was also a good time in that upstream qemu and kvm were now very close together, and especially in that the wonderfully helpful debian qemu team which was also starting to merge debian&#8217;s qemu and qemu-kvm sources into a new qemu source tree in debian experimental.</p>
<p>And so, it&#8217;s done!  The qemu-linaro and qemu-kvm source packages have been merged into qemu.  Most arm patches from linaro are in our package, but you can still run linaro&#8217;s qemu from ppa at <a href="https://launchpad.net/~linaro-maintainers/+archive/tools/" rel="nofollow">https://launchpad.net/~linaro-maintainers/+archive/tools/</a>.  The Ubuntu and Debian teams are working together, which should mean more stable packages in both, and combined resources in addressing bugs.  Thanks especially to Michael Tokarev for helping to review the Ubuntu delta, and to infinity for more than once helping to figure out packaging issues I couldn&#8217;t have figured out on my own.</p>
<p>* Spice support.  Spice has finally made it into main!  The qemu package in main therefore finally supports spice, without having to install a separate qemu-kvm-spice package.  As a simple example, if you used to do:</p>
<p>	kvm -vga vmware -vnc :1</p>
<p>then you can use spice by doing:</p>
<p>	kvm -vga qxl -spice port=5900,disable-ticketing</p>
<p>then connect with spicec or spicy:</p>
<p>	spicec -h hostname -p 5900</p>
<p>3. Transparent hugepages.  The 1.4.0 qemu release includes support for transparent hugepages.  This means that when hugepages are available, qemu instances migrate some memory pages from regular to huge pages.  Hugepages offer performance improvements due to (1) requiring fewer TLB entries for the same amount of memory, (2) requiring fewer lookups per page, and (3) requiring fewer page faults for nearby memory references (since each memory page is much larger).</p>
<p>4. Hugetlbfs mount.  While transparent hugepages are convenient, if you want a particular vm to run with hugepages backing the whole VM, you will want to use dedicated hugepages.  To do this, simply set KVM_HUGEPAGES to 1 in /etc/init/qemu-kvm.conf, then add an entry to /etc/sysctl.conf like:</p>
<p>	vm.nr_hugepages = 512</p>
<p>(for 1G of hugepages &#8211; 512 2M pages).  Make sure to leave at least around 1G of memory not dedicated to hugepages.  Then add the arguments</p>
<p>	-mem-path /run/hugepages/kvm</p>
<p>to your kvm command.  Dedicated hugepages are not new, but the automatic mounting of the /sys/hugepages/kvm is.</p>
<p>6. UEFI.  If you install the ovmf package, then you can run qemu with a UEFI bios (to test secureboot, for instance) by adding the &#8216;-bios OVMF.fd&#8217; arguments to kvm.  As was pointed out during vUDS there are some bugs to work out to make this seamless.</p>
<p>5. rbd.  Ok this has been enabled since precise, but it&#8217;s still cool.  You can use a ceph cluster to back your kvm instances (as an alternative to, say, nfs) to easily enable live migration.  Just</p>
<p>	qemu-img create -f rbd rbd:pool/vm1 10G<br />
	kvm -m 512 -drive format=rbd,file=rbd:pool/vm1 -cdrom raring.iso -boot d</p>
<p>See <a href="http://ceph.com/docs/master/rbd/qemu-rbd/" rel="nofollow">http://ceph.com/docs/master/rbd/qemu-rbd/</a> for more information.</p>
<p>So there&#8217;s what I can think of that is new in qemu this cycle.  I hope you all enjoy, and if you find upgrading issues please do raise a bug.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s3hh.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s3hh.wordpress.com/351/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=351&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s3hh.wordpress.com/2013/03/11/qemu-updates-in-raring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b3ecb5cf5a86116e89b6ce738bd4091e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s3hh</media:title>
		</media:content>
	</item>
		<item>
		<title>Experimenting with user namespaces</title>
		<link>http://s3hh.wordpress.com/2013/03/07/experimenting-with-user-namespaces/</link>
		<comments>http://s3hh.wordpress.com/2013/03/07/experimenting-with-user-namespaces/#comments</comments>
		<pubDate>Thu, 07 Mar 2013 21:42:13 +0000</pubDate>
		<dc:creator>s3hh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[containers]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://s3hh.wordpress.com/?p=343</guid>
		<description><![CDATA[User namespaces are a really neat feature, but there are some subtleties involved which can make them perplexing to first play with. Here I&#8217;m going to show a few things you can do with them, with an eye to explaining &#8230; <a href="http://s3hh.wordpress.com/2013/03/07/experimenting-with-user-namespaces/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=343&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>User namespaces are a really neat feature, but there are some subtleties involved which can make them perplexing to first play with.  Here I&#8217;m going to show a few things you can do with them, with an eye to explaining some of the things which might otherwise be confusing.</p>
<p>First, you&#8217;ll need a bleeding edge kernel.  A 3.9 kernel hand-compiled with user namespace support should be fine (some of the latest missing patches aren&#8217;t needed for these games as we won&#8217;t be creating full system containers).  But for simplicity, you can simply fire up a new raring box and do:</p>
<p>	sudo add-apt-repository ppa:ubuntu-lxc/kernel<br />
	sudo apt-get update<br />
	sudo apt-get dist-upgrade</p>
<p>Now get a few tools from my ppa &#8211; you can of course get the source for all from either the ppa, or from my bzr trees.</p>
<p>	sudo add-apt-repository ppa:serge-hallyn/user-natty<br />
	sudo apt-get update<br />
	sudo apt-get dist-upgrade<br />
	sudo apt-get install nsexec uidmap</p>
<p>Now let&#8217;s try a first experiment.  Run the following program from nsexec:</p>
<p>	usernsselfmap</p>
<p>This is a simple program which forks a child which runs as root in a new user namespace.  Here a brief reminder of how user namespaces are designed is in order.  When a new user namespace is created, the task populating it starts as userid -1, nobody.  At this point it has full privileges (POSIX capabilities), but those capabilities can only be used toward resources owned by the new namespace.  Furthermore, the privileges will be lost as soon as the task runs exec(3) of a normal file.  See the capabilities(7) manpage for an explanation.</p>
<p>At this point, userids from the parent namespace may be mapped into the child.  For instance, one might map userids 0-9999 in the child to userids 100000-109999 on the host.  This is done by writing values to /proc/pid/uid_map (and analogously to /proc/pid/gid_map).  The task writing to the map files must have privilege over the parent uids being mapped in.</p>
<p>This is where usernsselfmap comes in.  You currently do not have privilege over userids on the host &#8211; except your own.  usernsselfmap simply maps uid 0 in the container to your own userid on the host.  Then it changes to gid and uid 0, and finally executes a shell.</p>
<p>Now look around this shell</p>
<p>	ifconfig<br />
	ifconfig eth0 down</p>
<p>Note that even though you have CAP_SYS_ADMIN, you cannot change the host&#8217;s network settings.  However, you can now unshare a new network namespace (still without having privilege on the host) and create network devices in that namespace</p>
<p>	nsexec -cmn /bin/bash<br />
	ifconfig<br />
	ip link add type veth<br />
	ifconfig veth0 10.0.0.1 up<br />
	ifconfig -a</p>
<p>Note also that you can&#8217;t read under /root.  But you can mount a new mounts namespace and mount your $HOME onto /root</p>
<p>	ls /root<br />
	# permission denied<br />
	nsexec -m /bin/bash<br />
	mount &#8211;bind $HOME /root<br />
	ls root<br />
	# homedir contents</p>
<p>Now, in addition to the kernel implementation of user namespaces, Eric Biederman has also provided a patchset against shadow to add a concept of subuids and subgids.  Briefly, you can modify login.defs to say that every new user should be allocated 10000 (unique) uids and gids above 100000.  Then when you add a new user, it will automatically receive a set of 10000 unique subuids.  These allocations are stored in /etc/subuid and /etc/subgid, and two new setuid-root binaries, newuidmap and newgidmap (which are shipped in the uidmap binary package, generated from the shadow source package) may be used by an unprivileged user to map userids in a child user namespace to his allocated subuids on the host.</p>
<p>To conclude this post, here is an example of using the new shadow package along with nsexec to manually create a user namespace with more than one userid.  First, use usermod to allocate some subuids and subgids for your user (who I&#8217;ll assume is user &#8216;ubuntu&#8217; on an ec2 host) since it likely was created before subuids were configured:</p>
<p>	sudo usermod ubuntu -v 110000-120000 -W 110000-120000</p>
<p>Now open two terminals as user ubuntu (or a split byobu screen).  In the one, run</p>
<p>	nsexec -UW -s 0 -S 0 /bin/bash<br />
	  about to unshare with 10000000<br />
	  Press any key to exec (I am 5358)</p>
<p>You&#8217;ve asked nsexec to unshare its user namespace (-U), to wait for a keypress before executing /bin/bash (-W), and to switch to userid 0 (-s 0) and groupid 0 (-S 0) before starting that shell.  In this example nsexec tells you it is process id 5358, so that you can map userids to it.  So from the other shell do:</p>
<p>	newuidmap 5358 0 110000 10000<br />
	newgidmap 5358 0 110000 10000</p>
<p>Now hit return in the nsexec window, and you will see something like:</p>
<p>	root@server:~#</p>
<p>Now you can play around as above, but unlike above, you can also switch to userids other than root.</p>
<p>	root@server:~# newuidshell 1001<br />
	ubuntu2@server:~/nsexec</p>
<p>But since we&#8217;ve not set up a proper container (or chroot), and since our userid maps to 111001, which is not 1001, we can&#8217;t actually write to ubuntu2&#8242;s files or read any files which are not world readable.</p>
<p>This then will be the basis of ongoing and upcoming work to facility unprivileged users creating and using containers.  Exciting!</p>
<p>(One note:  I am here using an old toy &#8216;nsexec&#8217; for manipulating namespaces.  This will eventually be deprecated in favor of the new programs in upstream util-linux.  However there has not yet been a release of util-linux with those patches, so they are not yet in the ubuntu package.)</p>
<p>The source tree for the modified shadow package is at <a href="https://code.launchpad.net/~serge-hallyn/ubuntu/raring/shadow/shadow-userns">lp:~serge-hallyn/ubuntu/raring/shadow/shadow-userns</a> and source for utilities in the nsexec package is at <a href="https://code.launchpad.net/~serge-hallyn/+junk/nsexec">lp:~serge-hallyn/+junk/nsexec</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s3hh.wordpress.com/343/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s3hh.wordpress.com/343/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=343&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s3hh.wordpress.com/2013/03/07/experimenting-with-user-namespaces/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b3ecb5cf5a86116e89b6ce738bd4091e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s3hh</media:title>
		</media:content>
	</item>
		<item>
		<title>User Namespaces LXC meeting</title>
		<link>http://s3hh.wordpress.com/2013/02/12/user-namespaces-lxc-meeting/</link>
		<comments>http://s3hh.wordpress.com/2013/02/12/user-namespaces-lxc-meeting/#comments</comments>
		<pubDate>Tue, 12 Feb 2013 19:39:54 +0000</pubDate>
		<dc:creator>s3hh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[LXC]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://s3hh.wordpress.com/?p=340</guid>
		<description><![CDATA[Last week we held an irc meeting to talk about user namespaces as they relate to lxc containers. The IRC log is posted at https://wiki.ubuntu.com/LxcUsernsIrcChat . I had two goals for this meeting. The first was to make sure that &#8230; <a href="http://s3hh.wordpress.com/2013/02/12/user-namespaces-lxc-meeting/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=340&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Last week we held an irc meeting to talk about user namespaces as they relate to lxc containers.  The IRC log is posted at <a href="https://wiki.ubuntu.com/LxcUsernsIrcChat" rel="nofollow">https://wiki.ubuntu.com/LxcUsernsIrcChat</a> .</p>
<p>I had two goals for this meeting.  The first was to make sure that lxc developers were familiar with user namespaces, so that as new patches started rolling in to accomodate user namespaces, more people might be inclined to review them &#8211; and spot my silly errors.  The other was to discuss some design issues in the lxc code.</p>
<p>I began with some background on user namespaces, their design, motivation, and current status, topped off by a little demo on ec2.  Then we proceeded to discuss future needed changes.</p>
<p>There are two terrific advantages to using user namespaces.</p>
<p>The first is that host resources are not subject to privilege in the container.  That is, root in the container is not root on the host, and a fully privileged task in a container cannot exert any privilege over any resources which are not owned by the container.  This advantage is fully realized right now when using lxc with a custom kernel, as per <a href="http://s3hh.wordpress.com/2012/10/31/full-ubuntu-container-confined-in-a-user-namespace" rel="nofollow">http://s3hh.wordpress.com/2012/10/31/full-ubuntu-container-confined-in-a-user-namespace</a>.  By the time raring is released, I hope for the stock raring lxc, with a custom kernel from ppa:ubuntu-lxc/kernels, to be usable in place of my personal ppa.</p>
<p>The second advantage of user namespaces is that they will allow unprivileged users to create and use containers.  There are little things which will require privilege &#8211; like mapping userids into the container, and hooking the container&#8217;s network interface somehow into the host.  Each of those can be enabled by small privileged helpers and configured in advance (and generically).   So that, by 14.04 LTS, an unprivileged user should be able to safely, out of the box, do</p>
<p>        lxc-create -t ubuntu -n r1<br />
        lxc-start -n r1</p>
<p>This should also be tremendously helpful for safer usage of juju with local provider.</p>
<p>The steps needed (or, at least, hopefully most of them) to get to that point are discussed in the meeting log above.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s3hh.wordpress.com/340/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s3hh.wordpress.com/340/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=340&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s3hh.wordpress.com/2013/02/12/user-namespaces-lxc-meeting/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b3ecb5cf5a86116e89b6ce738bd4091e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s3hh</media:title>
		</media:content>
	</item>
		<item>
		<title>Call for testing: new qemu packages for raring</title>
		<link>http://s3hh.wordpress.com/2012/12/09/call-for-testing-new-qemu-packages-for-raring/</link>
		<comments>http://s3hh.wordpress.com/2012/12/09/call-for-testing-new-qemu-packages-for-raring/#comments</comments>
		<pubDate>Sun, 09 Dec 2012 05:13:20 +0000</pubDate>
		<dc:creator>s3hh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[kvm]]></category>
		<category><![CDATA[qemu]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://s3hh.wordpress.com/?p=334</guid>
		<description><![CDATA[tl;dr If you use qemu, kvm, or qemu-user in raring, please test the candidate packages in ppa:serge-hallyn/crossc. Background The qemu and kvm projects historically had somewhat different code bases with some different features and advantages. For years they have been &#8230; <a href="http://s3hh.wordpress.com/2012/12/09/call-for-testing-new-qemu-packages-for-raring/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=334&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>tl;dr</p>
<p>If you use qemu, kvm, or qemu-user in raring, please test the candidate packages in ppa:serge-hallyn/crossc.</p>
<p>Background</p>
<p>The qemu and kvm projects historically had somewhat different code bases with some different features and advantages.  For years they have been trying to merge the bases, and now they are just about there.</p>
<p>There was also divergence between the Debian and Ubuntu packages.  The Ubuntu functionality was offered through two source packages &#8211; qemu-kvm in main, and qemu-linaro in universe.  The qemu-kvm tree provided kvm binaries for x86 and amd64, while qemu-linaro provided everything else.  The qemu-linaro tree also provided bleeding edge arm patches which were not yet in upstream qemu-kvm or qemu trees.</p>
<p>The wonderful Debian qemu team has an experimental set of packages to use the 1.2 upstream qemu to replace both qemu and qemu-kvm.  The packages in ppa:serge-hallyn/crossc are based on that tree.  They have: some packaging changes to accommodate upgrades from our current packaging layouts (thanks to stgraber, slangasek and infinity for help with some thorny issues);  changes to reflect things which are not in main in Ubuntu;  and additional arm patches from the qemu-linaro 1.2 tree.  With these packages, we will be able to collaborate much more closely with the Debian team.</p>
<p>I&#8217;d like to get these packages into the archive no later than early January.  Therefore, if at all possible, please do test the candidate packages, both for clean upgrades from your current setup to the new package layout (in other words, looking for errors when doing &#8216;apt-get dist-upgrade&#8217;) and for regression bugs in qemu itself.</p>
<p>To test, do the following in a raring install:</p>
<p>	sudo add-apt-repository ppa:serge-hallyn/crossc<br />
	sudo apt-get update</p>
<p>and then either</p>
<p>	sudo apt-get dist-upgrade</p>
<p>if you already had the packages you are interested in installed, or</p>
<p>	sudo apt-get install qemu-system # qemu-user and qemu-user-static if you want those</p>
<p>Please feel free to report those here or the Ubuntu-server mailing list.</p>
<p>Thanks!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s3hh.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s3hh.wordpress.com/334/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=334&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s3hh.wordpress.com/2012/12/09/call-for-testing-new-qemu-packages-for-raring/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b3ecb5cf5a86116e89b6ce738bd4091e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s3hh</media:title>
		</media:content>
	</item>
		<item>
		<title>Full Ubuntu container confined in a user namespace</title>
		<link>http://s3hh.wordpress.com/2012/10/31/full-ubuntu-container-confined-in-a-user-namespace/</link>
		<comments>http://s3hh.wordpress.com/2012/10/31/full-ubuntu-container-confined-in-a-user-namespace/#comments</comments>
		<pubDate>Wed, 31 Oct 2012 07:53:22 +0000</pubDate>
		<dc:creator>s3hh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[LXC]]></category>
		<category><![CDATA[userns]]></category>

		<guid isPermaLink="false">http://s3hh.wordpress.com/?p=330</guid>
		<description><![CDATA[I&#8217;ve mentioned user namespaces here before, and shown how to play a bit with them. When a task is cloned into a new user namespace, the uids in the namespace can be mapped (1-1, in blocks) to uids on the &#8230; <a href="http://s3hh.wordpress.com/2012/10/31/full-ubuntu-container-confined-in-a-user-namespace/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=330&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve mentioned user namespaces here before, and shown how to play a bit with them.  When a task is cloned into a new user namespace, the uids in the namespace can be mapped (1-1, in blocks) to uids on the host &#8211; for instance uid 0 in the container could be uid 100000 on the host.  The uids are translated at the kernel-userspace boundary (i.e. stat, etc), and capabilities for a namespaced task are only valid against objects owned by that namespace.  The result is that root in a container is unprivileged on the host.</p>
<p>Eric has been making great progress in moving the kernel functionality upstream.  With the newest 3.7 based ubuntu kernel, plus a few of his not yet merged patches, a milestone has been reached &#8211; it&#8217;s now possible to run a full ubuntu container in a user namespace!</p>
<p>First start up a fresh, uptodate quantal vm or instance.  Install my user namespace ppa, install the kernel and nsexec packages from there, create a container, and convert it to be namespaced:</p>
<p>	sudo add-apt-repository ppa:serge-hallyn/userns-natty<br />
	sudo apt-get update<br />
	sudo apt-get dist-upgrade<br />
	sudo apt-get install linux-image-3.7.0-0-generic nsexec lxc<br />
	sudo lxc-create -t ubuntu -n q1<br />
	sudo container-userns-convert q1 100000<br />
	sudo reboot</p>
<p>The &#8216;container-userns-convert&#8217; script just shifts the user and group ids of file owners in the container rootfs, and adds two lines to the container configuration file to tell lxc to clone the new user namespace and set up the uid/gid mappings.</p>
<p>Now you can start the container,</p>
<p>	sudo lxc-start -n q1 -d<br />
	sudo lxc-console -n q1</p>
<p>Look around the container, sudo bash; notice that it looks like a normal system, with ubuntu as uid 1000, root as uid 0.  But look from the host, and you see root tasks in the container are actually running as uid 100000, and ubuntu ones as uid 100000.</p>
<p>There are a few oddnesses (you can sudo on ttys 1-4, but sometimes it fails on /dev/console, and shutdown in the container does not kill init); the lxc package needs a few more changes (the cgroup setup needs to be moved to the container parent); and plenty of things are not yet allowed by the kernel (mounting an ext4 filesystem).</p>
<p>But this is a full Ubuntu image, confined by a private user namespace!</p>
<p>After working out some kinks, we&#8217;ll next want to look into container startup by unprivileged users.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s3hh.wordpress.com/330/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s3hh.wordpress.com/330/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=330&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s3hh.wordpress.com/2012/10/31/full-ubuntu-container-confined-in-a-user-namespace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b3ecb5cf5a86116e89b6ce738bd4091e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s3hh</media:title>
		</media:content>
	</item>
		<item>
		<title>deploying multiple (connected) lxc compute nodes &#8211; with juju</title>
		<link>http://s3hh.wordpress.com/2012/10/23/deploying-multiple-connected-lxc-compute-nodes-with-juju/</link>
		<comments>http://s3hh.wordpress.com/2012/10/23/deploying-multiple-connected-lxc-compute-nodes-with-juju/#comments</comments>
		<pubDate>Tue, 23 Oct 2012 20:36:03 +0000</pubDate>
		<dc:creator>s3hh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[juju]]></category>
		<category><![CDATA[LXC]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://s3hh.wordpress.com/?p=321</guid>
		<description><![CDATA[This post got delayed a bit due to a few unexpected complications. First, it turns out that you cannot connect GRE tunnels in Amazon&#8217;s EC2 over the instances&#8217; private addresses. You must use the public addresses. Second, quantal removed the &#8230; <a href="http://s3hh.wordpress.com/2012/10/23/deploying-multiple-connected-lxc-compute-nodes-with-juju/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=321&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This post got delayed a bit due to a few unexpected complications.  First, it turns out that you cannot connect GRE tunnels in Amazon&#8217;s EC2 over the instances&#8217; private addresses.  You must use the public addresses.  Second, quantal removed the openvswitch-datapath-dkms package because the openvswitch kernel module is now available upstream.  However it turns out that the upstream openvswitch module does not yet provide GRE tunnels configurable through the db.  Therefore hopefully the openvswitch-datapath-dkms package will soon be reintroduced, but meanwhile we will use it from the inestimable James Page&#8217;s &#8220;junk&#8221; ppa.</p>
<p>Oh, but first things second.  What are we doing today?  We&#8217;re going to use juju to fire off a set of lxc compute nodes, pre-populated with LVM backed pristine containers which can be very quickly cloned, and which will be able to communicate over an openvswitch private network no matter which compute node hosts them.</p>
<p>My use case for this is to set up for a long varied bug triage and replication session.  It takes about 10-20 minutes (much longer on amazon, but setting a local mirror in /etc/default/lxc should speed that up there) to initially set up, after which starting a new container takes about 3 seconds.</p>
<p>There are two bzr trees involved.  The actual juju charm is at lp:~serge-hallyn/charms/quantal/ovs-lxc/trunk.  It relates one master compute node to any number of slave nodes.  The master node will be used just as the slave ones, but is set apart to be the central openvswitch hub.  So every slave will have a GRE tunnel to the master, and slaves can talk to each other over two GRE links (through the master).  (You&#8217;ll want to check this out under ~/charms/quantal, i.e. &#8220;mkdir -p ~/charms/quantal; cd ~/charms/quantal; bzr branch lp:~serge-hallyn/charms/quantal/ovs-lxc/trunk ovs-lxc;&#8221;)</p>
<p>The other bzr tree is lp:~serge-hallyn/+junk/jujulxcscripts.  The first script here is &#8216;juju-deploy-lxc&#8217;, which accepts a number of slaves to start, boostraps juju, deploys the nodes, and relates each slave to the master.  It finally runs &#8216;grabnodes&#8217; which will gather information used by the other scripts.</p>
<p>Next, &#8216;startcontainer&#8217; will clone and start a new container.  It rotates round robin among the master and slaves each time it is invoked.  With no arguments it will start an amd64 quantal container.  It can also be called as</p>
<p>	startcontainer precise</p>
<p>or<br />
	startcontainer quantal i386</p>
<p>for the obvious result.</p>
<p>Finally, &#8216;sshcontainer (n)&#8217; will ssh into the (n)th container you&#8217;ve started, starting with 0.  The scripts don&#8217;t get too fancy or try to do too much &#8211; if you want much more, you might actually want to deploy openstack <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I do hope at some point to expand this so as to use a (juju-deployed) ceph cluster for the container backing store.  It is not as flexible as it ought to be, as it expects /dev/vdb or /dev/xvdb to be a spare drive and mounted on /mnt at instance startup, but this is good enough to work for me on Amazon ec2 as well as an openstack based cloud, which is all I need to make this useful for myself.</p>
<p>It won&#8217;t work by default on a local (lxc-backed) juju config, but I will play with that as an exercise to investigate what sorts of site customizations we should support in juju-lxc.  In particular, we&#8217;ll need to (a) be able to use lxc mount hooks (so cgroups can be mounted in the container) and custom apparmor profiles.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/s3hh.wordpress.com/321/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/s3hh.wordpress.com/321/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=s3hh.wordpress.com&#038;blog=14017495&#038;post=321&#038;subd=s3hh&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://s3hh.wordpress.com/2012/10/23/deploying-multiple-connected-lxc-compute-nodes-with-juju/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/b3ecb5cf5a86116e89b6ce738bd4091e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">s3hh</media:title>
		</media:content>
	</item>
	</channel>
</rss>
