<?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>mFabrik - web and mobile development &#187; ubuntu</title>
	<atom:link href="http://blog.mfabrik.com/category/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mfabrik.com</link>
	<description>Freedom delivered.</description>
	<lastBuildDate>Thu, 02 Sep 2010 13:25:54 +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>Running 32-bit chroot on 64-bit Ubuntu server to reduce Python memory usage</title>
		<link>http://blog.mfabrik.com/2010/08/03/running-32-bit-chroot-on-64-bit-ubuntu-server-to-reduce-python-memory-usage/</link>
		<comments>http://blog.mfabrik.com/2010/08/03/running-32-bit-chroot-on-64-bit-ubuntu-server-to-reduce-python-memory-usage/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 16:15:02 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[plone]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[zope]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[chroot]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[debootstrap]]></category>
		<category><![CDATA[memory usage]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[restart]]></category>
		<category><![CDATA[zodb]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=606</guid>
		<description><![CDATA[Here are documented brief instructions how to run 32-bit chroot&#8217;ed environment on 64-bit Ubuntu server. chroot means that you run re-rooted and jailed system inside another system. What we do here is enabling 32-bit chroot&#8217;ed userland on 64-bit server. 32-bit userland and 32-bit Python environment reduces the memory usage of heavy website applications we are [...]]]></description>
			<content:encoded><![CDATA[<p>Here are documented brief instructions how to run 32-bit chroot&#8217;ed environment on 64-bit Ubuntu server. chroot means that you run re-rooted and jailed system inside another system.</p>
<p>What we do here is enabling 32-bit chroot&#8217;ed userland on 64-bit server. 32-bit userland and 32-bit Python environment reduces the memory usage of heavy website applications we are running (read: Plone/Zope), since 32-bit has only half of the pointer size and object-oriented programming is all about pointers. Zope is especially memory hungry, because it uses ZODB object database. The developer does not need to worry about when doing queries, updates or caches that much  as the persistent site state is transparent to Python (objects are automatically loaded from database or cache when they are referred). Easy persistency means that almost everything is in the database and you need to have big object cache. Plone has huge client-side, in-process, cache for persistent objects. The default setting is for the cache size 5000 objects. (sidenote: since ZODB cache is in-process and Python does not do threading too well, running big Plone sites means that you need run several processes to handle parallel requests &#8211; having multiple processes with big in-process caches means loads of memory consumption)</p>
<p>32-bit userland is especially useful if you need to run Plone on 64-bit VPS (virtual private server) with low amount of available memory (512 MB or 1 GB).</p>
<p>There are some brief measurements about 32-bit vs. 6-bit Python memory usage at the end of this article.</p>
<p>Unless otherwise specified, all command here should be run as the root user of the host system. Commands here are for example only and you <strong>need to know what you are doing</strong>. If you lack advanced UNIX administration skills we <a href="http://mfabrik.com/@@zoho-contact-form">gladly arrange you some commercial training or hosting support</a>.</p>
<h2>Installing</h2>
<p>Basic schroot installation instructions for Ubuntu can be found here <a title="https://help.ubuntu.com/community/DebootstrapChroot" href="https://help.ubuntu.com/community/DebootstrapChroot">https://help.ubuntu.com/community/DebootstrapChroot</a> . We also install ZopeSkel in the chroo&#8217;ed environment for starting creating Plone sites. Note that we are using Ubuntu 8.04 which still ships with Python 2.4 &#8211; <a href="http://blog.mfabrik.com/2010/07/16/easily-install-all-python-versions-under-linux-and-osx-using-collective-buildout-python/">for later Ubuntus you need to compile Python 2.4 from the scratch</a>.</p>
<pre>apt-get install debootstrap
apt-get install schroot

# Old schroot uses global schroot.conf, new versions have
# chroot.d directory

# This is a heredoc, but use what ever editor you like
# to create the configuration
cat &lt;&lt;EOF &gt; /etc/schroot/chroot.d/hardy_i386.conf
[hardy_i386]
description=Ubuntu 8.04 Hardy for i386
location=/srv/chroot/hardy_i386
personality=linux32
root-users=bob
run-setup-scripts=true
run-exec-scripts=true
type=directory
users=bob,john,alice,ploneuser
EOF

mkdir -p /srv/chroot/hardy_i386
debootstrap --variant=buildd --arch i386 hardy /srv/chroot/hardy_i386 \

http://archive.ubuntu.com/ubuntu/

# Check that the chroot is created and working
schroot -l

# Enter the chroot (logged in as bob)
schroot -c hardy_i386 -u root

# Once inside, install python2.4-dev and other needed tools
# Installing PIL with easy_install didn't work for some
# reason, so we use python-imaging package.
apt-get install python2.4-dev python-setuptools python-imaging
easy_install-2.4 ZopeSkel</pre>
<p>And that&#8217;s about it.</p>
<p>Chroot&#8217;ed environment will have</p>
<ul>
<li>It&#8217;s own application binaries (and userland bitness)</li>
</ul>
<p>Chroot&#8217;ed environment will share with the host system</p>
<ul>
<li>Ports</li>
<li>Processes</li>
<li>User accounts</li>
</ul>
<p>Chroot&#8217;ed users</p>
<ul>
<li>Can&#8217;t list filesystem outside chroot</li>
</ul>
<p>&#8230;giving additional safety for shared hosting in the case of chroot&#8217;ed environment is compromised.</p>
<h2>Entering chroot&#8217;ed environment as a specific user</h2>
<p>Try</p>
<pre>schroot -c hardy_i386 -u root</pre>
<p>&#8230;or&#8230;</p>
<pre>schroot -c hardy_i386 -u plone_user # After you have set-uped normal user for chroot'ed environment</pre>
<p><strong>All background processes you leave running in chroot&#8217;ed environment are terminated when you exit this environment</strong>, unless you create sessions as described below.</p>
<h2>Creating chroot sessions</h2>
<p>Sessions enable running commands in chroot without the need to have it constantly open.</p>
<pre># Create a new schroot session
schroot --chroot=hardy_i386 --user=ploneuser \
--session-name=plonesession \
--begin-session

# Run commands in the created session
schroot --chroot=plonesession --user=ploneuser --run-session \
/srv/plone/yourplonesite/bin/instance start

# Ending session
schroot --chroot=plonesession --user=ploneuser --end-session</pre>
<p>Note that -<em>-chroot</em> parameter takes in both actual chroot installations and session ids.</p>
<h2>Doing resets for chrooted environment</h2>
<p>The session processes exist as long as the session exist. Unless you explicitly start a new session with &#8211;begin-session the processes are terminated as soon as you log out from the chroot&#8217;ed environent.<br />
<strong>chroot&#8217;ed environment is temporary unless you explicitly specify it not be</strong><br />
Thus if you want to run daemonized services in chrooted environment you need to take care of session handling manually.<br />
Here is an example how do you construct a session (as a real root user) and then launch a shell script which will take care of launching applications inside the chroot.</p>
<pre># Terminate previous session if any
schroot --chroot=hardy_i386 --user=plone_user --session-name=plone_session --end-session</pre>
<pre>#Start the session (again)
schroot --chroot=hardy_i386 --user=plone_user --session-name=plone_session --begin-session</pre>
<pre># Run a start script inside the chroot'ed environment which will start Plone
# NGINX and other necessary 32-bit services
schroot --chroot=plone_session --user=plone_user --run-session /srv/plone/myplonesite/restart-all.sh</pre>
<h2>Running sessions at startup</h2>
<p>You can add schroot bootstrap in real /etc/rc.local:</p>
<pre>schroot --chroot=hardy_i386 --user=ploneuser \
--session-name=plonesession --begin-session \
&amp;&amp; schroot --chroot=plonesession --run-session \
/srv/plone/inst/bin/instance start</pre>
<p>Remember that the users have to be created outside the chrooted environment. If you set the home directory to something that exists only in the chrooted environment, use something like this</p>
<pre>adduser --no-create-home --home HOMEDIR_IN_CHROOT ploneuser</pre>
<p>Then to create the directory inside the chroot and set its ownership to the newly created user and group.</p>
<h2><strong>32-bit vs 64-bit memory consumption</strong></h2>
<p><strong></strong>Reason why we even tried this is that some python applications, like Zope, use references heavily and moving from 32bit to 64bit references increases memory usage. (<a title="J Stahl 2010" href="http://jstahl.org/archives/2010/01/24/plone-4-uses-29-less-memory-than-plone-3-thanks-python-2-6/">J Stahl 2010</a>)</p>
<p>Memory figures from a development Zope/Plone 3.3.5 server</p>
<table border="1" cellspacing="0" cellpadding="3" bordercolor="#000000">
<tbody>
<tr>
<td width="33.333333333333336%"></td>
<td width="33.333333333333336%" align="left">32-bit</td>
<td width="33.333333333333336%">64-bit</td>
</tr>
<tr>
<td width="33.333333333333336%">After startup</td>
<td width="33.333333333333336%">112 MiB RES<br />
116 MiB VIRT</td>
<td width="33.333333333333336%">175 MiB RES<br />
342 MiB VIRT</td>
</tr>
<tr>
<td width="33.333333333333336%">After normal usage</td>
<td width="33.333333333333336%">159 MiB RES<br />
194 MiB VIRT</td>
<td width="33.333333333333336%">236 MiB RES<br />
487 MiB VIRT</td>
</tr>
</tbody>
</table>
<p>This is far from a complete study, but it would seem that the chroot does pay off even though it has to load 32bit versions of basic libraries along. If running more than one instance on same server memory savings should increase.</p>
<h2>More information</h2>
<ul>
<li><a href="http://manpages.ubuntu.com/manpages/hardy/man1/schroot.1.html">http://manpages.ubuntu.com/manpages/hardy/man1/schroot.1.html</a></li>
<li><a href="http://en.wikipedia.org/wiki/Chroot">http://en.wikipedia.org/wiki/Chroot</a></li>
</ul>
<p>
<a href="http://blog.mfabrik.com"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></img></a> <a href="http://blog.mfabrik.com">Read our blog</a> <a href="http://twitter.com/mfabrik"> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></img></a> <a href="http://twitter.com/mfabrik">Follow us on Twitter</a> <a href="http://www.linkedin.com/in/ohtis"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/linkedin-24.png"></img></a> <a href="http://www.linkedin.com/in/ohtis">Mikko Ohtamaa on LinkedIn</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/08/03/running-32-bit-chroot-on-64-bit-ubuntu-server-to-reduce-python-memory-usage/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Debugging Skype crash problems on Ubuntu 10.04 Lucid Lynx Linux</title>
		<link>http://blog.mfabrik.com/2010/07/16/debugging-skype-crash-problems-on-ubuntu-10-04-lucid-lynx-linux/</link>
		<comments>http://blog.mfabrik.com/2010/07/16/debugging-skype-crash-problems-on-ubuntu-10-04-lucid-lynx-linux/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 08:30:11 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[bug tracker]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[log files]]></category>
		<category><![CDATA[skype]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=584</guid>
		<description><![CDATA[Symptoms: Your Skype crashes on incoming chat message or if you try to open a contact info / chat message &#8211; usually this leads to a crash on Skype start-up because there are always incoming chat messages in a queue. Skype is not really helpful regarding how to get meaningful log information from the client, [...]]]></description>
			<content:encoded><![CDATA[<p>Symptoms: Your Skype crashes on incoming chat message or if you try to open a contact info / chat message &#8211; usually this leads to a crash on Skype start-up because there are always incoming chat messages in a queue.</p>
<p>Skype is not really helpful regarding how to get meaningful log information from the client, <a href="http://forum.skype.com/index.php?showtopic=101297">but it is possible</a>.</p>
<p>Create a log directory</p>
<pre>mkdir ~/.Skype/Logs</pre>
<p>Run Skype from the command line and open a chat window so that it crashes</p>
<pre>moo@murskaamo:~$ skype
Aborted</pre>
<p>Now there should be log data available</p>
<pre>moo@murskaamo:~$ ls -lh ~/.Skype/Logs/
total 724K
-rw-r--r-- 1 moo moo 607K 2010-07-16 11:10 skype_20100716-1110.log
-rw-r--r-- 1 moo moo 116K 2010-07-16 11:10 skype_20100716-1110.trace.txt</pre>
<p>However, those log files are little useful for anybody except Skype developers as <a href="http://forum.skype.com/index.php?showtopic=65559">they are encrypted</a>. <a href="https://jira.skype.com/secure/Dashboard.jspa">Your only hope is to submit them to  a Skype bug tracker</a> and hope that someone answers you something meaningful. The guidelines how to create a bug report and how they are processed is little unclear &#8211; there doesn&#8217;t seem to be clear announcement from Skype whether they process  these reports or not.</p>
<p>The crashes probably are due to incompatible system library versions / bugs in them. Try downloading <a href="http://www.skype.com/intl/en-us/get-skype/on-your-computer/linux/post-download/">static Skype versions</a> which does not use system libraries.
<p>
<a href="http://blog.mfabrik.com"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></img></a> <a href="http://blog.mfabrik.com">Read our blog</a> <a href="http://twitter.com/mfabrik"> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></img></a> <a href="http://twitter.com/mfabrik">Follow us on Twitter</a> <a href="http://www.linkedin.com/in/ohtis"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/linkedin-24.png"></img></a> <a href="http://www.linkedin.com/in/ohtis">Mikko Ohtamaa on LinkedIn</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/07/16/debugging-skype-crash-problems-on-ubuntu-10-04-lucid-lynx-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easily install all Python versions under Linux and OSX using collective.buildout.python</title>
		<link>http://blog.mfabrik.com/2010/07/16/easily-install-all-python-versions-under-linux-and-osx-using-collective-buildout-python/</link>
		<comments>http://blog.mfabrik.com/2010/07/16/easily-install-all-python-versions-under-linux-and-osx-using-collective-buildout-python/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 07:47:45 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[plone]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[buildout]]></category>
		<category><![CDATA[collective]]></category>
		<category><![CDATA[compilation]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[pil]]></category>
		<category><![CDATA[python imaging library]]></category>
		<category><![CDATA[readline]]></category>
		<category><![CDATA[virtualenv]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=576</guid>
		<description><![CDATA[Here are short instructions how to install all versions (2.4, 2.5, 2.6, 2.7 and 3.1) of Python interpreters on UNIX system. The instructions were tested on Ubuntu 10.04 Lucid Lynx Linux but should work on other systems as is. The installation is based of downloading, compiling and installing different Pythons and their libraries using buildout [...]]]></description>
			<content:encoded><![CDATA[<p>Here are short instructions how to install all versions (2.4, 2.5, 2.6, 2.7 and 3.1) of Python interpreters on UNIX system. The instructions were tested on Ubuntu 10.04 Lucid Lynx Linux but should work on other systems as is. The installation is based of downloading, compiling and installing different Pythons and their libraries using <a href="http://www.buildout.org">buildout </a>tool. <a href="http://svn.plone.org/svn/collective/buildout/python/">A buildout configuration for doing this</a> is maintained by a <a href="http://plone.org">Plone</a> community.</p>
<p>This buildout is especially useful to get Python 2.4 properly running under the latest Ubuntu 10.04 Lucid Lynx. This is because Ubuntu repositories won&#8217;t ship with Python 2.4 packages anymore.</p>
<p>The installation will also include static compilation of some very popular libraries. These are dependencies for other Python packages including, but not limited, to</p>
<ul>
<li>libjpeg</li>
<li>Python imaging library</li>
<li>readline</li>
</ul>
<h2>Prerequisites</h2>
<ul>
<li>Some Python version is installed (OS default)</li>
<li>GCC compiler is installed (sudo apt-get install build-essential)</li>
<li>Subversion tool is installed (sudo apt-get install subversion)</li>
</ul>
<h2>Running it</h2>
<pre>svn co http://svn.plone.org/svn/collective/buildout/python/
cd python
python bootstrap.py
bin/buildout</pre>
<h2>Using it</h2>
<p>All Pythons are under <a href="http://pypi.python.org/pypi/virtualenv">virtualenv</a> installations. This means that you can activate one Python configuration for your shell once easily (<em>python</em> command will run under different Python versions).</p>
<p>Activating Python 2.4</p>
<pre>source python/python-2.4/bin/activate
(python-2.4)moo@murskaamo:~/code$ python -V
Python 2.4.6</pre>
<p>Check that Python Imaging Library works</p>
<pre>python
Python 2.4.6 (#1, Jul 16 2010, 10:31:46)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import PIL</pre>
<p>(No exceptions raised, Python Imaging Library works well).
<p>
<a href="http://blog.mfabrik.com"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></img></a> <a href="http://blog.mfabrik.com">Read our blog</a> <a href="http://twitter.com/mfabrik"> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></img></a> <a href="http://twitter.com/mfabrik">Follow us on Twitter</a> <a href="http://www.linkedin.com/in/ohtis"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/linkedin-24.png"></img></a> <a href="http://www.linkedin.com/in/ohtis">Mikko Ohtamaa on LinkedIn</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/07/16/easily-install-all-python-versions-under-linux-and-osx-using-collective-buildout-python/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Changing the location of Ubuntu 10.04 Lucid Lynx notification bubble to a different corner</title>
		<link>http://blog.mfabrik.com/2010/07/16/changing-the-location-of-ubuntu-10-04-lucid-lynx-notification-bubble-to-a-different-corner/</link>
		<comments>http://blog.mfabrik.com/2010/07/16/changing-the-location-of-ubuntu-10-04-lucid-lynx-notification-bubble-to-a-different-corner/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 07:22:19 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[area]]></category>
		<category><![CDATA[bubbles]]></category>
		<category><![CDATA[corner]]></category>
		<category><![CDATA[location]]></category>
		<category><![CDATA[lucid lynx]]></category>
		<category><![CDATA[notifications]]></category>
		<category><![CDATA[notify-osd]]></category>
		<category><![CDATA[ubunty]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=573</guid>
		<description><![CDATA[Ubuntu notifications, those grey bubbles for incoming instant messages and such, are in the top right corner under the system tray area by default. Many applications, like Google Chrome browser, place lots of controls there and notifications might block them. Also, you might prefer some other corner due to your personal taste. The application for [...]]]></description>
			<content:encoded><![CDATA[<p>Ubuntu notifications, those grey bubbles for incoming instant messages and such, are in the top right corner under the system tray area by default. Many applications, like Google Chrome browser, place lots of controls there and notifications might block them. Also, you might prefer some other corner due to your personal taste. The application for responsible for those bubbles is called <a href="https://wiki.ubuntu.com/NotifyOSD">notify-osd</a>.</p>
<p><a title="Customitizing notify-osd on Ubuntu 10.04" href="http://www.webupd8.org/2010/05/finally-easy-way-to-customize-notify.html">Here are instructions</a> how get a custom notification-osd which can read a config file where you can specify settings for the notifications. Though it requires you to install a custom notify-osd version, the instructions are plain and simple. For less hardcode users, <a href="http://www.webupd8.org/2010/05/new-notifyosdconfiguration-version-gui.html">there also exists a version with graphical user interface to configure notify-osd</a>.
<p>
<a href="http://blog.mfabrik.com"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></img></a> <a href="http://blog.mfabrik.com">Read our blog</a> <a href="http://twitter.com/mfabrik"> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></img></a> <a href="http://twitter.com/mfabrik">Follow us on Twitter</a> <a href="http://www.linkedin.com/in/ohtis"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/linkedin-24.png"></img></a> <a href="http://www.linkedin.com/in/ohtis">Mikko Ohtamaa on LinkedIn</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/07/16/changing-the-location-of-ubuntu-10-04-lucid-lynx-notification-bubble-to-a-different-corner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Joomla! on your Ubuntu/Linux server with basic security</title>
		<link>http://blog.mfabrik.com/2010/05/31/how-to-install-joomla-on-your-ubuntulinux-server-with-basic-security/</link>
		<comments>http://blog.mfabrik.com/2010/05/31/how-to-install-joomla-on-your-ubuntulinux-server-with-basic-security/#comments</comments>
		<pubDate>Mon, 31 May 2010 09:13:36 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[email. chmod]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[permissions]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[virtualhost]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=540</guid>
		<description><![CDATA[This how to shorty explains how to set-up a Joomla! hosting on a shared hosting server you own to have basic security. This instructions apply for Debian/Ubuntu based systems, but can be generalized to any Linux based system like Fedora. In this how to we use the following software versions Joomla 1.5 Apache 2.2 MySQL [...]]]></description>
			<content:encoded><![CDATA[<div>This how to shorty explains how to set-up a Joomla! hosting on a shared hosting server you own to have basic security. This instructions apply for Debian/Ubuntu based systems, but can be generalized to any Linux based system like Fedora.</div>
<div>In this how to we use the following software versions</div>
<div>
<ul>
<li>Joomla 1.5</li>
<li>Apache 2.2</li>
<li>MySQL 5.1</li>
<li>Ubuntu 8.04 Hardy Heron server edition</li>
</ul>
</div>
<p>The instructions may apply for other versions too.</p>
<h2>Prerequisitements</h2>
<p>What you need to have in order to use this how to</p>
<ul>
<li>Basic UNIX file permissions knowledge</li>
<li>Basic UNIX shell knowledge</li>
<li>You have a Linux server (Ubuntu / Debian) for which you have root user access and you plan to use this server to host one or several Joomla! sites</li>
<li>Apache and MySQL instaleld on your server</li>
</ul>
<h2>User setup<br />
<span style="font-weight: normal; font-size: 13px;"> </span></h2>
<h2><span style="font-weight: normal; font-size: 13px;">Set-up an UNIX user on a dedicated server for Joomla! hosting. The user can SSH in the box and write to his home folder, /tmp and /var/www site folder.</span></h2>
<p><span style="font-weight: normal; font-size: 13px;">We create a user called &#8220;user&#8221; in this instructions. Replace it with the username you desire. We also use the example site name (www).yoursite.com.</span></p>
<div>Create new UNIX user and /home/user folder.</div>
<pre>sudo adduser user # Asks for the password and created /home/user</pre>
<div>Create corresponding /var/www/user folder.</div>
<pre>sudo mkdir /var/www/user
sudo chmod -R user:user /var/www/user # Only user has writing access to this folder</pre>
<h2>Setup MySQL user account</h2>
<p>Install MySQL as per Debian/Ubuntu instructions.</p>
<p>Login as MySQL admin user (may vary depending how your MySQL is configured). Note that first you will be asked for <em>sudo</em> password, then for MySQL administrative user password.</p>
<pre>sudo mysql -u admin -p</pre>
<div>Then create a new database with the same name as new as the UNIX user. Make sure that we use UTF-8 character encoding so we avoid irritating encoding problems in the future.</div>
<pre>CREATE DATABASE user DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;</pre>
<div>Create a MySQL user with the same name as the UNIX user. Use  a random password and give it all rights for the database. Note that this password should differ from the UNIX username password as this must be stored as plain-text in Joomla PHP files. Also MySQL differs users whether they came from localhost or other IP address. Here we use localhost so that the database is connectable only from the same server as  Apache is running.</div>
<pre>GRANT ALL ON user.* TO 'user'@'localhost' identified by 'zxc123zxc';<span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px; white-space: normal; font-size: 13px;"> </span></pre>
<h2>Extract Joomla! installation files</h2>
<p><span style="font-size: x-small;"><span style="font-size: small;"><span>Enter the folder which will contain web site PHP files.</span></span></span></p>
<pre>sudo -i -u user # pose yourself as UNIX user who runs the site</pre>
<pre>cd /var/www/user</pre>
<div>Load the latest Joomla! source code to the server using wget command. Check <a href="http://www.joomla.org/download.html">the download URL from joomla.org web site</a>.</div>
<pre>wget http://joomlacode.org/gf/download/frsrelease/12350/51111/Joomla_1.5.18-Stable-Full_Package.zip</pre>
<div>Unzip it.</div>
<div>
<pre>unzip Joomla_1.5.18-Stable-Full_Package.zip</pre>
<p>Exit posing yourself as user UNIX user.</p>
<pre>exit</pre>
</div>
<h2>Set file permission</h2>
<div>In order to secure your server</div>
<div>
<ul>
<li>Configuration files and upload directory must be writable by Apache user (www-data for Ubuntu/Debian, httpd for Fedora/Red Hat)</li>
<li>Other .php files should be read-only</li>
</ul>
</div>
<p>Note that during Joomla&#8217;s browser based installation Apache&#8217;s <em>www-data</em> must have write access to folder in order to create configuration.php file. We will later remove this access right.</p>
<p>We will set Joomla! files under UNIX group group www-data so that Apache can read them. Certain files are set to be writable. This must be done as root user.</p>
<pre>sudo chown -R user:www-data /var/www/user # Make user group to www-data</pre>
<pre>sudo chmod g+wrx /var/www/user # Read only access to www-data user. Write access for installation, will be later removed.</pre>
<p>Now <em>ls -l</em> command in /var/www/user should give you something like this for fil masks:</p>
<pre>drwxr-xr-x 11 user www-data    4096 2010-05-28 10:22 plugins
-rwxr--r--  1 user www-data     304 2010-05-28 10:21 robots.txt
drwxr-xr-x  6 user www-data    4096 2010-05-28 10:22 templates</pre>
<h2>Creating Apache configuration</h2>
<div>This allows serving Joomla! by Apache and starting the browser based configuration.</div>
<div>First create Apache configuration file under <em>/etc/apache2/sites-enabled</em> as root user. We assume <em>nano</em> terminal base text editor is installed on the server.</div>
<pre>sudo nano /etc/apache2/sites-enabled/yoursite.conf</pre>
<div>Below is a sample configuration file. You may need to match your server public IP in &lt;virtualhost, so that Apache knows for which IP address sites are served. We use virtual hosting: every site on the server is identified by incoming HTTP request.</div>
<div><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">&lt;VirtualHost *&gt;</span></div>
<pre>   ServerName yoursite.com
   ServerAlias www.yoursite.com
   ServerAdmin info@yourcompany.com

   LogFormat       combined
   TransferLog     /var/log/apache2/yoursite.log

   # Make sure this virtual host if capable of executing PHP5
   Options +ExecCGI
   AddType application/x-httpd-php .php .php5

   # Point to www folder where Joomla! is extracted
   DocumentRoot /var/www/yoursite

   # Do not give illusion of safety
   # as PHP safe_mode really is a crap
   # and only causes problems
   php_admin_flag safe_mode off

   #
   # This entry will redirect traffic www.yoursite.com -&gt; yoursite.com
   # Assume mod_rewrite is installed and enabled on Apache
   # 301 is HTTP Permanent Redirect code
   RewriteEngine On
   RewriteCond %{HTTP_HOST} ^www\.yoursite\.com [NC]
   RewriteRule (.*) http://yoursite.com$1 [L,R=301]

&lt;/VirtualHost&gt;</pre>
<h2><span style="font-weight: normal;">Faking the DNS entry</span></h2>
<div>If you have not yet reserved a domain name for your site, but still want to get the virtual host working, you can add a DNS name entry into a <a href="http://en.wikipedia.org/wiki/Hosts_file">hosts</a> file on your local computer. The following assumes you are using Ubuntu desktop, but <em>hosts </em>file is available on Windows and OSX too.</div>
<pre>sudo gedit /etc/hosts</pre>
<div>Then add the lines like the example below. Do not forget to remove this from <em>hosts</em> file when the actual DNS has been set up.</div>
<pre># Force this hostname to go to your server public IP address from your local computer</pre>
<pre>123.123.123 yoursite.com www.yoursite.com</pre>
<h2>Start Joomla! browser based installation</h2>
<div>Then enter the URL of your site to the browser:</div>
<pre>http://yoursite.com</pre>
<div>Joomla! installation page should appear.</div>
<div>
<ul>
<li>Fill in MySQL database values as created before.</li>
<li>If you plan to use SSH for file transfer do not enable FTP layer (unsecure).</li>
<li>Use a random password as Joomla! administrator user and store it somewhere in safe.</li>
<li>When Joomla! browser based installation goes to the point it asks you to remove the installation directory follow the instructions below.</li>
</ul>
</div>
<h2 style="font-size: 1.5em;">Secure the configuration</h2>
<div>Now remove extra permissions from Apache&#8217;s www-data user so that in the case there is a PHP / Joomla security hole, your site files cannot get compromised.</div>
<div>Some folders must remain writable as Joomla! will upload or write files in them.</div>
<pre>sudo chmod -R g-w /var/www/user # Remote write permission
sudo rm -rf /var/www/user/installation # Remove installation directory
# Add write permission to folders which contain writable files
sudo chmod -R g+x /var/www/user/logs
sudo chmod -R g+x /var/www/user/images
sudo chmod -R g+x /var/www/user/tmp
sudo chmod -R g+x /var/www/user/images</pre>
<h2>Setting up htaccess files</h2>
<p>Joomla! comes with a sample htaccess file which has some security measurements by having RewriteRules to prevent malformed URL access.</p>
<p>To install this file do the following</p>
<pre>sudo -i
cd /var/www/user
cp htaccess.txt .htaccess
chmod user:www-data .htaccess # Set file permission to be readable by Apache and writable by the UNIX user</pre>
<p>Then we create a .htaccess file which we will place in all folders with Joomla! write access to prevent execution of PHP files in these folders. First we create htaccess.limited file which we use as a template.</p>
<pre>sudo -i
cd /var/www/user
nano htaccess.limited # Open text editor</pre>
<p>Use the following htaccess.limited content</p>
<pre># secure directory by disabling script execution
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
Options -ExecCGI -Indexes</pre>
<p>And put the master template htaccess.limited  to proper places</p>
<pre>cp htaccess.limited media/.htaccess
chown -R user:www-data media/.htaccess 

cp htaccess.limited tmp/.htaccess
chown -R user:www-data tmp/.htaccess 

cp htaccess.limited logs/.htaccess
chown -R user:www-data logs/.htaccess

cp htaccess.limited images/.htaccess
chown -R user:www-data images/.htaccess</pre>
<h2>Start using the site</h2>
<div>Now go to your site with the browser again and Joomla! start page should come up.</div>
<div>Login as administration account you gave in Joomla! browser based installation.</div>
<div>Type URL <em>http://yoursite.com</em> in your browser.</div>
<h2>Setting outgoing email</h2>
<div>This is probably first thing you want to do as Joomla! administrator. You configure the SMTP server which will be used for outgoing email. The server  is usually provided by network operator who provides the internet connection for your server.</div>
<div>Login as Joomla! administrator user.</div>
<div>Go to Site  -&gt; Global Configuration -&gt; Server.</div>
<div>Choose SMTP mail mode.</div>
<div>Enter SMTP details.</div>
<h3>Test outgoing email</h3>
<div>Create a new user with an email address you control The user should receive <em>New User Details</em> email message from the site on the moment the user is created.</div>
<h2>Maintaining file permission</h2>
<div>If you modify or create any files (e.g. upload a new theme) to your server you need to set file permissions for it.</div>
<div>
<ul>
<li>UNIX  user: <em>user (</em>your site username)</li>
<li>UNIX group: <em>www-data</em></li>
</ul>
</div>
<div>To make it possible to set the group ownership with user user you first need to add it to www-data group.</div>
<div>
<pre>sudo usermod -a -G www-data user # Add user to www-data group so that it can set group permissions</pre>
</div>
<div>Then you can fix the permissions for uploaded files (templates and libraries folders assumed)</div>
<pre>sudo -i -u user # Login as your UNIX user
chgrp -R www-data templates libraries # Fix group ownership
chmod -R g+rx libraries templates # Set read access for the group</pre>
<div>This way secure file permissions are fixed after files have been changed. Alternatively, if your secure SFTP program supports setting permissions during the file upload, you can use that option</div>
<p>
<a href="http://blog.mfabrik.com"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></img></a> <a href="http://blog.mfabrik.com">Read our blog</a> <a href="http://twitter.com/mfabrik"> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></img></a> <a href="http://twitter.com/mfabrik">Follow us on Twitter</a> <a href="http://www.linkedin.com/in/ohtis"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/linkedin-24.png"></img></a> <a href="http://www.linkedin.com/in/ohtis">Mikko Ohtamaa on LinkedIn</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/05/31/how-to-install-joomla-on-your-ubuntulinux-server-with-basic-security/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>ssh-copy-id for OSX</title>
		<link>http://blog.mfabrik.com/2010/04/16/ssh-copy-id-for-osx/</link>
		<comments>http://blog.mfabrik.com/2010/04/16/ssh-copy-id-for-osx/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 19:22:11 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=501</guid>
		<description><![CDATA[ssh-copy-id is a handy shell script which allows you to easily copy your public key to a remote server, so that you don&#8217;t need type in password every time you take SSH connection into that box. Ubuntu and the latest Linux distros ship ssh-copy-id with the ssh client installation. However, for OSX you need to [...]]]></description>
			<content:encoded><![CDATA[<p>ssh-copy-id is a handy shell script which allows you to easily copy your public key to a remote server, so that you don&#8217;t need type in password every time you take SSH connection into that box. Ubuntu and the latest Linux distros ship ssh-copy-id with the ssh client installation. However, for OSX you need to manually drop this little script into your /usr/bin.</p>
<p>The usage is simple. Just run:</p>
<pre>ssh-copy-id remotebox.com</pre>
<p>to copy your public SSH key to remotebox.com. After that</p>
<pre>ssh remotebox.com</pre>
<p>shoud ask no password.</p>
<p><a href="http://blog.christopherpitzer.com/2010/ssh-copy-id/">Working installation instructions for ssh-copy-id on OSX are in Chris Pitzer&#8217;s blog</a>.
<p>
<a href="http://blog.mfabrik.com"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/mfabrik-24.png"></img></a> <a href="http://blog.mfabrik.com">Read our blog</a> <a href="http://twitter.com/mfabrik"> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml"><img valign="middle" src="http://www.feedburner.com/fb/images/pub/feed-icon16x16.png" alt="" style="vertical-align:middle;border:0"/></a> <a href="http://feeds.feedburner.com/mFabrikWebAndMobileDevelopment" rel="alternate" type="application/rss+xml">Subscribe mFabrik blog in a reader</a> <img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/twitter-24.png"></img></a> <a href="http://twitter.com/mfabrik">Follow us on Twitter</a> <a href="http://www.linkedin.com/in/ohtis"><img valign="middle"  src="http://blog.mfabrik.com/wp-content/uploads/linkedin-24.png"></img></a> <a href="http://www.linkedin.com/in/ohtis">Mikko Ohtamaa on LinkedIn</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/04/16/ssh-copy-id-for-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Could not open a connection to your authentication agent on Ubuntu 9.10 Linux</title>
		<link>http://blog.mfabrik.com/2010/04/09/could-not-open-a-connection-to-your-authentication-agent-on-ubuntu-9-10-linux/</link>
		<comments>http://blog.mfabrik.com/2010/04/09/could-not-open-a-connection-to-your-authentication-agent-on-ubuntu-9-10-linux/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 10:47:53 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.mfabrik.com/?p=458</guid>
		<description><![CDATA[I just run into this when tried to enable Github SSH to perform git push. The workaround is to run command `eval ssh-agent` Which sets series on environment variables making ssh-add to work. I don&#8217;t know why this doesn&#8217;t work anymore &#8211; I am quite sure it worked on earlier Ubuntu versions out of the [...]]]></description>
			<content:encoded><![CDATA[<p>I just run into this when tried to enable Github SSH to perform git push.</p>
<p>The workaround is to run command</p>
<pre>`eval ssh-agent`</pre>
<p>Which sets series on environment variables making ssh-add to work.</p>
<p>I don&#8217;t know why this doesn&#8217;t work anymore &#8211; I am quite sure it worked on earlier Ubuntu versions out of the box.</p>
<p><a href="https://bugs.launchpad.net/ubuntu/+source/gnupg2/+bug/392555">Related bug report</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/04/09/could-not-open-a-connection-to-your-authentication-agent-on-ubuntu-9-10-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Profiling PostgreSQL database</title>
		<link>http://blog.mfabrik.com/2010/01/02/profiling-postgresql-database/</link>
		<comments>http://blog.mfabrik.com/2010/01/02/profiling-postgresql-database/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 23:35:05 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.twinapex.fi/?p=388</guid>
		<description><![CDATA[This blog post will have some short notes about monitoring and profiling PostgreSQL databases. pgtop pgtop provides UNIX top command like user interface for PostgreSQL. pgtop command is available as Perl CPAN module. How to install Perl CPAN modules as non-root user on Ubuntu (note: when it prompts to run sudo, answer no). To install [...]]]></description>
			<content:encoded><![CDATA[<p>This blog post will have some short notes about monitoring and profiling PostgreSQL databases.</p>
<h2>pgtop</h2>
<p>pgtop provides UNIX top command like user interface for PostgreSQL. pgtop command is available as Perl CPAN module.</p>
<p><a href="http://perl.jonallen.info/writing/articles/install-perl-modules-without-root">How to install Perl CPAN modules as non-root user on Ubuntu</a> (note: when it prompts to run sudo, answer no).</p>
<p>To install pgtop install following CPAN modules first: Term::ANSIColor, Term::ReadKey, DBD::Pg</p>
<pre>perl -MCPAN -Mlocal::lib -e 'CPAN::install(DBD::Pg)'
perl -MCPAN -Mlocal::lib -e 'CPAN::install(Term::ReadKey)'
perl -MCPAN -Mlocal::lib -e 'CPAN::install(Term::ANSIColor)'
<a href="http://cpansearch.perl.org/src/COSIMO/pgtop-0.05/README">
</a></pre>
<p><a href="http://cpansearch.perl.org/src/COSIMO/pgtop-0.05/README">pgtop install instructions</a><a href="http://search.cpan.org/~cosimo/pgtop-0.05/pgtop"><br />
</a></p>
<p><a href="http://search.cpan.org/~cosimo/pgtop-0.05/pgtop">pgtop manul</a></p>
<p>Running pgtop:</p>
<pre>perl pgtop -d databasename -u yourdbuser -p yourdbuserpassword</pre>
<h2>pgfouine</h2>
<p><a href="http://pgfouine.projects.postgresql.org/tutorial.html">pgfouine </a>is a log analyzer for PostgreSQL.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2010/01/02/profiling-postgresql-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up multi-touch scrolling for Ubuntu 9.10 Karmic Koala Linux on Asus Eee 1005HA netbook</title>
		<link>http://blog.mfabrik.com/2009/10/11/setting-up-multi-touch-scrolling-for-ubuntu-9-10-karmic-koala-linux-on-asus-eee-1005ha-netbook/</link>
		<comments>http://blog.mfabrik.com/2009/10/11/setting-up-multi-touch-scrolling-for-ubuntu-9-10-karmic-koala-linux-on-asus-eee-1005ha-netbook/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 01:05:25 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[asus]]></category>
		<category><![CDATA[eee]]></category>
		<category><![CDATA[fdi]]></category>
		<category><![CDATA[hal]]></category>
		<category><![CDATA[karmic koala]]></category>
		<category><![CDATA[macbook]]></category>
		<category><![CDATA[multi-touch]]></category>
		<category><![CDATA[scroll]]></category>
		<category><![CDATA[synaptics]]></category>
		<category><![CDATA[synclient]]></category>
		<category><![CDATA[touchpad]]></category>
		<category><![CDATA[two-finger]]></category>
		<category><![CDATA[x11]]></category>
		<category><![CDATA[xinput]]></category>

		<guid isPermaLink="false">http://blog.twinapex.fi/?p=310</guid>
		<description><![CDATA[This post is specific to Asus Eee 1005HA netbook, but the technique explained here can be used on any computer having Synaptics touchpad. Multi-touch gestures allow you to perform user interface actions by doing two finger gestures on touchpad. Apple introduced this feature on Macbooks and after you get used to it, it greatly enhances [...]]]></description>
			<content:encoded><![CDATA[<p>This post is specific to Asus Eee 1005HA netbook, but the technique explained here can be used on any computer having Synaptics touchpad.</p>
<p>Multi-touch gestures allow you to perform user interface actions by doing two finger gestures on touchpad. Apple introduced this feature on Macbooks and after you get used to it, it greatly enhances your web browsing on mouseless netbook. The most important gesture is scroll text by swiping the touchpad with two fingers.</p>
<p>Apple has also many patents related to the gestures so they are not enabled by default.</p>
<p>The real multi-finger touch support needs multi-finger aware (capacitive) touchpad. Most PC laptops are not equipped with one. Luckily some of the simple gestures, like two finger scrolling, can be emulated on normal pressure point sensitive touchpad via clever calculations and other tricks.</p>
<p><strong>Note</strong>: <a href="https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/355071">Ubuntu HAL support for Synaptics seem to be broken</a>. Only shell script at the end of the post will work. HAL options in FDI file are being ignored.</p>
<h2>Setting up Synaptics driver</h2>
<p>Type in terminal</p>
<pre>gksudo gedit /etc/hal/fdi/policy/11-x11-synaptics.fdi</pre>
<p>Create and save file with this content:</p>
<pre>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
&lt;deviceinfo version="0.2"&gt;
 &lt;device&gt;
   &lt;match key="info.capabilities" contains="input.touchpad"&gt;
       &lt;merge key="input.x11_driver" type="string"&gt;synaptics&lt;/merge&gt;
       &lt;merge key="input.x11_options.SHMConfig" type="string"&gt;On&lt;/merge&gt;

       &lt;merge key="input.x11_options.EmulateTwoFingerMinZ" type="string"&gt;40&lt;/merge&gt;
       &lt;merge key="input.x11_options.VertTwoFingerScroll" type="string"&gt;1&lt;/merge&gt;
       &lt;merge key="input.x11_options.HorizTwoFingerScroll" type="string"&gt;1&lt;/merge&gt;
       &lt;merge key="input.x11_options.TapButton1" type="string"&gt;1&lt;/merge&gt;
       &lt;merge key="input.x11_options.TapButton2" type="string"&gt;3&lt;/merge&gt;  &lt;!--two finger tap -&gt; middle clieck(3) --&gt;
       &lt;merge key="input.x11_options.TapButton3" type="string"&gt;2&lt;/merge&gt;  &lt;!--three finger tap -&gt; right click(2). almost impossible to click --&gt;
   &lt;/match&gt;
 &lt;/device&gt;
&lt;/deviceinfo&gt;</pre>
<p>This allows us to use synclient utility to watch touchpad real-time data in console window.</p>
<p>Now restart X</p>
<pre>sudo /etc/init.d/gdm restart</pre>
<p>And open terminal again.</p>
<p>Type in command</p>
<pre>synclient -m 100</pre>
<p>And you should see data like this scrolling in the terminal:</p>
<pre>129.355  2912 3469  59 1  4  0 0 0 0 0  00000000   0  0  0   0   0
 129.455  2952 3529  59 1  4  1 0 0 0 0  00000000   0  0  0   0   0
 time     x    y   z f  w  l r u d m     multi  gl gm gr gdx gdy
 129.555  3283 3516  60 1  4  1 0 0 0 0  00000000   0  0  0   0   0
 129.656  3928 3517  60 1  4  1 0 0 0 0  00000000   0  0  0   0   0
 129.756  4364 3637  60 1  4  1 0 0 0 0  00000000   0  0  0   0   0
 129.856  4020 3329  49 1  4  0 0 0 0 0  00000000   0  0  0   0   0
 129.956  3634 3122  58 1  4  0 0 0 0 0  00000000   0  0  0   0   0
 130.057  3320 2957  60 1  4  0 0 0 0 0  00000000   0  0  0   0   0
 130.157  2779 3312  61 1  4  0 0 0 0 0  00000000   0  0  0   0   0
 130.257  2557 3739  61 1  4  0 0 0 0 0  00000000   0  0  0   0   0
 130.358  2636 3485  39 1  4  0 0 0 0 0  00000000   0  0  0   0   0
 130.458  2659 3104  60 1  4  0 0 0 0 0  00000000   0  0  0   0   0
 130.558  2671 2988  60 1  4  0 0 0 0 0  00000000   0  0  0   0   0</pre>
<p>f column tells the number of fingers. w is the touched area width. z is the pressure.</p>
<p>If you put two fingers on touchpad and you see value f=2 then your hardware has multi-touch aware touchpad. Unfortunately Asus Eee 1005HA doesn&#8217;t seem to have one <img src='http://blog.mfabrik.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<h2>Emulation approach</h2>
<p>Synaptics driver can emulate two-finger touch with the following conditions</p>
<ul>
<li>Touched area width exceeds certain threshold (min width)</li>
<li>Touch pressure exceeds certain thresholds</li>
</ul>
<p>When the conditions are met the driver thinks &#8220;Wow looks this guy is pressing us really hard. maybe he is using two fingers?&#8221; Note that touchpad values are touchpad specific and values applying for one model don&#8217;t work on another computer.</p>
<p><a href="http://manpages.ubuntu.com/manpages/karmic/man4/synaptics.4.html">Synaptics driver settings are described here</a>. Synaptic driver settings can be modified run-time using xinput command. Run <em>synclient -m 100</em> in one terminal window and change threshold values in other until you find correct emulation parameters for your laptop. Below is my xinput tests. Test scrolling on Firefox and any long web page.</p>
<pre>moo@huiskuttaja:~$ xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 32 7
moo@huiskuttaja:~$ xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 32 280
moo@huiskuttaja:~$ xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 32 11
moo@huiskuttaja:~$ xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 32 50
moo@huiskuttaja:~$</pre>
<p>Looks like the following parameters are good for two finger emulation for Asus Eee 1005HA:</p>
<ul>
<li>Width: 8</li>
<li>Pressure (Z): 10</li>
</ul>
<p>You can also use command synclient -l to dump the current settings.</p>
<p>Below is the final script you need to run during log-in (see note about broken HAL at the beginning of the post):</p>
<pre>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 1504px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">#!/bin/sh</div>

#!/bin/sh
#
# Use xinput --list-props "SynPS/2 Synaptics TouchPad" to extract data
#

# Set multi-touch emulation parameters
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Pressure" 32 10
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Width" 32 8
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Two-Finger Scrolling" 8 1
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Two-Finger Scrolling" 8 1 1

# Disable edge scrolling
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Edge Scrolling" 8 0 0 0 

# This will make cursor not to jump if you have two fingers on the touchpad and you list one
# (which you usually do after two-finger scrolling)
xinput set-int-prop "SynPS/2 Synaptics TouchPad" "Synaptics Jumpy Cursor Threshold" 32 110
<strong>
</strong></pre>
<pre><strong>Jumpy cursor after two finger scroll</strong></pre>
<p>When you do a two-finger scroll and lift your one finger before the other the mouse cursor/scrolling may jump. Synaptics driver does not seem to have an option to filter out this bad event. If anyone knows solution for this please comment.</p>
<h2>Other resources</h2>
<ul>
<li> <a href="http://randomtruth.110mb.com/blog/index.php/2009/03/30/v10-of-linux-multi-touch-released/">Linux Multi-Touch</a> is a project to collect set of Perl scripts related to multi-touch events. If you want to customize your multi-touch experience and you have some development insight, this is the place to begin.</li>
<li><a href="https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-input-synaptics/+bug/422224">Notes about multi-touch emulation (see the last comment)</a>.<a href="http://ubuntu-snippets.blogspot.com/2009/03/multi-touch-for-anyall-synaptics.html"> </a></li>
<li><a href="http://ubuntu-snippets.blogspot.com/2009/03/multi-touch-for-anyall-synaptics.html">Diagnosing multitouch support and editing HAL files</a>.</li>
<li><a href="http://brainstorm.ubuntu.com/idea/3077/">Related idea on Ubuntu Brainstorm</a>.</li>
<li><a href="http://cgit.freedesktop.org/xorg/driver/xf86-input-synaptics/">Synaptics X11 driver source</a>. <a href="http://web.telia.com/~u89404340/touchpad/index.html">Synaptics driver project page</a>. Looks like there is no one central figure behind it, except for maintaining, and big bunch of patches from distributors.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2009/10/11/setting-up-multi-touch-scrolling-for-ubuntu-9-10-karmic-koala-linux-on-asus-eee-1005ha-netbook/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>Autoconfiguring dual monitors on Ubuntu</title>
		<link>http://blog.mfabrik.com/2009/07/14/autoconfiguring-dual-monitors-on-ubuntu/</link>
		<comments>http://blog.mfabrik.com/2009/07/14/autoconfiguring-dual-monitors-on-ubuntu/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 09:51:32 +0000</pubDate>
		<dc:creator>Mikko Ohtamaa</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[autodetect]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[disper]]></category>
		<category><![CDATA[display]]></category>
		<category><![CDATA[dual monitor]]></category>
		<category><![CDATA[external display]]></category>
		<category><![CDATA[hotplug]]></category>
		<category><![CDATA[internal display]]></category>
		<category><![CDATA[taskbar]]></category>

		<guid isPermaLink="false">http://blog.twinapex.fi/?p=201</guid>
		<description><![CDATA[The following shell script is a helper script for laptop users who connect an external monitor now and then to their laptop. Since Ubuntu does not provide clever ways to arrange desktop or detect connected displays, you need to run the script from terminal when you change your monitor configuration. detect the numbers of monitors [...]]]></description>
			<content:encoded><![CDATA[<p>The following shell script is a helper script for laptop users who connect an external monitor now and then to their laptop. Since Ubuntu does not provide clever ways to arrange desktop or detect connected displays, you need to run the script from terminal when you change your monitor configuration.</p>
<ul>
<li>detect the numbers of monitors you have attached</li>
<li>Activate the second (external) monitor if there are two monitors</li>
<li>Use the external monitory as the primary display, otherwise use internal display as a primary display</li>
<li>Move your taskbars to the primary display</li>
</ul>
<p>It is based on <a href="http://willem.engen.nl/projects/disper/">disper</a> tool by Willem van Engen. For now (2009), it&#8217;s nVidia only. ATI support could be possible.</p>
<pre>#!/bin/sh
#
# Detect displays and move panels to the primary display
#
# Copyright 2009 Twinapex Research
#
# Author &lt;mikko.ohtamaa@twinapex.com&gt;
#

# disper command will detect and configure monitors
disper --displays=auto -e

# parse output from disper tool how many displays we have attached
# disper prints 2 lines per displer
lines=`disper -l|wc -l`

display_count=$((lines / 2))

echo $display_count

echo "Detected display count:" $display_count

# Make sure that we move panels to the correct display based
# on the display count
if [ $display_count = 1 ] ; then
   echo "Moving panels to the internal LCD display"
   gconftool-2 \
        --set "/apps/panel/toplevels/bottom_panel_screen0/monitor" \
        --type integer "0"
   gconftool-2 \
        --set "/apps/panel/toplevels/top_panel_screen0/monitor" \
        --type integer "0"
else
   echo "Moving panels to the external display"
   gconftool-2 \
        --set "/apps/panel/toplevels/bottom_panel_screen0/monitor" \
        --type integer "1"
   gconftool-2 \
        --set "/apps/panel/toplevels/top_panel_screen0/monitor" \
        --type integer "1"
fi</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.mfabrik.com/2009/07/14/autoconfiguring-dual-monitors-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
