<?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" >

<channel>
	<title>Even the wrong words seem to rhyme &#187; ubuntu</title>
	<atom:link href="http://www.kevinblake.co.uk/tag/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kevinblake.co.uk</link>
	<description>a blog-life by Kevin Blake</description>
	<lastBuildDate>Thu, 13 May 2010 22:27:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Auto running commands when plugging in usb drives with udev in Linux</title>
		<link>http://www.kevinblake.co.uk/auto-running-commands-when-plugging-in-usb-drives-with-udev-in-linux/732/</link>
		<comments>http://www.kevinblake.co.uk/auto-running-commands-when-plugging-in-usb-drives-with-udev-in-linux/732/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 22:53:52 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[backups]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[udev]]></category>

		<guid isPermaLink="false">http://www.kevinblake.co.uk/?p=732</guid>
		<description><![CDATA[My backup strategy for my machines at home can be effectively described as &#8220;scatty, but thorough&#8220;.  Or at least until I actually have a major crash and need to recover that important file that was outside of my normal documents, code repositories, and archived folders. I am one of those sorts of people that has [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_745" class="wp-caption alignright" style="width: 160px"><a href="http://www.kevinblake.co.uk/wp-content/uploads/2010/01/backups-of-backups.jpg" rel="lightbox"><img class="size-thumbnail wp-image-745" title="Backups of Backups" src="http://www.kevinblake.co.uk/wp-content/uploads/2010/01/backups-of-backups-150x150.jpg" alt="" width="150" height="150" /></a><p class="wp-caption-text">Backups of Backups</p></div>
<p>My backup strategy for my machines at home can be effectively described as &#8220;<em>scatty, but thorough</em>&#8220;.  Or at least until I actually have a major crash and need to recover that important file that was outside of my normal documents, code repositories, and archived folders.</p>
<p>I am one of those sorts of people that has backups everywhere.  Folders stacked away with old dusty (and probably now useless) dvds.  Old hard drives filled with duplicates and archived files, stacked up in the back of cupboards and flung next to jam jars.  SD cards, USB keys, backups to other drives, backups to the machines on the other side of my flat, backups off-site.  Backups of backups backed up during the last backup.</p>
<p>So I decided to add one more with an external hard drive that I could plug in every now and then.  But backups aren&#8217;t really the point of this post.</p>
<p>Linux has a really powerful device manager called udev which detects when things are plugged into your machine (including hard drives), which you can write rules against, and have commands automagically executed.  This is really cool for my new hard drive, which can now automatically start backing up without regular cron jobs checking to see if it&#8217;s plugged in or not.  This is not the same as autorun files, it relies on <strong>that </strong>hard drive being plugged into <strong>that </strong>machine.  So don&#8217;t start crying about all the security risks with autorun, please.</p>
<p>Here&#8217;s how you do it.</p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;">udevadm info <span class="re5">-a</span> <span class="re5">-p</span>  $<span class="br0">&#40;</span>udevadm info <span class="re5">-q</span> path <span class="re5">-n</span> <span class="sy0">/</span>dev<span class="sy0">/</span>sdc<span class="br0">&#41;</span></pre></div></div>
<p>You&#8217;ll get a whole bunch of output from that, including (among a lot of other output) a line that might look a little like this:</p>
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;">ATTR<span class="br0">&#123;</span>serial<span class="br0">&#125;</span>==<span class="st0">&quot;312581808&quot;</span></pre></div></div>
<p>There are a lot more you can use as well, but this will identify your device.</p>
<p>Now create a new file inside <em>/etc/udev/rules.d/</em>, such as <em>/etc/udev/rules.d/81-usb-drive.rules</em></p>
<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_3"></a><a id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3"  onClick="javascript:wpsh_toggleBlock(3)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_3" onClick="javascript:wpsh_code(3)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_3" onClick="javascript:wpsh_print(3)" title="Print code"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.kevinblake.co.uk/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="re2">KERNEL</span>==<span class="st0">&quot;sd?1&quot;</span>, ATTRS<span class="br0">&#123;</span>serial<span class="br0">&#125;</span>==<span class="st0">&quot;312581808&quot;</span>, SYMLINK+=<span class="st0">&quot;backup-drive&quot;</span>, RUN+=<span class="st0">&quot;/bin/sh /home/user/scripts/backup-to-drive.sh&quot;</span></pre></div></div>
<p>Now every time you plug in that drive, that command is going to be executed (so include for example, the script that is going to run your backups).  Cool, eh?</p>
<p>I started thinking about other applications; syncing podcasts, ebooks and music are the obvious choices. Even as a crude simple method of executing commands on a box you don&#8217;t even usually login to.  Or you could use this technique to build yourself some poor man usb-based security.  Keep decryption keys on your thumb drive, and have it auto decrypt volumes on your machine when you plug in that particular drive.</p>
<p>Just don&#8217;t forget to keep a backup of the thumb drive, yeah?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinblake.co.uk/auto-running-commands-when-plugging-in-usb-drives-with-udev-in-linux/732/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Eee (701) Suspend / Resume problems</title>
		<link>http://www.kevinblake.co.uk/ubuntu-eee-701-suspend-resume-problems/324/</link>
		<comments>http://www.kevinblake.co.uk/ubuntu-eee-701-suspend-resume-problems/324/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 21:32:35 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[eee]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[ubuntu eee]]></category>

		<guid isPermaLink="false">http://www.kevinblake.co.uk/?p=324</guid>
		<description><![CDATA[Since installing Ubuntu on the Eee, I had no doubt it was going to replace the Xandros install full-time.  It has a lot more features for my inner geek and better support for the applications that only I can find essential. It also takes a hell of a lot longer to boot up. But that&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_325" class="wp-caption alignright" style="width: 190px"><a href="http://www.kevinblake.co.uk/wp-content/uploads/2008/11/eeeubuntu1.jpg" rel="lightbox"><img class="size-medium wp-image-325" title="Eee Ubuntu" src="http://www.kevinblake.co.uk/wp-content/uploads/2008/11/eeeubuntu1-300x240.jpg" alt="" width="180" height="144" /></a><p class="wp-caption-text">Eee Ubuntu</p></div>
<p>Since installing <a href="http://www.ubuntu-eee.com/" target="_blank">Ubuntu</a> on the Eee, I had no doubt it was going to replace the Xandros install full-time.  It has a lot more features for my inner geek and better support for the applications that only I can find essential.</p>
<p>It also takes a hell of a lot longer to boot up.</p>
<p>But that&#8217;s okay, these new Atom processors don&#8217;t take up a lot of battery life when they&#8217;re in standby&#8230; If I were a real reporter, I&#8217;d test that theory.  But since I&#8217;m blogging, so I&#8217;ll throw out any kinds of lies that I like &#8211; so long as I&#8217;m upfront and honest about it.</p>
<p>So far so good, except Resume doesn&#8217;t work on Ubuntu Eee, either.</p>
<p>Great.</p>
<p>So I followed the <a href="http://wiki.eeeuser.com/ubuntu#suspend_resume" target="_blank">steps on the usual eee user wiki about suspend/resume</a>.  And that didn&#8217;t work either.</p>
<p>What I did find, is that you can actually resume from the never-ending sleep of the Ubuntu if you run the command:</p>
<p><code>sudo /etc/acpi/sleep.sh force</code></p>
<p>Furthermore, you can replace the pm-suspend command with the same &#8211; and your shiny new Ubuntu Eee will wake up when you ask it.  Rather than whining about it being too early and throwing the covers over its head.<br />
<code>#Make a backup, just in case.<br />
sudo cp /usr/sbin/pm-suspend /usr/sbin/pm-suspend.bak<br />
sudo echo "/etc/acpi/sleep.sh force" &gt;/usr/sbin/pm-suspend<br />
</code></p>
<p>And that will let you continue to use the lid or the shut-down screen for all your eee suspension needs.  Hopefully I can do something about that initial boot-time, next.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinblake.co.uk/ubuntu-eee-701-suspend-resume-problems/324/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Internet on the Eee PC (Ubuntu Eee)</title>
		<link>http://www.kevinblake.co.uk/mobile-internet-on-the-eee-pc-ubuntu-eee/242/</link>
		<comments>http://www.kevinblake.co.uk/mobile-internet-on-the-eee-pc-ubuntu-eee/242/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 20:04:19 +0000</pubDate>
		<dc:creator>Kevin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bluetooth]]></category>
		<category><![CDATA[eee]]></category>
		<category><![CDATA[gprs]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[N95]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[nokia]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.kevinblake.co.uk/?p=242</guid>
		<description><![CDATA[Setting up the Internet on the Eee PC over bluetooth to my Nokia N95 with T-Mobile GPRS/EDGE/3G connection can be tricky.  Yet it sounds like one of those setups that could be so easy, right?  Well it seems stable for the moment, so here&#8217;s what you&#8217;ll need.  Or rather, what I have&#8230; Eee PC 701 [...]]]></description>
			<content:encoded><![CDATA[<p>Setting up the Internet on the Eee PC over bluetooth to my Nokia N95 with T-Mobile GPRS/EDGE/3G connection can be tricky.  Yet it sounds like one of those setups that could be so easy, right?  Well it seems stable for the moment, so here&#8217;s what you&#8217;ll need.  Or rather, what I have&#8230;</p>
<ul>
<li><a href="http://www.expansys.com/p.aspx?i=158485" target="_blank">Eee PC 701</a></li>
<li>Nokia N95</li>
<li><a href="http://www.memorybits.co.uk/shop/bluetooth-dongles/bluemicronext-pro-v2.0-bluetooth-dongle-/8156" target="_blank">Bluetooth dongle</a></li>
<li><a href="http://www.ubuntu-eee.com/" target="_blank">Ubuntu Eee installed</a> on the 701 (not Xandros &#8211; although check out <a href="http://www.3eportal.com/index.php?option=com_content&amp;task=view&amp;id=17&amp;Itemid=1" target="_blank">these scripts</a> if you don&#8217;t want to change)</li>
<li>T-Mobile UK contract with included data plan (preferably).  And Internet already working on the phone.</li>
</ul>
<p>You&#8217;re going to be setting up your connection though pppd, and all of these instructions are <a href="http://davesource.com/Solutions/20070520.T-Mobile-Nokia-E65-Ubuntu-Linux.html#bluetooth" target="_blank">based on instructions</a> that I&#8217;m going to steal, slightly change and probably skip parts to suit my purposes (and hopefully yours) perfectly.</p>
<p>If your set-up doesn&#8217;t match exactly, perhaps you can make use of both pages and work out where things should change.  Or lovingly rip these instructions off, as I did &#8211; to make your own.</p>
<p><strong>Setup your bluetooth dongle</strong><br />
First off, you&#8217;re going to need an apt repository that has the bluez-utils packages in.  So open up a terminal<br />
<code>sudo nano /etc/apt/sources.list</code><br />
and add the line<br />
<code>deb http://ftp.de.debian.org/debian etch main</code></p>
<p>Then you can install the package.</p>
<p><code>apt-update<br />
apt-get install bluez-utils<br />
/etc/init.d/bluetooth restart<br />
lsusb | grep -i bluetooth<br />
<em>(should show the bluetooth device)</em><br />
hcitool dev<br />
<em> (also lists bluetooth devices)</em><br />
</code></p>
<p><strong>Setup networking</strong></p>
<p>You can grab my <a href="http://www.kevinblake.co.uk/wp-content/uploads/2008/09/gprs-settings.tar">gprs-settings</a> which should be put into /etc/ppp/peers directory, and untarred.<br />
<code>tar -xvf gprs-settings.tar</code></p>
<p><strong>Pair the phone</strong></p>
<p>First, get the bluetooth ID of the N95<br />
<code>hcitool scan</code><br />
Then pair your Eee with your phone, you have to do this from the N95.<br />
<code>Bluetooth -&gt; right arrow (Paired devices) - Options<br />
New paired devices (search)<br />
Choose your eee and then type the pairing keys (anything of your choosing</code></p>
<p><strong>Bind bluetooth to an rfcomm device</strong></p>
<p>We use &#8220;rfcomm&#8221; to bind the bluetooth connection to a device. So first, find out the channel the phones bluetooth dial up networking system is on.  You can do this with sdptool (Service Discovery Protocol tool):<br />
<code>sdptool search dun<br />
Service Name: Dial-Up Networking<br />
Service RecHandle: 0x1001e<br />
Service Class ID List:<br />
"Dialup Networking" (0x1103)<br />
Protocol Descriptor List:<br />
"L2CAP" (0x0100)<br />
"RFCOMM" (0x0003)<br />
<strong>Channel: 2</strong><br />
Language Base Attr List:<br />
code_ISO639: 0x454e<br />
encoding:    0x6a<br />
base_offset: 0x100<br />
Profile Descriptor List:<br />
"Dialup Networking" (0x1103)<br />
Version: 0x0100</code></p>
<p>Note the &#8220;Channel: 2&#8243; which show which channel to bind.</p>
<p>Then to bind the channel (in this case #2) to one of the rfcomm devices (for example, rfcomm0):<br />
<code>rfcomm bind 0 11:22:BE:EF:44:33 2</code><br />
You can see the binding with:<br />
<code>rfcomm<br />
rfcomm0: 11:22:BE:EF:44:33 channel 2 clean</code><br />
You might find you need to reset the bind and restart it every now and then (especially failed connection attempts)<br />
<code>rfcomm release 0<br />
rfcomm bind 0 11:22:BE:EF:44:33 2</code><br />
You can edit the settings in &#8220;/etc/bluetooth/rfcomm.conf,&#8221; set bind to &#8220;yes&#8221; and give the device and channel for rfcomm0.  Then you can put these commands into /etc/init.d/bluetooth and it will automatically bind and release the rfcomm device:<br />
<code># At the end of the "start)" section<br />
rfcomm bind all<br />
# At the beginning of the "stop)" section<br />
rfcomm release all</code><br />
<strong>Start pppd to connect.</strong><br />
Start up pppd.  Command line first, but because we&#8217;ve called it ppp0, you will later be able to do this via the normal ubuntu eee networking menu in the menu bar.<br />
<code>% pppd call ppp0</code><br />
You should now have a <tt>ppp0</tt> interface in your &#8216;ifconfig&#8217; output that is up and running.  The output should look something like this:<br />
<code># pppd call ppp0<br />
Press CTRL-C to close the connection at any stage!<br />
defining PDP context...<br />
rAT<br />
OK<br />
ATH<br />
OK<br />
ATE1<br />
OK<br />
AT+CGDCONT=1,"IP","general.t-mobile.uk","",0,0<br />
OK<br />
waiting for connect...<br />
ATD*99#<br />
CONNECT<br />
Connected.<br />
If the following ppp negotiations fail,<br />
try restarting the phone.<br />
Serial connection established.<br />
using channel 1<br />
Using interface ppp0<br />
Connect: ppp0 &lt;--&gt; /dev/rfcomm0</code></p>
<p>You can hit control-c on the pppd process and it will shut down the connection, then you can release the rfcomm binding.</p>
<p>So&#8230; as I was saying&#8230; It&#8217;s not the easiest thing in the world to get going, but once you&#8217;ve got the hang of it, and set it up once you&#8217;ll have a connection everywhere you go.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kevinblake.co.uk/mobile-internet-on-the-eee-pc-ubuntu-eee/242/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<georss:point>51.6548576 -0.3982030</georss:point>	</item>
	</channel>
</rss>
