<?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>mihai.ibanescu.net &#187; Linux</title>
	<atom:link href="http://mihai.ibanescu.net/category/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://mihai.ibanescu.net</link>
	<description>Mihai&#039;s few cents</description>
	<lastBuildDate>Wed, 07 Dec 2011 22:09:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>VMware Fusion and Fedora 16</title>
		<link>http://mihai.ibanescu.net/vmware-fusion-and-fedora-16</link>
		<comments>http://mihai.ibanescu.net/vmware-fusion-and-fedora-16#comments</comments>
		<pubDate>Wed, 07 Dec 2011 22:09:13 +0000</pubDate>
		<dc:creator>misa</dc:creator>
				<category><![CDATA[Fedora Linux]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://mihai.ibanescu.net/?p=149</guid>
		<description><![CDATA[In case you want to get Fedora 16 (or other Linux 3.1.0-based distro) to properly install VMware Tools under VMware Fusion, there&#8217;s a patch I came up with, based on other patches I gathered from the intertubes. Posted in the &#8230; <a href="http://mihai.ibanescu.net/vmware-fusion-and-fedora-16">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In case you want to get Fedora 16 (or other Linux 3.1.0-based distro) to properly install VMware Tools under VMware Fusion, <a href="http://people.rpath.com/~misa/patches/vmware-fusion-linux3.tar.gz">there&#8217;s a patch</a> I came up with, based on other patches I gathered from the intertubes.</p>
<p>Posted in the hopes it saves someone some time.</p>
]]></content:encoded>
			<wfw:commentRss>http://mihai.ibanescu.net/vmware-fusion-and-fedora-16/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recovering data from one disk from a RAID1 array</title>
		<link>http://mihai.ibanescu.net/recovering-data-from-one-disk-from-a-raid1-array</link>
		<comments>http://mihai.ibanescu.net/recovering-data-from-one-disk-from-a-raid1-array#comments</comments>
		<pubDate>Sat, 05 Jun 2010 14:21:57 +0000</pubDate>
		<dc:creator>misa</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://mihai.ibanescu.net/?p=133</guid>
		<description><![CDATA[Last night I helped a friend recover his data he had stored on an Iomega NAS. The disks were fine, the rest of the hardware had failed. Prior to me being involved in this, my friend had installed Ubuntu on &#8230; <a href="http://mihai.ibanescu.net/recovering-data-from-one-disk-from-a-raid1-array">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last night I helped a friend recover his data he had stored on an Iomega NAS.</p>
<p>The disks were fine, the rest of the hardware had failed.</p>
<p>Prior to me being involved in this, my friend had installed Ubuntu on an older machine and had installed both drives.</p>
<p>Not having played with RAID for quite some time, I had to acquire some knowledge first &#8211; google to the rescue!</p>
<p>In the process I used the wrong option to mdadm (&#8211;create instead of &#8211;assemble), so I messed up the RAID descriptor on one of the disks. Fortunately, the second disk was fine.</p>
<p>Here is what I ended up doing:</p>
<ul>
<li> install mdadm, a utility to configure RAID devices.</li>
</ul>
<ul>
<li> install  lvm2, a utility to configure LVM (Logical Volume Manager).</li>
</ul>
<ul>
<li>Run:</li>
</ul>
<blockquote><p>mdadm &#8211;assemble /dev/md9 /dev/sdc1 &#8211;run</p></blockquote>
<p>(this adds one of the  partitions on the existing drives, /dev/sdc1, into a RAID device  /dev/md9 running in degraded mode, i.e. with not enough disks &#8211; that&#8217;s  what &#8211;run does)</p>
<blockquote><p>vgchange -a y</p></blockquote>
<p>(this scans all drives,  including the newly created /dev/md9, for logical volumes)</p>
<p>It  should print something about a new device with a rather cryptic name, I  think something like /dev/vg1_md9/lv1. lvdisplay will show the available volumes.</p>
<p>This new device  has a filesystem that can be mounted:</p>
<blockquote><p>mkdir  /tmp/olddrive<br />
mount /dev/vg1_md9/lv1 /tmp/olddrive -o ro</p></blockquote>
<p>After  this, the directory /tmp/olddrive is associated with the contents of  the filesystem.</p>
<p>There may be better ways to achieve the same  thing, but this is what worked.</p>
]]></content:encoded>
			<wfw:commentRss>http://mihai.ibanescu.net/recovering-data-from-one-disk-from-a-raid1-array/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>keyutils, python and you</title>
		<link>http://mihai.ibanescu.net/keyutils-python-and-you</link>
		<comments>http://mihai.ibanescu.net/keyutils-python-and-you#comments</comments>
		<pubDate>Fri, 31 Jul 2009 02:37:32 +0000</pubDate>
		<dc:creator>misa</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://mihai.ibanescu.net/?p=110</guid>
		<description><![CDATA[Over the weekend I wrote Python bindings for keyutils. So this blog announces python-keyutils. If you are not familiar with keyutils, it is a library that allows you to securely store sensitive information, directly inside the Linux kernel. You have &#8230; <a href="http://mihai.ibanescu.net/keyutils-python-and-you">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Over the weekend I wrote  Python bindings for <a href="http://people.redhat.com/~dhowells/keyutils/">keyutils</a>. So this blog announces <a href="http://bitbucket.org/rpathsync/python-keyutils/overview/">python-keyutils</a>.</p>
<p>If you are not familiar with keyutils, it is a library that allows you to securely store sensitive information, directly inside the Linux kernel. You have a reasonable guarantee that the information cannot be retrieved from the memory or swap.</p>
<p>keyutils comes with a binary, <a href="http://linux.die.net/man/1/keyctl">keyctl</a><a href="http://linux.die.net/man/1/keyctl">(1)</a>, that gives you access to the kernel&#8217;s key management facilities. The man page describes the types of available keyrings. The ones the most interesting to the use case I had in mind were the per-thread, per-process and per-session keyrings.</p>
<p>The need for python bindings came when we realized that our release process requires typing the passphrase for signing packages way too many times, so there was a real need for a key agent of some sort. Searching for gpg-agent protocol specifications (or seahorse) returned some information, but nothing I could readily use (I may not have found the proper examples for speaking assuan; the end result was that I could not get anywhere in this direction).</p>
<p>Future versions of <a href="http://wiki.rpath.com/wiki/Conary">Conary</a> will have the ability to read passphrases from the session keyring, if python-keyutils is installed. You can get python-keyutils from either contrib.rpath.org@rpl:2 or foresight.rpath.org@fl:2-devel (depending on whether you need the python 2.4 or python 2.6 version).</p>
<p>Keep in mind that I only implemented the bare minimum I needed for being able to set and get key information. There are other functions the library provides, that could be useful to have. If you find the need for one, let me know; as usual, patches will be cheerfully accepted.</p>
<p>The code is hosted on <a href="http://bitbucket.org/rpathsync/python-keyutils/overview/">bitbucket</a> and can be checked out with <a href="http://mercurial.selenic.com/wiki/">Mercurial</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mihai.ibanescu.net/keyutils-python-and-you/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The king is dead, long live the king!</title>
		<link>http://mihai.ibanescu.net/the-king-is-dead-long-live-the-king</link>
		<comments>http://mihai.ibanescu.net/the-king-is-dead-long-live-the-king#comments</comments>
		<pubDate>Tue, 13 Jan 2009 20:15:40 +0000</pubDate>
		<dc:creator>misa</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://mihai.ibanescu.net/?p=70</guid>
		<description><![CDATA[As we here at rPath are trying to embrace standards [1], I got to work on CIM again. Kind of a deja-vu since, in a previous life, I started to write Cimbiote &#8211; a way to write CIM providers in &#8230; <a href="http://mihai.ibanescu.net/the-king-is-dead-long-live-the-king">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As we here at <a href="http://www.rpath.com">rPath</a> are trying to embrace standards [1], I got to work on CIM again. Kind of a deja-vu since, in a previous life, I started to write <a href="http://cimbiote.et.redhat.com">Cimbiote</a> &#8211; a way to write CIM providers in python.</p>
<p>Cimbiote did not go anywhere in the past 2 years and a half, so I dusted it off and started to play with it. As it turns out, major pieces were missing: the ability to create references, support for associations etc.</p>
<p>When trying to add reference support, I found out from the <a href="https://sourceforge.net/mailarchive/message.php?msg_name=496BFE89.9050605%40novell.com">sblim mailing list</a> that there is still hope in the world. Today I finished packaging <a href="http://www.rpath.org/repos/contrib/troveInfo?t=cmpi-bindings">cmpi-bindings=contrib.rpath.org@rpl:2</a> and wrote a simple plugin that does not do much, but was enough to prove far superior to cimbiote.</p>
<p>[1] You, in the back row, stop chuckling. We all know that standards are wonderful things, as Tigger would say.</p>
]]></content:encoded>
			<wfw:commentRss>http://mihai.ibanescu.net/the-king-is-dead-long-live-the-king/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>VIM tip of the day</title>
		<link>http://mihai.ibanescu.net/vim-tip-of-the-day</link>
		<comments>http://mihai.ibanescu.net/vim-tip-of-the-day#comments</comments>
		<pubDate>Thu, 09 Oct 2008 21:22:44 +0000</pubDate>
		<dc:creator>misa</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://mihai.ibanescu.net/?p=56</guid>
		<description><![CDATA[An operation I happen to do a lot: Given a list of words spread on separate lines, sort the words. One can try to do :sort or !sort on a range, but that will sort the lines, not the words &#8230; <a href="http://mihai.ibanescu.net/vim-tip-of-the-day">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>An operation I happen to do a lot:</p>
<p>Given a list of words spread on separate lines, sort the words.</p>
<p>One can try to do :sort or !sort on a range, but that will sort the lines, not the words inside the lines.</p>
<p>Easiest I found so far (but requires visual formatting which is only available in vim):</p>
<ul>
<li> visual select of the lines you want to sort</li>
<li>!!fmt -1</li>
<li>visual select of the lines you want to sort</li>
<li>:sort</li>
<li>gw}</li>
</ul>
<p>Clear as mud <img src='http://mihai.ibanescu.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Explanation:</p>
<p>! will run the selection through an external program, in this case <code>fmt</code> (which is a Unix command to format a list of lines). -1 says to format with a text width of 1 character (which effectively breaks the words at the space)</p>
<p>:sort will sort the selected lines</p>
<p>gw} will format from where the cursor is to the end of the paragraph (re-joining the lines).</p>
]]></content:encoded>
			<wfw:commentRss>http://mihai.ibanescu.net/vim-tip-of-the-day/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Attaching random commands to a keyboard shortcut</title>
		<link>http://mihai.ibanescu.net/attaching-random-commands-to-a-keyboard-shortcut</link>
		<comments>http://mihai.ibanescu.net/attaching-random-commands-to-a-keyboard-shortcut#comments</comments>
		<pubDate>Thu, 12 Jun 2008 15:06:57 +0000</pubDate>
		<dc:creator>misa</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://mihai.ibanescu.net/?p=48</guid>
		<description><![CDATA[I thought I should share this simple way to run a command with a key combination. Metacity will let  you configure keyboard shortcuts for generating events it knows about (sound events, window events etc). For that, all you have to &#8230; <a href="http://mihai.ibanescu.net/attaching-random-commands-to-a-keyboard-shortcut">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I thought I should share this simple way to run a command with a key combination.</p>
<p>Metacity will let  you configure keyboard shortcuts for generating events it knows about (sound events, window events etc). For that, all you have to do is go to System-&gt;Preference-&gt;Keyboard Shortcuts.</p>
<p>But what if you wanted to run  an arbitrary command? In my case, if I suspend my laptop while the display is set to use the external monitor, and I resume trying to use the laptop&#8217;s LCD screen, I would have to somehow invoke xrandr to get the display back. Sounds like a keyboard shortcut would solve the problem, since I could type it blindly, without anything on the display.</p>
<p>This is the solution I found:</p>
<ul>
<li> Run gconf-editor</li>
<li>Go to apps-&gt;metacity-&gt;keyboard_commands</li>
<li>edit one of the command_N keys to add the command you want to be run (in my case xrandr)</li>
<li>go to global_keybindings, edit the run_command_N key and add the keyboard shortcut, like &lt;Ctrl&gt;&lt;Alt&gt;&lt;Shift&gt;R</li>
</ul>
<p>No need to restart anything.</p>
]]></content:encoded>
			<wfw:commentRss>http://mihai.ibanescu.net/attaching-random-commands-to-a-keyboard-shortcut/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A head-scratching TCP/IP problem</title>
		<link>http://mihai.ibanescu.net/a-head-scratching-tcpip-problem</link>
		<comments>http://mihai.ibanescu.net/a-head-scratching-tcpip-problem#comments</comments>
		<pubDate>Wed, 12 Sep 2007 12:53:21 +0000</pubDate>
		<dc:creator>misa</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://mihai.ibanescu.net/?p=42</guid>
		<description><![CDATA[Here&#8217;s an interesting scenario I ran into. You have a program that: looks for an empty port in the high numbers forks in the child it does some computation first (this could take some time) it binds and listens to &#8230; <a href="http://mihai.ibanescu.net/a-head-scratching-tcpip-problem">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an interesting scenario I ran into.</p>
<p>You have a program that:</p>
<ul>
<li>looks for an empty port in the high numbers</li>
<li>forks</li>
<li>in the child
<ul>
<li>it does some computation first (this could take some time)</li>
<li>it binds and listens to the port determined in the first step</li>
<li>starts processing requests of some sort (like HTTP requests, but any TCP would do)</li>
</ul>
</li>
<li>in the parent
<ul>
<li>it has to wait for the child to start serving requests, so in a loop it will start communicating with the child. If it gets an <tt>ECONNREFUSED</tt>, wait some time (a tenth or a hundredth of a second) and try again</li>
<li>do a bunch of work here</li>
</ul>
</li>
</ul>
<p>This all looks reasonable so far. Except that, every now and then, (sometimes more frequently, sometimes very rarely) I was seeing the parent process stuck. A quick <tt>/usr/sbin/lsof</tt> was showing the most disturbing thing: a socket connected to itself!</p>
<p><tt>27945 misa  10r  IPv4 73626638                 TCP localhost.localdomain:51308-&gt;localhost.localdomain:51308 (ESTABLISHED)</tt></p>
<p>All you can do when you see this is scratch your head and wonder what in the world is going on.</p>
<p>After much running around and lots of tracing of the code, it finally occurred to me what happens.</p>
<p>For the explanation that follows, I will call it a <em>local port</em> the  port number used by the socket locally (as returned by <tt>getsockname(2)</tt>).</p>
<p>Every time you have a socket and you try to <tt>connect(2)</tt> it (to a remote, known port), the socket library will pick an unused high-numbered port  for its end of the connection (as the local port). If the attempt to <tt>connect(2)</tt> the socket fails and you try again, it will temporarily bind to <em>another</em> port (the&#8217;re usually consecutive, until they wrap around and start over).</p>
<p>If you try long enough without succeeding (and it is key that the server and client are both on the same machine &#8211; I used <tt>localhost</tt> for both),  <tt>connect(2)</tt> will pick the port you initially assigned to the server as the local port, and will connect to itself!</p>
<p>One possible solution is to pick an unused port and bind to it before connecting. Then <tt>connect(2)</tt> will no longer bind to random other ports.</p>
]]></content:encoded>
			<wfw:commentRss>http://mihai.ibanescu.net/a-head-scratching-tcpip-problem/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ext2online is gone</title>
		<link>http://mihai.ibanescu.net/ext2online-is-gone</link>
		<comments>http://mihai.ibanescu.net/ext2online-is-gone#comments</comments>
		<pubDate>Tue, 21 Aug 2007 13:43:24 +0000</pubDate>
		<dc:creator>misa</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Foresight Linux]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://mihai.ibanescu.net/?p=41</guid>
		<description><![CDATA[I used to use ext2online in conjunction with LVM whenever I had to resize a partition that was already mounted. I haven&#8217;t had to do that in a while, so I was surprised that I couldn&#8217;t find ext2online anymore. Turns &#8230; <a href="http://mihai.ibanescu.net/ext2online-is-gone">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I used to use <tt>ext2online</tt> in conjunction with LVM whenever I had to resize a partition that was already mounted. I haven&#8217;t had to do that in a while, so I was surprised that I couldn&#8217;t find <tt>ext2online</tt> anymore.</p>
<p>Turns out  more modern versions of <tt>resize2fs</tt> already know how to do that. Not the ones from <tt>e2fsprogs=conary.rpath.com@rpl:1</tt>, but I was able to install <tt>e2fsprogs=conary.rpath.com@rpl:devel</tt> into a temporary root and run the new <tt>resize2fs</tt> from there. Yay.</p>
]]></content:encoded>
			<wfw:commentRss>http://mihai.ibanescu.net/ext2online-is-gone/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Gallery and WebDAV</title>
		<link>http://mihai.ibanescu.net/40</link>
		<comments>http://mihai.ibanescu.net/40#comments</comments>
		<pubDate>Thu, 26 Jul 2007 15:50:19 +0000</pubDate>
		<dc:creator>misa</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Foresight Linux]]></category>

		<guid isPermaLink="false">http://mihai.ibanescu.net/?p=40</guid>
		<description><![CDATA[I got to play a bit with Gallery 2.2.2 and I noticed it does support mounting albums with a WebDAV client. (You&#8217;ll have to configure the plugin). While I didn&#8217;t try to actually mount it, I did use cadaver to &#8230; <a href="http://mihai.ibanescu.net/40">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I got to play a bit with <a href="http://gallery.sourceforge.net">Gallery 2.2.2</a> and I noticed it does support mounting albums with a WebDAV client. (You&#8217;ll have to configure the plugin). While I didn&#8217;t try to actually mount it, I did use <a href="http://www.webdav.org/cadaver/">cadaver</a> to access it in an ftp-like environment. Very sweet.</p>
<p>Now in a Foresight repository near you (<a href="http://www.rpath.org/rbuilder/repos/foresight/troveInfo?t=cadaver">foresight.rpath.org@fl:1-contrib</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://mihai.ibanescu.net/40/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adventures with SCons</title>
		<link>http://mihai.ibanescu.net/adventures-with-scons</link>
		<comments>http://mihai.ibanescu.net/adventures-with-scons#comments</comments>
		<pubDate>Fri, 01 Jun 2007 17:30:37 +0000</pubDate>
		<dc:creator>misa</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Conary]]></category>

		<guid isPermaLink="false">http://mihai.ibanescu.net/?p=38</guid>
		<description><![CDATA[I&#8217;ve been playing with SCons for the past couple of days. It&#8217;s intended to be a replacement for Make, and probably sounds similar enough with Ant or Maven, for those familiar with these tools from the Java world. It&#8217;s pretty &#8230; <a href="http://mihai.ibanescu.net/adventures-with-scons">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing with <a href="http://www.scons.org">SCons</a> for the past couple of days. It&#8217;s intended to be a replacement for Make, and probably sounds similar enough with Ant or Maven, for those familiar with these tools from the Java world.</p>
<p>It&#8217;s pretty powerful in that it lets you use the boilerplate builders or you can build your own builders (and nodes!) too. It also allows you to write custom &#8220;freshness checks&#8221;. make usually verifies if a node is out of date by comparing the timestamps for the source and target nodes. This can get you in trouble when using CVS, for instance, because clocks are not synchronized. It&#8217;s also not very useful when what you build doesn&#8217;t live on the filesystem.</p>
<p>I will post some examples  shortly. I am currently creating nodes for Mercurial checkouts and they work pretty well. CVC (Conary) nodes will follow shortly.</p>
<p>And yes,  it&#8217;s written in Python&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://mihai.ibanescu.net/adventures-with-scons/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

