<?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>Everything is Broken &#187; Linux</title>
	<atom:link href="http://play.datalude.com/blog/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://play.datalude.com/blog</link>
	<description>Efficiency vs. Inefficiency, in a no-holds barred fight.</description>
	<lastBuildDate>Tue, 04 May 2010 03:05:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ClamAV reporting Outdated version</title>
		<link>http://play.datalude.com/blog/2010/05/clamav-reporting-outdated-version/</link>
		<comments>http://play.datalude.com/blog/2010/05/clamav-reporting-outdated-version/#comments</comments>
		<pubDate>Tue, 04 May 2010 03:05:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[clamav]]></category>
		<category><![CDATA[latest version]]></category>
		<category><![CDATA[repositories]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://play.datalude.com/blog/?p=200</guid>
		<description><![CDATA[Just to remind myself as much as anything, as I&#8217;ve been through this a few times. ClamAV was complaining loudly in the logfiles about not having the most up to date ClamAV. I searched around and was pointed to the Debian Unstable repository to /etc/apt/sources.list (Read the whole article before you add this one &#8230;there [...]]]></description>
			<content:encoded><![CDATA[<p>Just to remind myself as much as anything, as I&#8217;ve been through this a few times. ClamAV was complaining loudly in the logfiles about not having the most up to date ClamAV. I searched around and was pointed to the Debian Unstable repository to /etc/apt/sources.list (Read the whole article before you add this one &#8230;there is a better one)</p>
<p>After that, on running<strong> apt-get update</strong>, you get a message like this:</p>
<p>W: GPG error: http://volatile.debian.org etch/volatile Release: The following signatures couldn&#8217;t be verified because the public key is not available: NO_PUBKEY DFD993306D849617</p>
<p>So, take the pubkey number off the end and do this with it.</p>
<pre>sudo gpg --keyserver subkeys.pgp.net --recv-keys DFD993306D849617</pre>
<pre>sudo gpg --armor --export DFD993306D849617 &gt; new.key</pre>
<pre>sudo apt-key add new.key</pre>
<p>I then got a message saying &#8220;The following packages have been kept back: clamav clamav-daemon clamav-freshclam&#8221;</p>
<p>By using</p>
<pre> sudo <strong>aptitude</strong> dist-upgrade</pre>
<p>(NB aptitude rather than apt-get) the new packages are downloaded. However they&#8217;re still not up to the level that ClamAV is telling me to upgrade to.</p>
<p>So, more searching. It turns out the most up to date Ubuntu Repositories are from this page &#8230; <a href="https://launchpad.net/~ubuntu-clamav/+archive/ppa">https://launchpad.net/~ubuntu-clamav/+archive/ppa</a>. In my case the solution was to add these lines to my /etc/apt/sources.list</p>
<pre>deb http://ppa.launchpad.net/ubuntu-clamav/ppa/ubuntu hardy main</pre>
<pre>deb-src http://ppa.launchpad.net/ubuntu-clamav/ppa/ubuntu hardy main</pre>
<p>And then run through the pubkey process above, with the different pubkey id number. Later distros might get away with the add-apt-key command, but I was running hardy (8.04) on this particular server.</p>
]]></content:encoded>
			<wfw:commentRss>http://play.datalude.com/blog/2010/05/clamav-reporting-outdated-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adventures in unbricking a router</title>
		<link>http://play.datalude.com/blog/2010/04/adventures-in-unbricking-a-router/</link>
		<comments>http://play.datalude.com/blog/2010/04/adventures-in-unbricking-a-router/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 04:15:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[dd-wrt]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[openwrt]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[SimpleHTTPServer]]></category>

		<guid isPermaLink="false">http://play.datalude.com/blog/?p=196</guid>
		<description><![CDATA[Another fantastic illustration of how Linux &#8216;gets the job&#8217; done. Although sometimes the operator (ahem) is sometimes a bit slow on the uptake. Anyway, I had a Linksys WRT54G router in which the wireless unit had blown up after a power outage and surge. Gotta love the Philippines. I had dd-wrt on it, but decided [...]]]></description>
			<content:encoded><![CDATA[<p>Another fantastic illustration of how Linux &#8216;gets the job&#8217; done. Although sometimes the operator (ahem) is sometimes a bit slow on the uptake.</p>
<p>Anyway, I had a Linksys WRT54G router in which the wireless unit had blown up after a power outage and surge. Gotta love the Philippines. I had dd-wrt on it, but decided to try out OpenWRT. Well lets just say that OpenWRT isn&#8217;t to my taste. I wanted something which worked more or less immediately, rather than poring over documentation trying to figure out how to get the WAN interface up via a command line.</p>
<p>So I dropped the router into a drawer until today, when I needed to use it for something (without the need for wireless). Well of course when I needed it, it wouldn&#8217;t boot. In fact I couldn&#8217;t even ping it. This is bad news.</p>
<p>I tracked down an internet post which mentioned that if I held the reset button while booting, the router would go into admin mode, which meant I could ping it. I did this and it worked. I read elsewhere that in order to flash it with tftp, I needed to do so when the ping response time was 100ms, before it dropped to 64ms. Exciting stuff. I set up the tftp flashing machine and tried, possibly 50 or 60 times, to flash back ddwrt. No luck. For reference, here is the one liner:</p>
<pre>echo -e "binary\nrexmt 1\ntimeout 60\ntrace\nput ddwrt.bin\n" | tftp 192.168.1.1
</pre>
<p>I did an nmap scan of the router and found that port 23 was open, so I managed to telnet into it. I couldn&#8217;t connect the wan interface (as previously noted), but I had a command prompt. No SSH, no web interface. So how to get the ddwrt.bin file onto the router via telnet?</p>
<p>Here&#8217;s how: On my PC, at 192.168.1.50, I went to the directory which held the ddwrt.bin file. At the command prompt I typed</p>
<pre>python -m SimpleHTTPServer</pre>
<p>This serves up the current directory over HTTP, port 8080.</p>
<p>In my router telnet session I went to the /tmp directory (the only place with enough space for the file) and typed</p>
<pre>wget http://192.168.1.50:8080/ddwrt.bin</pre>
<p>After a few seconds, the file was there! Alright!</p>
<p>Still in the router, I did</p>
<pre><code>mtd -r write dd-wrt.bin linux</code></pre>
<p>The router whirred for a while, rebooted and &#8230; ddwrt was back, in all its web-interfacy autoconfigurating glory.</p>
<p>What a great trick with SimpleHTTPServer. Shame I wasted hours on the tftp approach. Incidentally, there&#8217;s a similar tool which will let people upload files to your computer via HTTP, called droopy.</p>
]]></content:encoded>
			<wfw:commentRss>http://play.datalude.com/blog/2010/04/adventures-in-unbricking-a-router/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One Line Guitar Tuner</title>
		<link>http://play.datalude.com/blog/2010/03/one-line-guitar-tuner/</link>
		<comments>http://play.datalude.com/blog/2010/03/one-line-guitar-tuner/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 01:23:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[guitar tuner]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://play.datalude.com/blog/?p=193</guid>
		<description><![CDATA[Every now and then I come across something which makes me marvel at the flexibility of Linux. This is one of these things. I play guitar, and I&#8217;d previously written a small script to act as a guitar tuner. I generated some .ogg files of the correct pitch and then wrote a script to loop [...]]]></description>
			<content:encoded><![CDATA[<p>Every now and then I come across something which makes me marvel at the flexibility of Linux. This is one of these things.</p>
<p>I play guitar, and I&#8217;d previously written a small script to act as a guitar tuner. I generated some .ogg files of the correct pitch and then wrote a script to loop through them in sequence. &#8220;Pretty good&#8221;, I thought, &#8220;Clever Me.&#8221;</p>
<p>Then a few days ago I came across this little gem of a script.</p>
<pre>for n in E2 A2 D3 G3 B3 E4;do play -n synth 4 pluck $n repeat 2;done
</pre>
<p>That&#8217;s it. Sheer brilliance. Of course you&#8217;ll need to install the sox package first.</p>
]]></content:encoded>
			<wfw:commentRss>http://play.datalude.com/blog/2010/03/one-line-guitar-tuner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Firefox&#8217;s Tattletale Search Query</title>
		<link>http://play.datalude.com/blog/2009/04/ubuntu-firefoxs-tattletale-search-query/</link>
		<comments>http://play.datalude.com/blog/2009/04/ubuntu-firefoxs-tattletale-search-query/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 02:52:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[search]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://play.datalude.com/blog/?p=131</guid>
		<description><![CDATA[Have you ever noticed that when you type a search term into the search box in the top right of your Firefox browser, that a load of junk gets added to the search term. For example, you search for &#8216;banana&#8217; and you get something like this: http://www.google.com.ph/search?q=banana&#38;ie=utf-8&#38;oe=utf-8&#38;aq=t&#38;rls=com.ubuntu:en-US:unofficial&#38;client=firefox-a Well what you&#8217;re effectively doing is giving Google [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-133" href="http://play.datalude.com/blog/?attachment_id=133"><img class="alignright size-full wp-image-133" title="Search Simplification" src="http://play.datalude.com/blog/wp-content/uploads/2009/04/prismendoppelfernrohr_1905.jpg" alt="Search Simplification" width="136" height="150" /></a>Have you ever noticed that when you type a search term into the search box in the top right of your Firefox browser, that a load of junk gets added to the search term. For example, you search for &#8216;banana&#8217; and you get something like this:</p>
<p>http://www.google.com.ph/search?q=banana&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=com.ubuntu:en-US:unofficial&amp;client=firefox-a</p>
<p>Well what you&#8217;re effectively doing is giving Google a lot of information for free. Which irritates me. All I really need is this,</p>
<p>http://www.google.com.ph/search?q=banana</p>
<p>and if they really want to know more about me, then they&#8217;re welcome to go digging through their logs.</p>
<p>OK its a minor irritation, but one that we can fix! I understand that Ubuntu does it as part of a deal with Google, but there&#8217;s no reason why we can&#8217;t take matters into our own hands and change the defaults.</p>
<p><span id="more-131"></span>So, the file you need to find is this one: /usr/lib/firefox-addons/searchplugins/google.xml, and you&#8217;ll need to open it in an editor as root.  So:</p>
<pre>sudo gedit /usr/lib/firefox-addons/searchplugins/google.xml</pre>
<p>If you use another search engine as your default, then choose a different file, of course. With this file open in an editor,  remove the offending lines. In the case above, its</p>
<pre>  &lt;Param name="ie" value="utf-8"/&gt;
  &lt;Param name="oe" value="utf-8"/&gt;
  &lt;Param name="aq" value="t"/&gt;
  &lt;!-- Dynamic parameters --&gt;
  &lt;Param name="rls" value="{moz:distributionID}:{moz:locale}:{moz:official}"/&gt;
  &lt;MozParam name="client" condition="defaultEngine" trueValue="firefox-a" falseValue="firefox"/&gt;</pre>
<p>Save the file, restart Firefox, and we&#8217;re good to go.  Now the problem is that whenever you upgrade Firefox, the problem reappears, so you might want to make a copy of the correct file, and write a script to replace it every time you upgrade.  I always manage to forget where the file is, so I&#8217;m blogging this for my own benefit as much as anyone elses &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://play.datalude.com/blog/2009/04/ubuntu-firefoxs-tattletale-search-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Counting files in subdirectories.</title>
		<link>http://play.datalude.com/blog/2009/02/counting-files-in-subdirectories/</link>
		<comments>http://play.datalude.com/blog/2009/02/counting-files-in-subdirectories/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 10:00:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[count]]></category>
		<category><![CDATA[df]]></category>
		<category><![CDATA[du]]></category>
		<category><![CDATA[file]]></category>

		<guid isPermaLink="false">http://play.datalude.com/blog/?p=124</guid>
		<description><![CDATA[OK, it sounds simple, and it probably is if you&#8217;re sitting at your desktop with Gnome or KDE fired up. However if you&#8217;re looking on a server half way across the world, using the command line its not so easy. There are a number of tools which are useful in finding out things about your [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-128" href="http://play.datalude.com/blog/?attachment_id=128"><img class="alignright size-full wp-image-128" style="margin: 10px;" title="ze count" src="http://play.datalude.com/blog/wp-content/uploads/2009/02/count.jpeg" alt="ze count" width="113" height="113" /></a>OK, it sounds simple, and it probably is if you&#8217;re sitting at your desktop with Gnome or KDE fired up. However if you&#8217;re looking on a server half way across the world, using the command line its not so easy.</p>
<p>There are a number of tools which are useful in finding out things about your filesystem. ls, du, df are three of them, but sometimes they just don&#8217;t give you the information you need. In my case I&#8217;m backing up a server to a remote location. The script was timing out becase I was trying to back up too many files at once, so I needed to find the number of files in each subdirectory.</p>
<p><span id="more-124"></span>Sounds easy at first, and there are numerous attempts at finding that information around the internet. But none of them did exactly what I wanted.</p>
<p>There were PERL scripts and python scripts, and the minimal</p>
<pre>ls -alR | wc -l</pre>
<p>which gives the total files under a directory, but not quite. Anyway, after experimenting for a long time, I finally put together the following command in all its glory.</p>
<pre>find . -type f | awk -F/ '{ print $2 }' | sort | uniq -c</pre>
<p>Lets just go through this, so you can tailor it to  your own needs. Each part of the command passes its output to the next part of the command through the pipe sign ( | ), so we can consider each part separately.</p>
<p><strong>find . -type f</strong> . This provides a listing of all the files (ie not directories and symlinks etc) underneath the current directory. You can modify the options to the find command to find other items as well, but I wanted files. This pumps out a list like this.</p>
<p>./dir1/file1</p>
<p>./dir1/file2</p>
<p>./dir2/file1</p>
<p>./dir2/subdir1/file1</p>
<p>./dir2/subdir1/file2</p>
<p><strong>awk -F/ &#8216;{ print $2 }&#8217;</strong> This takes the previous list and splits it into fields using the / sign (-F./). It will then output a list of these. Continuing the example above:</p>
<p>dir1</p>
<p>dir1</p>
<p>dir2</p>
<p>dir2</p>
<p>dir2</p>
<p><strong>sort</strong> Sorts the list, as you might expect. There are two reasons for this. First is that find doesn&#8217;t always find files in alphabetical order. Second is that the next command needs like terms to be grouped together to count them properly. Anyway, this leaves the list above unchanged in this case.</p>
<p><strong>uniq -c</strong> Takes the list above and returns only unique values, with a count in the left margin ie.</p>
<p>2   dir1</p>
<p>3 dir2</p>
<p>&#8230; which is exactly what I wanted.</p>
<p>I also used the</p>
<pre>du -h --max-depth=1</pre>
<p>to find out the sizes of these directories.</p>
]]></content:encoded>
			<wfw:commentRss>http://play.datalude.com/blog/2009/02/counting-files-in-subdirectories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Z-star Video Camera working in Ubuntu Intrepid</title>
		<link>http://play.datalude.com/blog/2009/01/zmicro-video-camera-working-in-ubuntu-intrepid/</link>
		<comments>http://play.datalude.com/blog/2009/01/zmicro-video-camera-working-in-ubuntu-intrepid/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 06:33:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu intrepid]]></category>
		<category><![CDATA[video camera]]></category>
		<category><![CDATA[webcam]]></category>
		<category><![CDATA[zstar microelectronics ZC0301]]></category>

		<guid isPermaLink="false">http://play.datalude.com/blog/?p=117</guid>
		<description><![CDATA[At last. Its a lazy Saturday after New Year, and I just got around to fixing another one of the things which broke when I upgraded to Intrepid &#8211; the video camera. Actually I don&#8217;t really use it much, hence it got dropped to the back of the queue, but its nice to get things [...]]]></description>
			<content:encoded><![CDATA[<p>At last. Its a lazy Saturday after New Year, and I just got around to fixing another one of the things which broke when I <a href="http://play.datalude.com/blog/?p=107">upgraded to Intrepid</a> &#8211; the video camera. Actually I don&#8217;t really use it much, hence it got dropped to the back of the queue, but its nice to get things working again.</p>
<p>Here&#8217;s the relevant info:<span id="more-117"></span></p>
<blockquote><p>$&gt; tail -f /var/log/messages</p>
<p>{insert camera}</p>
<p>Jan  3 14:28:13  kernel: [18540.528056] usb 5-1: new full speed USB device using uhci_hcd and address 4<br />
Jan  3 14:28:13  kernel: [18540.741888] usb 5-1: configuration #1 chosen from 1 choice<br />
Jan  3 14:28:13  kernel: [18540.745214] gspca: probing 0ac8:301b<br />
Jan  3 14:28:14  kernel: [18541.048159] zc3xx: probe sensor -&gt; 0a<br />
Jan  3 14:28:14  kernel: [18541.048168] zc3xx: Find Sensor PB0330. Chip revision 0<br />
Jan  3 14:28:14  kernel: [18541.055586] gspca: probe ok</p>
<p>$&gt; lsusb<br />
Bus 005 Device 004: ID 0ac8:301b Z-Star Microelectronics Corp. ZC0301 WebCam</p>
<p>$&gt; lsmod | grep gspca<br />
gspca_zc3xx            55936  0<br />
gspca_main             29312  1 gspca_zc3xx<br />
videodev               41344  1 gspca_main<br />
usbcore               148848  6 gspca_zc3xx,gspca_main,usbhid,uhci_hcd,ehci_hcd</p>
<p>$ ls /dev/video*<br />
/dev/video0</p></blockquote>
<p>So everything <strong>seemed</strong> to be making the right noises, but any app I tried (camorama, skype) would just bomb out, being unable to find the camera.  I&#8217;d tried a couple of things before, such as recompiling the drivers, and adding lines to /etc/modprobe.d/blacklist and /etc/modprobe.d/options but nothing had worked, mainly I suspect, because these fixes related to the previous version of Ubuntu, 8.04. The answer was eventually very simple and was detailed <a href="https://answers.launchpad.net/ubuntu/+question/49739">here</a>. I&#8217;m gong to reproduce it below anyway:</p>
<blockquote><p>The core of the problem is that gspca drivers in 8.10 apparently implement V4L2, while many applications are still using V4L1 protocol. See <a rel="nofollow" href="http://hansdegoede.livejournal.com/3636.html">http://hansdegoede.livejournal.com/3636.html</a> .</p>
<p>Diagnostics:<br />
install camstream<br />
start camstream, open trace window, and start camera. Expect to see messages like:<br />
VIDIOCSYNC(1) failed (Invalid argument)</p>
<p>How to workaround this (see also <a rel="nofollow" href="https://lists.linux-foundation.org/pipermail/bugme-janitors/2008-October/011912.html">https://lists.linux-foundation.org/pipermail/bugme-janitors/2008-October/011912.html</a>):</p>
<p>1. Download and unpack <a rel="nofollow" href="http://people.atrpms.net/%7Ehdegoede/libv4l-0.5.0.tar.gz">http://people.atrpms.net/~hdegoede/libv4l-0.5.0.tar.gz</a><br />
2. See README, and install: sudo make install<br />
3. Open terminal window<br />
4. $ export  LD_PRELOAD=/usr/local/lib/libv4l/v4l1compat.so<br />
5. $ camstream<br />
Start camera, should now work.</p>
<p>How to make skype work:<br />
1. create new shell script (call it skype_wrapper), put it somehwere (e.g. /usr/local/bin/skype_wrapper). Content:<br />
#!/bin/bash<br />
export LD_PRELOAD=/usr/local/lib/libv4l/v4l1compat.so<br />
skype<br />
2. Open System/Root Menu manager, locate Skype, Edit the shortcut replacing command &#8220;skype&#8221; =&gt; &#8220;/usr/local/bin/skype_wrapper&#8221;.<br />
3. Start skype (restart, if already running). Test video should now work.</p></blockquote>
<p>All good. Even the skype fix worked. Now its just bluetooth to fix &#8230; mutter mutter.</p>
]]></content:encoded>
			<wfw:commentRss>http://play.datalude.com/blog/2009/01/zmicro-video-camera-working-in-ubuntu-intrepid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux Memory Usage Summary Script</title>
		<link>http://play.datalude.com/blog/2008/11/linux-memory-usage-summary-script/</link>
		<comments>http://play.datalude.com/blog/2008/11/linux-memory-usage-summary-script/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 07:21:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[information]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[report troubleshooting]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://play.datalude.com/blog/?p=110</guid>
		<description><![CDATA[I was having trouble with a webserver this week, which I&#8217;d just set up for a client. When it went live, it seemed OK initially, but when we left it overnight it curled up its toes and died. It was so dead that I couldn&#8217;t even ssh in to reboot it, so we had to [...]]]></description>
			<content:encoded><![CDATA[<p>I was having trouble with a webserver this week, which I&#8217;d just set up for a client. When it went live, it seemed OK initially, but when we left it overnight it curled up its toes and died. It was so dead that I couldn&#8217;t even ssh in to reboot it, so we had to do a remote reboot. Crunch.</p>
<p>Anyway, on getting it back up, I poked around in the logs and found that it was running out of memory, which it really shouldn&#8217;t do given that it was a fairly low load on the webserver, and only apache, mysql and php were running on it. I looked around the Interwebs and found an excellent resource called <a href="http://rimuhosting.com/howto/memory.jsp" target="_blank">Troubleshooting Memory Usage</a>, which gave me some pointers about how to rein in apache and stop it from eating up memory so quickly. Thanks!</p>
<p>Anyway on the page was a script for summarising memory usage, which I thought was a good idea, so i grabbed that one and adapted it to my own purposes. I thought I&#8217;d make the results available here, so feel free to grab it and adapt it to your own needs.<span id="more-110"></span></p>
<pre>#!/bin/bash
# Mem-info.sh. Version 1.5 2008-12-20
# Adapted from various sources around the Internet.
# Requires mutt to be installed to use the email function. 

#################### Functions ####################
function print_help {
	echo "  Usage:"
	echo "    $0 [-a full|summary] -f /tmp/memoryreport.txt"
	echo "    Parameters:"
	echo "    -a              Specify full or summary report"
	echo "    -f              Specify alternate filename "
	echo "    -e &lt;adddr&gt;      Send report to specified email address"
	echo "    -h | --help     This usage information"
	echo "    Running the script with no parameters writes a summary report to ./output.txt"
}

function summary_report {
	echo "=========================== SUMMARY ============================" &gt; $mem_outputfile
	date &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
	echo "=========================== uptime ==============================" &gt;&gt; $mem_outputfile
	uptime &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
	echo "========================== free -m ==============================" &gt;&gt; $mem_outputfile
	free -m &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
	echo "========================= vmstat 1.5 ============================" &gt;&gt; $mem_outputfile
	vmstat 1 5 &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
	echo "================== ps top 20 Processes by CPU ===================" &gt;&gt; $mem_outputfile
	ps -eo user,%mem,%cpu,pid,cmd --sort -%cpu | head -n 20 &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile

}

function full_report {
	summary_report
	echo "========================= FULL DETAIL ===========================" &gt;&gt; $mem_outputfile
	echo "======================== top raw output =========================" &gt;&gt; $mem_outputfile
	top -b -n 1 &gt;&gt; $mem_outputfile
	echo " " &gt;&gt; $mem_outputfile
	echo "======================= ps auxf raw output ======================" &gt;&gt; $mem_outputfile
	ps auxf --width=200 &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
	echo "=========================== end ================================ " &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
	echo  &gt;&gt; $mem_outputfile
}

#################### Process Command line ####################

while [ "$1" != "" ]; do
    case $1 in
        -f )           	shift
                                mem_outputfile=$1
                                ;;
        -a )    	shift
				mem_action=$1
                                ;;
        -e )            shift
				email_to=$1
				;;
        -h | --help )           print_help
                                exit
                                ;;
        * )                     print_help
                                exit
				;;
    esac
    shift
done

######################### Set Defaults #########################
if [ -z "${mem_action}" ]; then
    echo "    No action Specified. Defaulting to summary report"
    mem_action="summary"
fi
if [ -z "${mem_outputfile}" ]; then
    echo "    No output file specified. Writing to `pwd`/output.txt"
    mem_outputfile="output.txt"
fi

######################### Do Stuff #########################

if [ "$mem_action" = "full" ]; then
		full_report
	else
		summary_report
fi

if [ "$email_to" = "" ]; then
		echo "    No email address specified. Not emailing report."
	else
		mutt -s "Memory Usage Report" $email_to &lt; $mem_outputfile
fi</pre>
<p>Or you can download the file <a href="http://play.datalude.com/blog/wp-content/uploads/2008/11/mem-info1.sh">mem-info1 </a> if the formatting above is all messed up. Make sure you go to the page I linked to above for excellent advice on interpreting the report.</p>
]]></content:encoded>
			<wfw:commentRss>http://play.datalude.com/blog/2008/11/linux-memory-usage-summary-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 8.04 to 8.10 upgrade.</title>
		<link>http://play.datalude.com/blog/2008/11/ubuntu-804-to-810-upgrade/</link>
		<comments>http://play.datalude.com/blog/2008/11/ubuntu-804-to-810-upgrade/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 05:45:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[dell]]></category>
		<category><![CDATA[hardy]]></category>
		<category><![CDATA[intrepid]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wireless]]></category>

		<guid isPermaLink="false">http://play.datalude.com/blog/?p=107</guid>
		<description><![CDATA[A lot of commentators in the blogosphere have shown disappointment at the fact that little seems to have changed with Ubuntu 8.10. My answer to them is that in fact a lot has changed, but not much of it is visible. To my mind a lot of these under-the-hood changes have addressed fundamental issues which [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of commentators in the blogosphere have shown disappointment at the fact that little seems to have changed with Ubuntu 8.10. My answer to them is that in fact a lot has changed, but not much of it is visible. To my mind a lot of these under-the-hood changes have addressed fundamental issues which needed to be fixed as a priority, so that normal users could just get on with the business of using Linux, rather than scrabbling around in config files.</p>
<p>Also, Ubuntu has an aggressive schedule, which means release are made every 6 months. I believe the purpose of the April (.04) releases is to introduce new features, and the October (.10) release is to refine them and fix any breaks. Compare this approach to Windows or Macintosh, where releases are made around every three years, and you can appreciate that releasing little and often means that changes are more diffuse and less apparent. <span id="more-107"></span></p>
<p>I performed the Upgrade option from 8.04 to 8.10, as I&#8217;d only just installed 8.04 on this machine. If I&#8217;d been running it for a year or more, I probably would have done a clean install, just to blow away the crud, but this time I just clicked the button and left it to go. Its a good idea to leave yourself plenty of time for this, not only because downloading the packages can take a while, but also because the chances are that something will break in the upgrade. Its also worth waiting a week or two before upgrading, as that gives people a chance to discover problems and post solutions to them online.</p>
<p>Downloading all the packages took around 12 hours on my crappy connection, so I left it to go overnight. If you do this, make sure you get to the part where it actually says its downloading the package files, otherwise you&#8217;ll wake up in the morning with a dialog box on your screen, and zero packages downloaded. Luckily it will still roll back to 8.04 at this point, so its not the end of the world.</p>
<p>OK, so having run the upgrade, the first thing to do is Reboot, and then put all your third party repositories back in place. I did this by opening System &gt; Administration &gt; Software Sources and physically visiting the URIs listed in each place. If there was an &#8216;intrepid&#8217; directory on the site, I&#8217;d change hardy to intrepid in the Edit box. If not, then I&#8217;d leave it on hardy. After this, a big global Re-check and Install Updates is in order, just to check you have the latest and greatest of everything. One more reboot and its time to look around. A few things had broken, but first, lets look at the great successes.</p>
<p>First of all I was enormously pleased to see that my Dell Vostro 1400 wireless was working. Properly! I checked in Hardware Drivers, and Windows Wireless Drivers and neither of those were active, so the new kernel was properly supporting my wireless. This, I feel is one of the most important enhancements for the 8.10 release: the more wireless chipsets that &#8216;just work&#8217; the better the chances Ubuntu will get adopted.</p>
<p>Dual Head also worked. Ironically the previous day I&#8217;d just spent a couple of hours trying to get this to work on 8.04, and on 8.10 it worked without any fiddling: just fire up the System &gt; Preferences &gt; Screen Resolution applet and it detects the two monitors and lets you configure them how you wish. They&#8217;ve achieved that by doing away with the settings from /etc/X11/xorg.conf. However that meant I had to look elsewhere to get my TouchPad Toggling Script to work.</p>
<p>I hear the Network Manager is a lot better now as it can configure GPRS connections as well as wireless and wired connections. However I&#8217;m using wicd for now, so I&#8217;ll look at that later. Also of note in this area is that networks configured via NetworkManager are brought up during boot, which is handy if you need to do things from the command line before logging into your desktop.</p>
<p>The Guest Session is interesting, allowing you to lend your computer to someone in a secure manner &#8212; all settings are temporary and disappear after logging out, and there is no access to the file system, so theoretically no damage can be done. This didn&#8217;t work at first for me, perhaps as a consequence of upgrading rather than installing fresh. Initially I was just presented with a login screen (which clearly a Guest Account shouldn&#8217;t need). However, by running the script from the command line</p>
<pre>/usr/share/gdm/guest-session/guest-session-launch</pre>
<p>I was able to make it work, and subsequently its worked from the button as well.</p>
<p>Another security feature is having an encrypted Private folder set up in a ~/Private directory. This is automatically locked and unlocked as you log in and out. As a sidenote its not entirely secret as the encrypted files can be accessed in your ~/.Private directory (ie with a dot). These can&#8217;t be read, but the file names are the same as the unencrypted versions, so best not to call them anything too explicit: secret_plan_to_take_over_the_world.doc for example.</p>
<p>To set this up you have to do some work. Type:</p>
<pre>sudo apt-get install ecryptfs-utils</pre>
<pre>ecryptfs-setup-private</pre>
<p>In terms of actual software updates there hasn&#8217;t been much as previously noted. GIMP has been upgraded to the 2.6 release which has a much nicer interface. VLC has a facelift, but it seems that some of the video encoding capability has been stripped out. Still trying to fix this. Virtual Box upgraded fine, and even compiled its own modules for the new kernel, so that was pretty seamless. Open Office 3, as noted elsewhere, was skipped in this version, but I&#8217;m sure it will be along soon.</p>
<p>Other tweaks: Totem can now play content from the BBC, although most of it seems to only be available in the UK. What&#8217;s the point of that? Clam AV is now available, and hopefully they&#8217;ll make a decent interface for it soon. And if you could turn on real time on-access scanning at will, that would be cool. Maybe next time.</p>
<p>All in all, I&#8217;m very pleased with the way things are going. The whole point for me is to make this easy to use rather than following Vista&#8217;s lead into confusing user interfaces and bloat, and the Ubuntu developers seem to remain focused on the things which will help them gain user share.</p>
]]></content:encoded>
			<wfw:commentRss>http://play.datalude.com/blog/2008/11/ubuntu-804-to-810-upgrade/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ubuntu 8.04 Dual Head setup on Dell Vostro.</title>
		<link>http://play.datalude.com/blog/2008/11/ubuntu-804-dual-head-setup-on-dell-vostro/</link>
		<comments>http://play.datalude.com/blog/2008/11/ubuntu-804-dual-head-setup-on-dell-vostro/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 02:44:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[dual head]]></category>
		<category><![CDATA[external monitor]]></category>
		<category><![CDATA[screen resolution]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[xorg.conf]]></category>
		<category><![CDATA[xrandr]]></category>

		<guid isPermaLink="false">http://play.datalude.com/blog/?p=104</guid>
		<description><![CDATA[I keep hearing how Ubuntu has finally nailed the dual head hassles of the past, and now you can just plug in an external monitor and go. Alas I&#8217;ve never had that experience, either with this Dell Vostro 1400 or either of the two IBM Thinkpads I&#8217;ve run Ubuntu on.The IBMs were both 1024&#215;768 resolution, [...]]]></description>
			<content:encoded><![CDATA[<p>I keep hearing how Ubuntu has finally nailed the dual head hassles of the past, and now you can just plug in an external monitor and go. Alas I&#8217;ve never had that experience, either with this Dell Vostro 1400 or either of the two IBM Thinkpads I&#8217;ve run Ubuntu on.The IBMs were both 1024&#215;768 resolution, as is my external monitor. The Dell is a less standard 1280&#215;800 resolution. I also, on occasion plug it into my LCD TV, but that&#8217;s another story.</p>
<p><span id="more-104"></span></p>
<p>The internal &#8220;Screen Resolution&#8221; application seems to consistently get all the settings wrong, and has never managed to guess the correct resolutions for monitors. Sometimes it doesn&#8217;t detect them at all. Other times when I try to manually set the resolutions, it refuses as my instruction doesn&#8217;t match its guess. The real magic seems to depend on a combination of xrandr, xorg.conf, grandr and a lot of poking and fiddling. In this case it seems relatively straightforward.</p>
<p>The first thing you have to do is tell your xorg.conf the size of the virtual screen. This is the size of the maximum resolution of the screen when you&#8217;ve added both displays together. In my example, I have a laptop screen of 1280&#215;800 on the left and an external screen of 1024&#215;768 on the right. This makes the Virtual screen (1280+1024)x(800), so the virtual directive reads.</p>
<pre> SubSection "Display"</pre>
<pre>  Virtual         2304 800</pre>
<pre> EndSubsection</pre>
<p>In my case the SubSection wasn&#8217;t already within the Screen section of my xorg.conf, so I created it by adding the three lines above. Time to restart X by logging out and in again.</p>
<p>Now when you use the Screen Resolution app, it should actually work: you can place the two screens side by side, uncheck the Clone Screens box and set the correct resolution and refresh rate for the monitors. The settings for the Vostro laptop screen are 1280&#215;800 @ 60Hz. Great. No need for tinkering with xrandr or grandr.</p>
]]></content:encoded>
			<wfw:commentRss>http://play.datalude.com/blog/2008/11/ubuntu-804-dual-head-setup-on-dell-vostro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Touchpad toggle tweak</title>
		<link>http://play.datalude.com/blog/2008/11/ubuntu-804-tweak-touchpad-toggle/</link>
		<comments>http://play.datalude.com/blog/2008/11/ubuntu-804-tweak-touchpad-toggle/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 08:41:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[General IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[toggle]]></category>
		<category><![CDATA[touchpad]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://play.datalude.com/blog/?p=99</guid>
		<description><![CDATA[I&#8217;ve been getting irritated with the touchpad on this new Dell Vostro 1400. I type for a while, and then my palm touches the touchpad, sending the pointer skimming into the line above, or clicking on buttons I don&#8217;t want to click on. So, I looked around and figured out a solution. Over the past [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been getting irritated with the touchpad on this new Dell Vostro 1400. I type for a while, and then my palm touches the touchpad, sending the pointer skimming into the line above, or clicking on buttons I don&#8217;t want to click on. So, I looked around and figured out a solution. Over the past two years, I&#8217;ve had to update this post for every single new version of Ubuntu, which has been a pain, so look for the heading below which corresponds to your version of Ubuntu.</p>
<p><strong>Ubuntu Hardy 8.04</strong></p>
<p>First of all, you need to edit your /etc/xorg.conf file, for which you&#8217;ll need root privileges &#8211; use sudo.You just need to add one line in the input device section, which is the one in bold below. (Intrepid 8.10, see below)</p>
<pre>Section "InputDevice"</pre>
<pre>        Identifier      "Synaptics Touchpad"</pre>
<pre>        Driver          "synaptics"</pre>
<pre>        Option          "SendCoreEvents"        "true"</pre>
<pre>        Option          "Device"                "/dev/psaux"</pre>
<pre>        Option          "Protocol"              "auto-dev"</pre>
<pre>        Option          "HorizEdgeScroll"       "0"</pre>
<pre><strong>        Option          "SHMConfig"</strong></pre>
<pre>EndSection<span id="more-99"></span></pre>
<p>OK, now after you restart X, by logging out and in again, you can turn off the touchpad with</p>
<pre>    synclient TouchpadOff=0</pre>
<p>And on with</p>
<pre>    synclient TouchpadOff=0</pre>
<p>I put this together in a script which will look to see if it is on or off, and toggle it to the opposite.</p>
<pre>if synclient -l | grep TouchpadOff | grep 1</pre>
<pre>then</pre>
<pre>    synclient TouchpadOff=0</pre>
<pre>else</pre>
<pre>    synclient TouchpadOff=1</pre>
<pre>fi</pre>
<p>I attached the script to an icon in my toolbar using the Add to Panel &gt; Launcher route. Now I just have to click to toggle it off and on.</p>
<p><strong>Ubuntu 8.10, Intrepid Whatsit </strong></p>
<p>While the script above still works, editing xorg.conf doesn&#8217;t work any more, as Ubuntu is moving functionality out of that file. So, instead of that we create a file here.</p>
<pre>sudo nano /etc/hal/fdi/policy/shmconfig.fdi</pre>
<p>and cut and paste the following into it, saving afterwards.</p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;ISO-8859-1&#8243;?&gt;<br />
&lt;deviceinfo version=&#8221;0.2&#8243;&gt;<br />
&lt;device&gt;<br />
&lt;match key=&#8221;input.x11_driver&#8221; string=&#8221;synaptics&#8221;&gt;<br />
&lt;merge key=&#8221;input.x11_options.SHMConfig&#8221; type=&#8221;string&#8221;&gt;True&lt;/merge&gt;<br />
&lt;merge key=&#8221;input.x11_options.HorizEdgeScroll&#8221; type=&#8221;string&#8221;&gt;1&lt;/merge&gt;<br />
&lt;/match&gt;<br />
&lt;/device&gt;<br />
&lt;/deviceinfo&gt;</p>
<p>This file only works with Synaptics Touchpad driver. If you have another touchpad, the filename may be different. There are hundreds of other options which you can activate in this file, but the SHMConfig line is the one you need to allow the script to work.</p>
<p>OK, now you&#8217;ve done that, the commands and script above should work.</p>
<p><strong>Ubuntu 9.04 Jaunty Jackass</strong></p>
<p>&#8230;. it should work unless you upgrade to 9.04 that is. Now neither of those methods work for disabling the touchpad, which is causing me no end of irritation. So now there&#8217;s a third solution which I discovered after finding the new touchpad control panel under System &gt; Preferences &gt; Mouse &gt; Touchpad. In there there is a switch to turn off the touchpad, so I figured there must be a way to change this setting with gconftool. Here&#8217;s what  came up with:</p>
<p>gconftool-2 &#8211;toggle /desktop/gnome/peripherals/mouse/touchpad_enabled</p>
<p>This works from the commandline, in a script and even typed directly into a launcher button on your menubar for lightning fast toggling. Which is the only way to toggle.</p>
<p><strong>Ubuntu 9.10 Karmic Koala<br />
</strong></p>
<p>Why do they have to change this every frigging version. OK, so back to a script into which the following is inserted.</p>
<pre>if xinput list-props "SynPS/2 Synaptics TouchPad" | grep "Device Enabled" | grep 1</pre>
<pre>then</pre>
<pre>    xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 8 0</pre>
<pre>else</pre>
<pre>     xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 8 1</pre>
<pre>fi</pre>
<p>Then assign this to a key (in my case F6) using System &gt; Preferences &gt; Keyboard Shortcuts. All seems to work again &#8230; until the next upgrade.</p>
]]></content:encoded>
			<wfw:commentRss>http://play.datalude.com/blog/2008/11/ubuntu-804-tweak-touchpad-toggle/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
