<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>
<channel>
	<title>G-Loaded Journal &#187; System</title>
	<atom:link href="http://www.g-loaded.eu/tag/system/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.g-loaded.eu</link>
	<description>An open-source software and technology related journal</description>
	<lastBuildDate>Mon, 05 Dec 2011 19:55:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
		<item>
		<title>Partition Misalignment Slows Down 4096-Byte Sector Hard Disks</title>
		<link>http://www.g-loaded.eu/2010/03/29/partition-misalignment-slows-4096-byte-sector-hard-drives/</link>
		<comments>http://www.g-loaded.eu/2010/03/29/partition-misalignment-slows-4096-byte-sector-hard-drives/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 23:32:01 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[System]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1662</guid>
		<description><![CDATA[I just read this very interesting article about the new 4096-byte sector hard disks, like the new Western Digital Caviar Green drives, and the impact a partition misalignment might have on the drive&#8217;s write performance. The problem most likely to hit you with one of these drives is very slow write performance. This is caused [...]]]></description>
			<content:encoded><![CDATA[<p>I just read this very interesting article about the new 4096-byte sector hard disks, like the new Western Digital Caviar Green drives, and the impact a partition misalignment might have on the drive&#8217;s write performance.<br />
<span id="more-1662"></span></p>
<blockquote><p>The problem most likely to hit you with one of these drives is very slow write performance. This is caused by improper logical-to-physical sector alignment. OS&#8217;s like Linux use 4K blocks (or multiples of 4K) to store data, which matches well with the physical sector. However, nothing restricts you from creating a partition that starts on an odd-numbered 512-byte logical sector. This misalignment causes a performance hit since the drive has to read and rewrite the 4K sectors with whatever 512-byte slices changed.</p></blockquote>
<p>The article author continues with a test he performed on two identical WD Green drives containing one partition. On the first drive he used fdisk defaults for the partition boundaries, while on the second drive he manually aligned the partition. The results show that a misaligned drive can be up to 3 times slower than a properly aligned one.</p>
<blockquote><p>&#8230;I formatted both drives using the command &#8220;time mke2fs /dev/sdc1&#8243; (and sdd1).</p>
<p>/dev/sdc, which was aligned, took 5m 45.716s to format.<br />
/dev/sdd, which was not aligned, took 19m 53.609s to format.</p>
<p>That&#8217;s a difference of greater than a factor of three!</p></blockquote>
<p>The article author conducted several other tests. This is a very good read. Read the <a href="http://www.osnews.com/story/22872/Linux_Not_Fully_Prepared_for_4096-Byte_Sector_Hard_Drives">full article</a>.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2010/03/29/partition-misalignment-slows-4096-byte-sector-hard-drives/">Partition Misalignment Slows Down 4096-Byte Sector Hard Disks</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/11/05/howto-run-vmware-on-a-physical-windows-partition/" rel="bookmark">Howto: Run VMWare on a Physical Windows Partition</a></li>
<li><a href="http://www.g-loaded.eu/2009/01/22/effective-data-wiping-with-a-single-complete-overwrite/" rel="bookmark">Effective data wiping with a single complete overwrite</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/06/partition-images-with-partimage-and-partimaged/" rel="bookmark">Partition images with Partimage and Partimaged</a></li>
<li><a href="http://www.g-loaded.eu/2007/07/25/hard-disk-upgrade-on-an-old-motherboard/" rel="bookmark">Hard disk upgrade on an old motherboard</a></li>
<li><a href="http://www.g-loaded.eu/2009/04/10/windows-7-opensolaris-put-to-the-test/" rel="bookmark">Windows 7, OpenSolaris &#8211; put to the test</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2010/03/29/partition-misalignment-slows-4096-byte-sector-hard-drives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Issues with the feeds are now resolved</title>
		<link>http://www.g-loaded.eu/2010/03/28/issues-with-the-feeds-are-now-resolved/</link>
		<comments>http://www.g-loaded.eu/2010/03/28/issues-with-the-feeds-are-now-resolved/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 06:06:46 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Snippet]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1634</guid>
		<description><![CDATA[This is just a quick notice that during the last five days there was a problem with the website feeds. The web server returned a 500 Internal Server Error to almost all requests for /feed/ URLs. Also, there was a big increase of the server&#8217;s CPU load behind the scenes, which was caused by php-cgi [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick notice that during the last five days there was a problem with the website feeds. The web server returned a <em>500 Internal Server Error</em> to almost all requests for <code>/feed/</code> URLs. Also, there was a big increase of the server&#8217;s <strong>CPU load</strong> behind the scenes, which was caused by <em>php-cgi</em> processes. It turned out that a custom plugin (unpublished) I had written for WordPress in the past was the cause of all the trouble, but, before coming to that conclusion, the fact that the problems had started without me doing anything on the blog during the last weeks together with a series of other random observations led me do a thorough examination of the whole server just in case.<br />
<span id="more-1634"></span><br />
So, after spending two days in front of a Linux terminal, I came to the conclusion that the following code had been problematic from the beginning and it was like a time-bomb for which the time had come to cause issues to the web site and the server that hosted it.</p>
<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> rsse_add_related_posts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$PostBody</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>rsse_verify_feed<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">return</span> <span style="color: #000088;">$PostBody</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'yarpp_related'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$PostBody</span> <span style="color: #339933;">.=</span> yarpp_related<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'rss'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$PostBody</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rsse_add_related_posts'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">252</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>
<p>This code used a function of another plugin to attach a &#8216;<em>related posts</em>&#8216; section at the end of the full content of each feed entry. As soon as I commented out the above filter and started attaching the related-posts section to the feed content through the <a href="http://mitcho.com/code/yarpp/">YARPP</a> plugin&#8217;s administration interface, everything was normal again. No more php-cgi processes timing-out or over-consuming the CPU cycles.</p>
<p>The following graph shows clearly the problematic period:</p>
<div id="attachment_1639" class="wp-caption aligncenter" style="width: 650px"><a href="http://www.g-loaded.eu/wp-content/uploads/phpcgi-cpu-time.png"><img src="http://www.g-loaded.eu/wp-content/uploads/phpcgi-cpu-time.png" alt="php-cgi processes consuming the CPU" title="phpcgi-cpu-time" width="640" class="size-full wp-image-1639" /></a><p class="wp-caption-text">php-cgi processes consuming the CPU</p></div>
<p>The httpd error_log included many errors like the following:</p>
<pre class="codesnp">
[...]
Allowed memory size of 33554432 bytes exhausted (tried to allocate 18893 bytes)
[...]
mod_fcgid: process ... exit(communication error), terminated by calling exit(), return code: 1
[...]
[warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[...]
[warn] mod_fcgid: stderr: PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 4864 bytes)
[...]
Premature end of script headers: index.php
[...]
</pre>
<p>Note that these errors might appear in several occasions.</p>
<p>In my case, finding that faulty piece of code was a huge relief, I can tell you.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2010/03/28/issues-with-the-feeds-are-now-resolved/">Issues with the feeds are now resolved</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/01/12/wordpress-206-feed-issues-resolved/" rel="bookmark">WordPress 2.0.6 &#8211; Feed Issues Resolved</a></li>
<li><a href="http://www.g-loaded.eu/2009/11/19/g-loaded-feeds/" rel="bookmark">G-Loaded Feeds</a></li>
<li><a href="http://www.g-loaded.eu/2009/10/08/redmine-deployment-delayed/" rel="bookmark">Redmine deployment delayed</a></li>
<li><a href="http://www.g-loaded.eu/2007/07/12/issue-addressed-author-feeds-deliver-full-content/" rel="bookmark">Issue addressed: Author feeds deliver full content</a></li>
<li><a href="http://www.g-loaded.eu/2008/10/17/status-of-content-availability-via-feeds/" rel="bookmark">Status of content availability via feeds</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2010/03/28/issues-with-the-feeds-are-now-resolved/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Using setenforce to switch SELinux mode wisely</title>
		<link>http://www.g-loaded.eu/2009/10/30/selinux-setenforce-mode/</link>
		<comments>http://www.g-loaded.eu/2009/10/30/selinux-setenforce-mode/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 15:05:14 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SELinux]]></category>
		<category><![CDATA[System]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1401</guid>
		<description><![CDATA[setenforce is a command line utility that is used to switch the mode SELinux is running in from enforcing to permissive and vice versa without requiring a reboot. Lately, I&#8217;ve started experimenting again with SELinux on a live system. The default targeted SELinux policy, as usual, needs some adjustment to work with a custom server [...]]]></description>
			<content:encoded><![CDATA[<p><strong>setenforce</strong> is a command line utility that is used to switch the mode <a href="http://en.wikipedia.org/wiki/Security-Enhanced_Linux">SELinux</a> is running in from <em>enforcing</em> to <em>permissive</em> and vice versa without requiring a reboot. Lately, I&#8217;ve started experimenting again with <strong>SELinux</strong> on a live system. The default targeted SELinux policy, as usual, needs some adjustment to work with a custom server configuration. So, I created some custom policy modules and loaded them onto the live system in order to test if my &#8220;<em>allow</em>&#8221; rules were effective.<br />
<span id="more-1401"></span><br />
In such cases, the system administrator must be wise enough to minimize risk. SELinux is not a forgiving feature. If the custom policy blocks the execution of a software and SELinux is running in enforcing mode, then the software does not run. That&#8217;s what SELinux is about after all.</p>
<p>The <strong>permissive mode</strong> exists mainly for testing. In this mode, the auditing mechanism generates notices (<em>AVC Denials</em>) about the action/event that was blocked, but without actually blocking that action/event. It is just a way to check what would have happened if SELinux had been running in <em>enforcing</em> mode. There are two ways to switch SELinux to permissive mode. One is to configure it through its configuration file (<code>/etc/selinux/config</code> on <abbr title="Enterprise Linux">EL</abbr>) to start in permissive mode on boot and the other is to use the aforementioned utility, <em>setenforce</em>, to switch modes while the system is live.</p>
<p>When performing tests on a live system, I usually take all precautions to minimize the risk of failure and usually, if possible, I am around to monitor the progress of the test. But, this time I had to use the custom SELinux policy for some days to see if it is actually effective or it needs further fine-tuning.</p>
<p><strong>The Mistake</strong>: I used setenforce to set SELinux into permissive mode (<code>/usr/sbin/setenforce 0</code>). setenforce is for <strong>temporary changes</strong> and it is definitely not suitable for testing the policy for a long period of time. This is because if for any reason the system reboots, SELinux will be set back into the mode that is defined into its configuration file. The mode set by <code>setenforce</code> does not survive a reboot. So, if the custom policy happens to be incomplete, it will block the server&#8217;s normal operation after the reboot. And such reboots can happen&#8230;</p>
<p>This is exactly what I experienced yesterday. The datacenter on which my virtual server is hosted had problems with its main power supply. This caused one hour of downtime. But G-Loaded&#8217;s outage was a lot greater, because my custom SELinux policy was incomplete. SELinux was started in enforcing mode, so my faulty policy blocked my www service.</p>
<p>This should be a lesson to anyone who performs tests on live systems. The Right Thing&trade; was simple: boot the server into permissive mode and do as many tests as desired. I can blame the datacenter for the one-hour downtime, but for the 7-hour unavailability of <a href="http://www.g-loaded.eu">G-Loaded</a> I am the only one to blame.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2009/10/30/selinux-setenforce-mode/">Using setenforce to switch SELinux mode wisely</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2006/12/20/selinux-audit-reports-script/" rel="bookmark">SELinux audit reports script</a></li>
<li><a href="http://www.g-loaded.eu/2008/11/26/using-a-switch-to-prevent-system-shutdownrebootsuspend/" rel="bookmark">Using a switch to prevent system shutdown/reboot/suspend</a></li>
<li><a href="http://www.g-loaded.eu/2007/02/09/server-upgraded-to-fedora-6/" rel="bookmark">Server upgraded to Fedora 6</a></li>
<li><a href="http://www.g-loaded.eu/2008/06/18/use-the-alternatives-system-to-switch-to-a-custom-firefox-release/" rel="bookmark">Use the Alternatives System to switch to a custom Firefox release</a></li>
<li><a href="http://www.g-loaded.eu/2006/09/25/how-to-integrate-seaudit-report-in-logwatch/" rel="bookmark">How to integrate seaudit-report in logwatch</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2009/10/30/selinux-setenforce-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>How to change the Timezone</title>
		<link>http://www.g-loaded.eu/2009/10/07/how-to-change-the-timezone/</link>
		<comments>http://www.g-loaded.eu/2009/10/07/how-to-change-the-timezone/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 13:44:03 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Scientific Linux]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Service]]></category>
		<category><![CDATA[System]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1183</guid>
		<description><![CDATA[Usually, the only time I make a change to the timezone setting of the operating system is during the installation time. But it may happen that a change to that setting is necessary. There are several ways to do this, but, as usual, there is only one Right Way&#8482; to set the timezone info in [...]]]></description>
			<content:encoded><![CDATA[<p>Usually, the only time I make a change to the <strong>timezone</strong> setting of the operating system is during the installation time. But it may happen that a change to that setting is necessary. There are several ways to do this, but, as usual, there is only one <em>Right Way</em>&trade; to set the timezone info in your <strong>Linux</strong> distribution. I investigated it for a while and I think I have figured out how to do it right using <strong>command-line</strong> utilities on <a href="http://fedoraproject.org">Fedora</a> and all RHEL rebuilds (<a href="http://centos.org">CentOS</a>, <a href="http://www.scientificlinux.org/">Scientific Linux</a>, etc). I am quite certain that many people miss this piece of information, so I describe it in detail right below.<br />
<span id="more-1183"></span></p>
<h4>Configuration</h4>
<p>The procedure must be performed by <strong>root</strong>.</p>
<p>First of all, you need to edit the <em>/etc/sysconfig/clock</em> file:</p>
<pre class="codesnp">
ZONE="Etc/GMT"
UTC=true
</pre>
<p>Please, read the notes below for more information about the settings above.</p>
<p>Then run the <strong>tzdata-update</strong> utility. This copies the correct zonefile to <em>/etc/localtime</em>:</p>
<pre class="console">
/usr/sbin/tzdata-update
</pre>
<p>Finally, update the system time by either running <strong>ntpd</strong> or the <strong>ntpdate</strong> utility. Both are part of the <code>ntp</code> RPM package, so if this is not installed, just use &#8220;<code>yum install ntp</code>&#8221; to get it installed.</p>
<pre class="console">
/usr/sbin/ntpdate -b pool.ntp.org
</pre>
<p>This will make sure your time is correct.</p>
<p>You can set a <strong>cronjob</strong> to update the system&#8217;s time using ntpdate, like this:</p>
<pre class="codesnp">
#
# Update the system time
#
55 23 * * * root /usr/sbin/ntpdate -4 -b pool.ntp.org 2>&#038;1 >> /var/log/ntpdate.log
</pre>
<h4>Notes</h4>
<p>Here are some notes about the configuration of the timezone:</p>
<ol>
<li>You can find the valid timezones by changing to the <code>/usr/share/zoneinfo/</code> directory. From there, any <em>relative path</em> to a timezone file is a valid timezone. For example, &#8220;<em>Etc/GMT</em>&#8220;, &#8220;<em>Europe/Athens</em>&#8220;, &#8220;<em>America/New_York</em>&#8221; et cetera.</li>
<li><strong>GMT</strong> and <strong>UTC</strong> time are practically the same and they both refer to the <a href="http://en.wikipedia.org/wiki/Greenwich_Mean_Time">Greenwich Mean Time</a>, so setting the timezone to &#8220;<em>Etc/UTC</em>&#8221; or &#8220;<em>Etc/GMT</em>&#8221; is practically the same.</li>
<li>In <code>/etc/sysconfig/clock</code> you can set whether the <strong>hardware clock</strong> is set to <strong>UTC/GMT</strong> time or to <strong>Local Time</strong>. I am not sure in what way the hardware clock gets involved is the time of the Operating System. But, anyway, if you know how the hardware clock is configured, set this accordingly to true or false. Usually, if I set the OS to use GMT time, I also set this to true regardless of the actual hardware clock configuration. More info on this is still needed.</li>
<li>In <code>/etc/sysconfig/clock</code> you may see the options <strong>ARC=false</strong> and <strong>SRM=false</strong>. These change the way the &#8220;epoch&#8221; is assumed by the console on Alpha systems and have no effect if you do not use such a platform. Delete them or leave as is, unless you know you need to set one of them to true.</li>
<li>In order to set the correct timezone, you could just create a <strong>symlink</strong> at <code>/etc/localtime</code> pointing to the correct timezone file in <code>/usr/share/zoneinfo/</code>. Then again, this would render the system configuration file <code>/etc/sysconfig/clock</code> (and thus all other applications that use it) useless and ineffective, so this method is generally <strong>not recommended</strong>.</li>
</ol>
<h4>Final thoughts</h4>
<p>Setting your server to use the correct time is very important. Generally, I hate it when I see web sites or other services having incorrect time. This reveals the web server or the web application administrator&#8217;s laziness or inability to properly configure the time. I hope this guide will help get rid of this issue.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2009/10/07/how-to-change-the-timezone/">How to change the Timezone</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2008/11/27/maxminds-geoip-dat-gz-location-change/" rel="bookmark">Maxmind&#8217;s GeoIP.dat.gz location change</a></li>
<li><a href="http://www.g-loaded.eu/2005/09/30/change-console-font-in-fedora/" rel="bookmark">Change console font in Fedora</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/05/assign-virtual-ips-to-your-nic/" rel="bookmark">Assign Virtual IPs to your NIC</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/12/how-to-disable-ipv6-in-fedora-and-centos/" rel="bookmark">How to Disable IPv6 in Fedora and CentOS</a></li>
<li><a href="http://www.g-loaded.eu/2010/11/01/change-expiration-date-gpg-key/" rel="bookmark">How to change the expiration date of a GPG key</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2009/10/07/how-to-change-the-timezone/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Skype, Last.fm client work again</title>
		<link>http://www.g-loaded.eu/2009/03/28/skype-lastfm-client-work-again/</link>
		<comments>http://www.g-loaded.eu/2009/03/28/skype-lastfm-client-work-again/#comments</comments>
		<pubDate>Sat, 28 Mar 2009 17:37:26 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Updates]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=982</guid>
		<description><![CDATA[During the last week two applications I use quite often, Skype and the official Last.fm client, had stopped working. The error message that was displayed the first time any of these programs was launched during the login session indicated that there was a problem with the imsettings-applet. This has been a bit frustrating as I [...]]]></description>
			<content:encoded><![CDATA[<p>During the last week two applications I use quite often, <a href="http://skype.com">Skype</a> and the <strike>official Last.fm client</strike>, had stopped working. The error message that was displayed the first time any of these programs was launched during the login session indicated that there was a problem with the <code>imsettings-applet</code>. This has been a bit frustrating as <strike>I use Last.fm as my main source for music</strike> and Skype for communicating with friends and relatives. I am not aware of any other skype compatible software phones <strike>or any good alternative last.fm clients</strike>. Today, I upgraded my system and everything has returned back to normal. Checking <code>yum.log</code> I noticed that <code>imsettings-libs</code> has been updated. Here is part of the changelog:</p>
<p><strong>UPDATE</strong>: I just read the news about lastfm&#8217;s new policy after March 30. It is a pity. I joined about a month ago and also subscribed without actually enjoying any of the features. It&#8217;s not about the money. 3 EUR per month is not a lot of money for such a service. It&#8217;s the different treatment of their customers I cannot accept. So long lastfm.</p>
<p><span id="more-982"></span></p>
<pre class="console">
[gnot@galeon ~]$ rpm -q --changelog imsettings-libs
* Wed Mar 18 2009 Akira TAGOH <tagoh@redhat.com> - 0.105.1-4
- Fix a dead key not working. (#483840)
- Get rid of more debugging messages. (#484142)
- Disable imsettings-xim in xinput.sh. (#485595)
- Fix a parser error on reading Compose data.
- Fix a double-free issue.
- Workaround to get the accelerator keys working again.
  Note that this workaround might affects to the performance. you may want
  to disable this with:
  gconftool-2 -t bool -s /apps/imsettings-applet/sync_on_forward false
  (#488675)
- Fix getting-stuck-issue on keyevent. (#488976, #489611)
</pre>
<p>I am not quite sure which one fixed the aforementioned issue, but I am really glad things work again normally.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2009/03/28/skype-lastfm-client-work-again/">Skype, Last.fm client work again</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2006/12/18/the-hole-trick/" rel="bookmark">The hole trick</a></li>
<li><a href="http://www.g-loaded.eu/2008/11/26/using-a-switch-to-prevent-system-shutdownrebootsuspend/" rel="bookmark">Using a switch to prevent system shutdown/reboot/suspend</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2009/03/28/skype-lastfm-client-work-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Xen DomU using dynamic IP and hostname</title>
		<link>http://www.g-loaded.eu/2009/02/01/xen-domu-using-dynamic-ip-and-hostname/</link>
		<comments>http://www.g-loaded.eu/2009/02/01/xen-domu-using-dynamic-ip-and-hostname/#comments</comments>
		<pubDate>Sun, 01 Feb 2009 14:16:43 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[DHCP]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Xen]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=845</guid>
		<description><![CDATA[During the last months, I&#8217;ve been experimenting with Xen virtualization. An old computer, equipped with a Pentium III running at 700Mhz, 512MB of RAM and an 160GB IDE HDD runs four installations of my favorite Linux distribution, CentOS, one as a Dom0 and the other three as DomUs with 64MB of memory each. I remember [...]]]></description>
			<content:encoded><![CDATA[<p>During the last months, I&#8217;ve been experimenting with <a href="http://www.xen.org/">Xen</a> virtualization. An old computer, equipped with a <em>Pentium III</em> running at 700Mhz, 512MB of <em>RAM</em> and an 160GB <em>IDE</em> HDD runs <strong>four</strong> installations of my <em>favorite</em> Linux distribution, <a href="http://centos.org/">CentOS</a>, one as a <a href="http://wiki.xensource.com/xenwiki/Dom0">Dom0</a> and the other three as <a href="http://wiki.xensource.com/xenwiki/DomU">DomU</a>s with 64MB of memory each.<br />
<span id="more-845"></span><br />
I remember that one of the first things I needed to test was whether all those virtual machines could properly use my <strong>DHCP</strong> service, located on a separate machine within my <strong>LAN</strong>, and get a <em>dynamic IP</em>. Furthermore, each time <strong>dhclient</strong> ran on the Dom0 or any of the DomUs in order to obtain a dynamic IP address, it also sent a name (non <em>FQDN</em>) to the DHCP service. This name represented the name the machine wished to use as a <strong>hostname</strong>. The DHCP server should generate an <em>FQDN</em> out of that name and update the <em>forward</em> and <em>reverse zones</em> on the <strong>DNS</strong> server, so that each virtual machine&#8217;s <em>FQDN</em> name could properly resolve to the relevant IP address, which had been allocated to the <abbr title="Virtual Machine">VM</abbr> by the <em>DHCP</em> service. All this had already been set up in my home LAN since a long time ago, but had never actually tested it with multiple computers or other devices and virtualization definitely provided me with this option.</p>
<p>While I was performing the operating system installations, everything seemed to work as expected. Each virtual machine obtained a <strong>dynamic IP</strong> address and the <strong>DNS records</strong> were updated correctly. Glad that things work, I turned off Dom0 after the tests.</p>
<p>At a later time, when I switched <em>Dom0</em> on again, I noticed that I <strong>could not reach any of the virtual machines</strong>. Their fully qualified domain names that had been allocated to them by the DHCP service would not resolve to the proper IP. To make it worse, it seemed that the virtual machines had no active leases at all!</p>
<p>Soon I discovered that <strong>xendomains</strong>, the service responsible for starting and stopping the unprivileged Xen domains (DomU), whenever Domain Zero was shut down, it just <strong>saved</strong> the domain U&#8217;s state for later restoration instead of initiating the DomU&#8217;s shutdown procedure. When Dom0 was brought up again, <em>xendomains</em> <strong>restored</strong> the saved DomU states instead of forcing the domains to boot up normally.</p>
<p>I assume this is like suspending a laptop, which has obtained its IP automatically from a DHCP service within LAN A, moving it to a LAN B, and then bringing it up again within that LAN. It is almost certain that for an arbitrary amount of time you would experience connectivity problems.</p>
<p>In both cases above, at the time the machine resumes operations, the <strong>dhclient</strong> script (or any other similar script) is not run in order to <em>renew</em> the machine&#8217;s IP address.</p>
<p>Fortunately, this behaviour of the <code>xendomains</code> service is configurable. In order to force all DomUs to shutdown, instead of suspending, during Domain 0&#8242;s shutdown, all you have to do is make following changes in <code>/etc/sysconfig/xendomains</code>:</p>
<p>Leave empty the XENDOMAINS_SAVE variable. By default, it uses /var/lib/xen/save as the directory where the states of the DomUs are saved. By leaving it empty, the states of the virtual machines are not saved, but they are shut down as usual.</p>
<pre class="codesnp">
XENDOMAINS_SAVE=""
</pre>
<p>The second modification involves setting the XENDOMAINS_RESTORE variable to false. This determines whether saved domains will be restored from the directory set in the XENDOMAINS_SAVE variable during the Dom0 startup:</p>
<pre class="codesnp">
XENDOMAINS_RESTORE=false
</pre>
<p>From now on, whenever Dom0 starts up, it will force all U domains to boot up normally. Contrariwise, whenever Dom0 shuts down, it will force all DomU to shut down as well. No domain state saving or restoration happens any more.</p>
<p>This means that the network service on each DomU, hence the <em>dhclient</em> script, will run <strong>every time</strong> the domain U starts up or shuts down, <strong>ensuring proper allocation of dynamic IP addresses and hostnames</strong> by the DHCP service. Of course, this adds much overhead to both the boot and power off process of Domain Zero (Dom0), but it seems that there is no other way to overcome this problem. If you know of a better way, please let me know.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2009/02/01/xen-domu-using-dynamic-ip-and-hostname/">Xen DomU using dynamic IP and hostname</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2006/12/19/howto-dhcp-server-dhcpd-configuration/" rel="bookmark">Howto: DHCP Server (dhcpd) Configuration</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/05/assign-virtual-ips-to-your-nic/" rel="bookmark">Assign Virtual IPs to your NIC</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/" rel="bookmark">Set up the VNC Server in Fedora</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/06/partition-images-with-partimage-and-partimaged/" rel="bookmark">Partition images with Partimage and Partimaged</a></li>
<li><a href="http://www.g-loaded.eu/2008/12/10/almost-saying-goodbye-to-innovation/" rel="bookmark">Almost saying goodbye to innovation</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2009/02/01/xen-domu-using-dynamic-ip-and-hostname/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Always use a block device label or its UUID in fstab</title>
		<link>http://www.g-loaded.eu/2009/01/04/always-use-a-block-device-label-or-its-uuid-in-fstab/</link>
		<comments>http://www.g-loaded.eu/2009/01/04/always-use-a-block-device-label-or-its-uuid-in-fstab/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 15:41:27 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Filesystem]]></category>
		<category><![CDATA[System]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=839</guid>
		<description><![CDATA[If there are still references to device nodes for block devices, as they are set by the kernel, for example /dev/hda, in /etc/fstab, you should seriously consider replacing them with the volume&#8217;s label or its UUID. Even if you use an LVM setup, the /boot partition shouldn&#8217;t be referenced by its device node. My server [...]]]></description>
			<content:encoded><![CDATA[<p>If there are still references to device nodes for <strong>block devices</strong>, as they are set by the kernel, for example <code>/dev/hda</code>, in <code>/etc/fstab</code>, you should seriously consider replacing them with the volume&#8217;s <strong>label</strong> or its <strong>UUID</strong>. Even if you use an <strong>LVM</strong> setup, the <code>/boot</code> partition shouldn&#8217;t be referenced by its device node.<br />
<span id="more-839"></span><br />
My server boots from a 32MB <em>Compact Flash</em> card, attached to <em>CF-to-IDE</em> converter. The card contains only the boot manager (GRUB) in its Master Boot Record (MBR). The system&#8217;s main hard disk is attached to a PCI ATA 133 <em>controller</em>. This particular setup is necessary because the old motherboard cannot boot directly from hard disks connected to the PCI-based IDE controller. Until Fedora 9, the CF card was recognized as hdb/sdb and the hard disk on the PCI controller as hda/sda. Today, I upgraded the server to Fedora 10. The CF card is now recognised as /dev/sda. You can imagine my surprise when I rebooted the machine after having upgraded the system only to realize that it actually tried to find the /boot partition on the CF card instead of the main hard disk.</p>
<p>To be able to correct things I had to boot using a Fedora 9 kernel in order to make any changes to the files and get rid of this issue. What was needed was to stop using device names in fstab, but use UUIDs instead. To <strong>get the UUID</strong> for a particular <strong>block device</strong>, for example <strong>/dev/sda1</strong>, I ran as root:</p>
<pre class="console">
# blkid /dev/sda1
/dev/sda1: LABEL="/boot" UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" TYPE="ext3"
</pre>
<p>Now <strong>replace</strong> the device node name in <strong>/etc/fstab</strong> to read:</p>
<pre class="codesnp">
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx    /boot    ext3    defaults    1 2
</pre>
<p>Of course, I could have used the label of that partition, but I guess UUIDs are more unique and therefore preferred.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2009/01/04/always-use-a-block-device-label-or-its-uuid-in-fstab/">Always use a block device label or its UUID in fstab</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2005/09/19/a-different-approach-hal/" rel="bookmark">A different approach&#8230;HAL</a></li>
<li><a href="http://www.g-loaded.eu/2007/07/25/hard-disk-upgrade-on-an-old-motherboard/" rel="bookmark">Hard disk upgrade on an old motherboard</a></li>
<li><a href="http://www.g-loaded.eu/2005/09/18/udev/" rel="bookmark">UDEV</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/encrypt-devices-using-dm-crypt-and-luks/" rel="bookmark">Encrypt devices using dm-crypt and LUKS</a></li>
<li><a href="http://www.g-loaded.eu/2007/09/15/clonezilla-instead-of-partimage/" rel="bookmark">CloneZilla instead of Partimage</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2009/01/04/always-use-a-block-device-label-or-its-uuid-in-fstab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Using a switch to prevent system shutdown/reboot/suspend</title>
		<link>http://www.g-loaded.eu/2008/11/26/using-a-switch-to-prevent-system-shutdownrebootsuspend/</link>
		<comments>http://www.g-loaded.eu/2008/11/26/using-a-switch-to-prevent-system-shutdownrebootsuspend/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 21:36:30 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Snippet]]></category>
		<category><![CDATA[System]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=658</guid>
		<description><![CDATA[What I tried to accomplish today was to prevent a system shutdown or reboot or suspend, if a specific process was still running in the background. This might sound pretty useless, but having shut my PC down once again this afternoon while the backup process was still active in the background, I decided to resolve [...]]]></description>
			<content:encoded><![CDATA[<p>What I tried to accomplish today was to <em>prevent</em> a system <strong>shutdown</strong> or <strong>reboot</strong> or <strong>suspend</strong>, if a specific process was still running in the background. This might sound pretty useless, but having shut my PC down once again this afternoon while the backup process was still active in the background, I decided to resolve this issue for good. But things are not that easy as they might seem&#8230; After many hours of digging into the operating system&#8217;s <strong>initscripts</strong>, <strong>upstart events</strong> and the methods used by GNOME to perform a shutdown/reboot/suspend, I am still away from a decent solution that will, not only work when directly invoking the relevant commands from the <strong>console</strong>, but also when I perform the aforementioned actions from the <strong>GNOME shutdown applet</strong>. Here is what I&#8217;ve tried so far&#8230;<br />
<span id="more-658"></span><br />
First of all, having failed with all the initscript or upstart event modifications I&#8217;ve tried, I decided to completely override the relevant commands, for instance <code>/sbin/shutdown</code>, by placing a wrapper script with the same name in <code>/usr/local/sbin/</code>. Here is such a wrapper script for the shutdown command, saved as <code>/usr/local/sbin/shutdown</code>:</p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#! /bin/sh</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lock<span style="color: #000000; font-weight: bold;">/</span>noshutdown.lock <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
  logger <span style="color: #660033;">-t</span> shutdowndog shutdown prevented
  <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>shutdown <span style="color: #ff0000;">&quot;$@&quot;</span></pre></div></div>
<p>Then, I created the file that would act as a <strong>switch</strong>:</p>
<pre class="console">
touch /var/lock/noshutdown.lock
</pre>
<p>Then, I initiated the <strong>shutdown procedure</strong> from the command line:</p>
<pre class="console">
shutdown -h +0
</pre>
<p>There was no shutdown! It had worked!</p>
<p>Syslog confirmed that the check had taken place:</p>
<pre class="codesnp">
Nov 25 19:19:04 galeon shutdowndog: shutdown prevented
</pre>
<p>I rushed to try to shut down the system from GNOME&#8217;s shutdonw panel (<code>Menu System -> Shut Down...</code>), but, after pressing the relevant button, the system went down normally&#8230;</p>
<p>It was obvious that GNOME had not used my override, but another mechanism to power-off the system instead. Since I use the GNOME menu to shutdown/reboot/suspend the system, I spent a couple of hours trying to find what was going on in GNOME and finally discovered the file <code>/usr/bin/gnome-power-cmd.sh</code>:</p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;"># Copyright (C) 2007 Richard Hughes &lt;richard@hughsie.com&gt;</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Licensed under the GNU General Public License Version 2</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># This program is free software; you can redistribute it and/or modify</span>
<span style="color: #666666; font-style: italic;"># it under the terms of the GNU General Public License as published by</span>
<span style="color: #666666; font-style: italic;"># the Free Software Foundation; either version 2 of the License, or</span>
<span style="color: #666666; font-style: italic;"># (at your option) any later version.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># This program is distributed in the hope that it will be useful,</span>
<span style="color: #666666; font-style: italic;"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span style="color: #666666; font-style: italic;"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<span style="color: #666666; font-style: italic;"># GNU General Public License for more details.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#$1 = method name</span>
execute_dbus_method <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
        dbus-send <span style="color: #660033;">--session</span> <span style="color: #660033;">--dest</span>=org.freedesktop.PowerManagement              \
                  <span style="color: #660033;">--type</span>=method_call <span style="color: #660033;">--print-reply</span> <span style="color: #660033;">--reply-timeout</span>=<span style="color: #000000;">2000</span> \
                  <span style="color: #000000; font-weight: bold;">/</span>org<span style="color: #000000; font-weight: bold;">/</span>freedesktop<span style="color: #000000; font-weight: bold;">/</span>PowerManagement                      \
                  org.freedesktop.PowerManagement.<span style="color: #007800;">$1</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
                <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Failed&quot;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> = <span style="color: #ff0000;">&quot;suspend&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Suspending&quot;</span>
        execute_dbus_method <span style="color: #ff0000;">&quot;Suspend&quot;</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> = <span style="color: #ff0000;">&quot;hibernate&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Hibernating&quot;</span>
        execute_dbus_method <span style="color: #ff0000;">&quot;Hibernate&quot;</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> = <span style="color: #ff0000;">&quot;reboot&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Rebooting&quot;</span>
        execute_dbus_method <span style="color: #ff0000;">&quot;Reboot&quot;</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> = <span style="color: #ff0000;">&quot;shutdown&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Shutting down&quot;</span>
        execute_dbus_method <span style="color: #ff0000;">&quot;Shutdown&quot;</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> = <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;command required: suspend, shutdown, hibernate or reboot&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;command '$1' not recognised, only suspend, shutdown, hibernate or reboot are valid&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>
<p>So, GNOME makes the appropriate calls for power-related events through <strong>D-bus</strong>. I initially thought that GNOME used <code>/usr/bin/gnome-power-cmd.sh</code> whenever the shutdown/reboot/suspend button was pressed, so I modified it so to check for my switch (<code>/var/lock/noshutdown.lock</code>) and then proceed accordingly. It did not work out&#8230;</p>
<p>I had already spent much time on this, so I decided to quit. But, it is crucial for me to make this thing work and I will probably investigate it a bit more and report back at some later time.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2008/11/26/using-a-switch-to-prevent-system-shutdownrebootsuspend/">Using a switch to prevent system shutdown/reboot/suspend</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2008/11/28/delayed-shutdown-initscript/" rel="bookmark">delayed-shutdown initscript</a></li>
<li><a href="http://www.g-loaded.eu/2009/10/30/selinux-setenforce-mode/" rel="bookmark">Using setenforce to switch SELinux mode wisely</a></li>
<li><a href="http://www.g-loaded.eu/2008/06/18/use-the-alternatives-system-to-switch-to-a-custom-firefox-release/" rel="bookmark">Use the Alternatives System to switch to a custom Firefox release</a></li>
<li><a href="http://www.g-loaded.eu/2007/10/18/dictionary-lookups-anywhere/" rel="bookmark">Dictionary Lookups Anywhere</a></li>
<li><a href="http://www.g-loaded.eu/2008/12/08/access-gvfs-mounts-from-the-command-line/" rel="bookmark">Access gvfs mounts from the command line</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2008/11/26/using-a-switch-to-prevent-system-shutdownrebootsuspend/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Email Notifications from a Linux System</title>
		<link>http://www.g-loaded.eu/2007/12/07/email-notifications-from-a-linux-system/</link>
		<comments>http://www.g-loaded.eu/2007/12/07/email-notifications-from-a-linux-system/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 15:07:20 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Notifications]]></category>
		<category><![CDATA[System]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2007/12/07/email-notifications-from-a-linux-system/</guid>
		<description><![CDATA[This post is not an article about how to receive email notifications from your system, but rather a tip about what should be your very first (No.1) action after a clean installation of a Linux system. It is well known that Linux &#8211; and obviously many other *nix systems, if not all &#8211; are pre-configured [...]]]></description>
			<content:encoded><![CDATA[<p>This post is <strong>not</strong> an article about <em>how to receive email notifications from your system</em>, but rather a <strong>tip</strong> about <em>what should be your very first (No.1) action after a clean installation of a Linux system</em>. It is well known that Linux &#8211; and obviously many other *nix systems, if not all &#8211; are pre-configured to send <strong>email notifications</strong> about various system events. That is <em>errors</em> by default, but if you have installed any log analysis and reporting software, like <a href="http://www2.logwatch.org:81/">logwatch</a> or <a href="http://linux.duke.edu/projects/epylog/">epylog</a> (and others), those notifications might include lengthy <em>security reports</em> or reports about <em>resource usage analysis</em> as well. By default, the recipient of all those messages is <code>root@localhost</code>, as it should be. But, since the <em>root</em> account is not for everyday use, it is one the best practices to <strong>redirect</strong> all root&#8217;s email messages to your everyday user&#8217;s mailbox.<br />
<span id="more-469"></span><br />
Recently, I had cleanly installed Fedora 7 on one of my desktop systems and upgraded to Fedora 8 after a few weeks. The last time I had performed a clean installation must have been 2-2.5 years ago, so I forgot to set the email redirection, but I was almost certain that I had done it, so I never checked. The worst thing is that, during my <a href="http://www.g-loaded.eu/2007/11/18/problems-using-libnotify-for-user-to-user-notifications/">libnotify notification tests</a>, I had set some cronjobs to run <em>every minute</em>. The commands that cron was set to run produced an error and normally the system emailed the output to <em>root</em> after each cron-run. Since I was certain that the email redirection had been set, I never checked root&#8217;s mailbox. The result was 19000+ unread messages inside root&#8217;s <em>mbox file</em> and <em>email spool</em>.</p>
<p>So, since email notifications are preconfigured, the first thing to do after a clean Linux system installation is to set the email redirection. This can be done with the following:</p>
<pre class="console">
# echo "root:   youruser" >> /etc/aliases
# newaliases
</pre>
<p>If it happens that you find root&#8217;s or any other user&#8217;s mailbox with tons of email notifications from your system, you can delete them by entering the console mail client &#8220;<em>mail</em>&#8220;:</p>
<pre class="console">
# mail
</pre>
<p>&#8230;and enter the following command at its prompt:</p>
<pre class="console">
&#038; delete *
</pre>
<p>I guess there are many desktop users out there with their root account&#8217;s mailbox full of system notifications. At least, for desktop systems, there should a note about setting up the redirection of root&#8217;s email to your user&#8217;s mailbox.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2007/12/07/email-notifications-from-a-linux-system/">Email Notifications from a Linux System</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/11/18/problems-using-libnotify-for-user-to-user-notifications/" rel="bookmark">Problems using libnotify for User to User Notifications</a></li>
<li><a href="http://www.g-loaded.eu/2007/03/05/organizing-mailing-list-messages-with-evolution/" rel="bookmark">Organizing Mailing List messages with Evolution</a></li>
<li><a href="http://www.g-loaded.eu/2006/12/20/selinux-audit-reports-script/" rel="bookmark">SELinux audit reports script</a></li>
<li><a href="http://www.g-loaded.eu/2009/10/12/free-personal-email-certificates-program-discontinued-by-thawte/" rel="bookmark">Free Personal Email Certificates Program discontinued by Thawte</a></li>
<li><a href="http://www.g-loaded.eu/2007/06/23/high-traffic-on-the-email-server/" rel="bookmark">High traffic on the email server</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2007/12/07/email-notifications-from-a-linux-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Howto: Run VMWare on a Physical Windows Partition</title>
		<link>http://www.g-loaded.eu/2007/11/05/howto-run-vmware-on-a-physical-windows-partition/</link>
		<comments>http://www.g-loaded.eu/2007/11/05/howto-run-vmware-on-a-physical-windows-partition/#comments</comments>
		<pubDate>Mon, 05 Nov 2007 06:31:17 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[System]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Virtualization]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2007/11/05/howto-run-vmware-on-a-physical-windows-partition/</guid>
		<description><![CDATA[Although I do not intend to run VMWare directly on a physical partition containing Windows any time soon, a recent discussion on a greek linux users group about the implications of such an experiment made me write a post about an article I stumbled upon today. The article author notes: VMWare is an incredibly useful [...]]]></description>
			<content:encoded><![CDATA[<p>Although I do not intend to run <a href="http://vmware.com/">VMWare</a> directly on a physical partition containing Windows any time soon, a recent discussion on a greek linux users group about the implications of such an experiment made me write a post about an article I stumbled upon today. The article author notes:</p>
<blockquote><p>
VMWare is an incredibly useful piece of software. Problem is, it feels like it&#8217;s perched on the tip of an eggshell. Any change to its environment tends to cause it to fall over, isolating all your data in the VM until you can find the time to get it working again. It&#8217;s not fun to trust important data to such a brittle environment.
</p></blockquote>
<p>Apart from the concern about the stability of the environment that hosts the guest operating system I can think of 1 or 2 more reasons why someone would want to run VMWare on a pre-existing installation of Windows on a physical volume. The first would be &#8220;<em>convenience</em>&#8221; and the other would be just &#8220;<em>fun</em>&#8220;.</p>
<p><a href="http://news.u32.net/articles/2006/07/18/running-vmware-on-a-physical-partition/">Read the entire article &raquo;</a></p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2007/11/05/howto-run-vmware-on-a-physical-windows-partition/">Howto: Run VMWare on a Physical Windows Partition</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2010/03/29/partition-misalignment-slows-4096-byte-sector-hard-drives/" rel="bookmark">Partition Misalignment Slows Down 4096-Byte Sector Hard Disks</a></li>
<li><a href="http://www.g-loaded.eu/2009/12/18/high-cpu-usage-centos-guest-virtualbox-vmware/" rel="bookmark">High CPU usage while running CentOS as guest on Virtualbox or VMware</a></li>
<li><a href="http://www.g-loaded.eu/2006/09/05/ldap-howto/" rel="bookmark">LDAP HOWTO</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/06/partition-images-with-partimage-and-partimaged/" rel="bookmark">Partition images with Partimage and Partimaged</a></li>
<li><a href="http://www.g-loaded.eu/2007/02/21/chroot-environment-howto/" rel="bookmark">chroot Environment Howto</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2007/11/05/howto-run-vmware-on-a-physical-windows-partition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
	</channel>
</rss>

