<?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>rdoxenham.com</title>
	<atom:link href="http://www.rdoxenham.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.rdoxenham.com</link>
	<description>Rhys Oxenhams&#039; Tech Blog</description>
	<lastBuildDate>Thu, 02 May 2013 23:55:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>OpenStack Summit 2013 Report</title>
		<link>http://www.rdoxenham.com/?p=325</link>
		<comments>http://www.rdoxenham.com/?p=325#comments</comments>
		<pubDate>Thu, 02 May 2013 23:45:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenStack]]></category>

		<guid isPermaLink="false">http://www.rdoxenham.com/?p=325</guid>
		<description><![CDATA[NOTE: The views expressed below are my own and do not, in any way, represent the views of my employer. The week before last I attended the OpenStack Summit in Portland, Oregon. It was a chance for me to get &#8230; <a href="http://www.rdoxenham.com/?p=325">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><strong>NOTE: </strong>The views expressed below are my own and do not, in any way, represent the views of my employer.</p>
<p>The week before last I attended the OpenStack Summit in Portland, Oregon. It was a chance for me to get the latest information about one of the most exciting open-source projects for the past few years. I&#8217;ve been involved with OpenStack for quite a few months now, mainly deploying environments and writing documentation to aid in my understanding as well as providing it out for others to consume; one of the problems with OpenStack is that it&#8217;s very difficult to get started. Whilst I knew that OpenStack had an enormous market-hype with the vast majority of ISVs and hardware vendors jumping on-board, nothing could prepare me for the overwhelming turnout at the summit; the event had actually sold-out, which for an Open Source conference is an achievement. The majority of the sessions were actually overflowing, if you didn&#8217;t turn up 20-30 minutes beforehand then you had little chance of getting somewhere to sit. It just goes to show the level of interest in this project, people from all over the world and of all career paths attended as they were either actively involved with OpenStack in some way or knew they had to learn more; the event had a very refreshing buzz about it, people wanted to be there, were passionate about the technology and could really see it going somewhere.</p>
<p>The conference, with the exception of the daily keynotes, was split up into multiple tracks, for the active contributors/developers they had the design summit, but for those of us that wanted to gain an insight into the latest and greatest we found ourselves sitting through presentations covering the widest variety of topics. They also provided hands-on workshops all week, something that I found extremely valuable- for example, as I&#8217;m not a networking guy I sometimes find myself confused over complex networking and the concept of virtual networks, the hands-on Quantum lab enabled me to gain a good understanding of it. Even beginners were catered for, there were 101 sessions most days allowing people with very little experience of virtualisation and cloud computing to come away with an understanding of the OpenStack project and where it is headed. As a Red Hat employee myself, putting faces to the names of the colleagues I work with daily was a great opportunity, especially given our recent OpenStack distribution announcement; RDO, our community-supported offering (<a href="http://openstack.redhat.com">http://openstack.redhat.com</a>). The ability to network with other OpenStack users (and potential future users) was extremely valuable, receiving feedback about what they wanted to use it for and what features they really wanted to see. In fact, when you look at the attendee list it goes to show the variety of attendees; it seemed to be a mix between the stereotypical LinuxCon attendees and VMworld attendees, a very dynamic environment.</p>
<p>The keynote sessions were extremely useful, the Rackspace keynote being the headline for many was, as expected, really good. The statistic which they keep using is that whilst they&#8217;re not reducing the amount of contributions they make, their overall commit percentage continues to decrease; clearly proving the success of the project in the open-source community. It was also good to see that Red Hat is out on top now with the latest Grizzly release and they&#8217;re not trying to keep that quiet! Rackspace is using OpenStack in production (no surprises there!) but the way in which they use it is very interesting, they deploy OpenStack on OpenStack for providing &#8220;private clouds&#8221; on-top of the public cloud, eating their own dog-food at every level. They&#8217;ve done this with an extremely high level of reliability and API uptime, so when people say that OpenStack isn&#8217;t ready for production, I really do beg to differ. Canonical&#8217;s keynote by Mark Shuttleworth was very good too, I think they&#8217;re at a set of crossroads, moving from the traditional &#8216;desktop environment&#8217; to a more strategic cloud play, I&#8217;m just not sure they&#8217;ve got the resources to actually fulfill what they try and say, despite the fact that OpenStack has been predominantly written to run on Ubuntu (historically, anyway). Aside from the OpenStack &#8220;vendors&#8221;, organisations such as Best Buy, Bloomberg, Comcast and others presented what they use OpenStack for, how they&#8217;ve implemented it at scale and what they&#8217;ve learned (and contributed back!), it further goes to show that there&#8217;s real interest in many different areas if the use case is right, i.e. scale out, fault tolerant applications.</p>
<p>What interests me is that OpenStack is clearly viewed by many as a threat, you take VMware for example; they are actively contributing to the project to enable their ESXi hypervisor as a compute resource for OpenStack Nova, they&#8217;re concerned that when people see the benefits of OpenStack and the fact that it abstracts much of the underlying compute resource, the requirement for ESX will drop. VMware are at risk of becoming irrelevant in the long term where applications are written in different ways, i.e. to be more fault tolerant and not requiring hypervisor-oriented technologies such as HA, they have to try and retain a piece of the pie and leverage the existing investments that organisations have made on their technology. In addition, the next-step of the virtualisation piece is virtual-networking; Quantum provides a virtual network abstraction service with multiple plugins for software and hardware based networking stacks. VMware is active in this space also, providing their Nicira-based NVP plugin for Quantum, this is an emerging technology and will likely be the later piece of the puzzle that gets adopted. VMware and Canonical have just gone to market with a fully-supported offering, this joint venture provides a complete OpenStack environment for customers currently using VMware. As VMware didn&#8217;t previously have an operating-system, Ubuntu is able to step in and plug this gap, a potentially strategic opportunity for both organisations.</p>
<p>It&#8217;s not just VMware either, the likes of HP, Dell, IBM are all jumping on the OpenStack bandwagon, all with sets of developers contributing upstream as well as to their own product offerings, seeing OpenStack as a way of making money. Many vendors are providing additional components that allow OpenStack to integrate directly into existing environments, bridging the gap between upstream vanilla OpenStack and the modern-day datacenter. The VMware/Canonical offering is too early to tell whether it will be a success or not, but in my opinion they are doing the right thing, I am a firm believer that any vendor looking to provide an OpenStack offering should be open about the partnerships they forge and the additional fringe components that they choose to support; because of the vast support model in the OpenStack trunk it will attract a wide variety of customers with a disprate set of requirements, picking and choosing technologies to support will be extremely important.</p>
<p>OpenStack has opened the doors to a wide variety of new-startups, all providing additional layers or extensions to help integrate and ease the adoption of the product into organisations. Examples of these include Mirantis and SwiftStack. Mirantis is a company based out of Russia, they, more than anyone, impressed me at the summit. They&#8217;ve written a tool called Fuel which aims to provide a ground-up management platform for OpenStack; currently to implement OpenStack requires quite a lot of time, knowledge and experience, Fuel is able to configure an array of the underlying bare-metal technologies including networking and storage as well as to provision and manage entire OpenStack environments from a web-interface. If I was in a position to acquire a company, Mirantis would be at the top of my list right now! SwiftStack provide management tools and support for deploying a Swift-based object-storage cloud, their presentations were fascinating and for anyone interested in how Swift works then they&#8217;ve written a free book (<a href="http://www.swiftstack.com/book/">http://www.swiftstack.com/book/</a>) which I highly recommend. The exhibition room was full of vendors promoting either their distributions, their consultancy/architecture services or their additional add-on components, very rare for an open-source project&#8230; even at LinuxCon it&#8217;s usually full of the normal open-source companies plus hardware guys, this represented a huge mix.</p>
<p>What last week made me realise is that there&#8217;s an enormous opportunity for OpenStack, a lot of the community work has been done for the vendors wishing to pursue an OpenStack strategy, some vendors being in better positions than others to make it a successful venture; integration with existing enterprise technology will be extremely important for vendors to get right. There&#8217;s a lot of overlap between the capabilities of some existing products in the industry, however OpenStack, in my opinion, is addressing the problem to the next-generation architectures. There are lots of offerings/flavours/distributions out there, the most important thing about OpenStack-based clouds is interoperability&#8230; they must continue to be open, i.e. open API&#8217;s, open standards to allow portability between clouds. Whilst I fear that some organisations (especially proprietary vendors) are getting involved in OpenStack because of the hype, it represents a turning point in the way that big corporations think- it&#8217;s yet again proving the power of Open Source and what can be achieved when we work together.</p>
<p>Long term, there are many areas in which we can improve OpenStack, there aren&#8217;t many organisations out there that are ready to implement an OpenStack environment unless they go greenfield with it; integration is key but the switch from traditional data centers to a fully software-defined environment is a big step to take and this step will take years to fully embrace. It doesn&#8217;t mean that traditional enterprise virtualisation will go away either, there will always be a requirement for legacy applications but the convergence of these technologies will be an intriguing concept to watch. Over time I think that OpenStack will become a lot more than just a set of tools to build cloud environments; we see this with the latest tool sets such as the Heat API and nova-baremetal, tools that are implementing features that have been traditionally excluded. It&#8217;s an exciting time to be involved with OpenStack, I look forward to seeing what the future can bring for the platform and making it a success.</p>
<p>As I attended about 10 sessions per day (usually 30-40 minutes each), I won&#8217;t comment on them all, but some personal favourites to recommend people look into if they&#8217;re interested in learning more about what&#8217;s coming up in OpenStack:</p>
<p>Orchestration of Fibre Channel in Cinder &#8211; The default out of the box block storage configuration in OpenStack is typically iSCSI, whilst there&#8217;s plenty of additional options now Fibre Channel support has taken quite some time to make it into the code. The problems are typically around zoning, as far as Nova is concerned this is almost irrelevant as all it has to do is attach the underlying disk to the instance in the same fashion as iSCSI. This technology brings OpenStack closer to enterprise adoption. (<a href="http://www.openstack.org/summit/portland-2013/session-videos/presentation/orchestration-of-fibre-channel-technologies-for-private-cloud-deployments">http://www.openstack.org/summit/portland-2013/session-videos/presentation/orchestration-of-fibre-channel-technologies-for-private-cloud-deployments</a>)</p>
<p>Ceilometer Metrics -&gt; Metering &#8211; So, Ceilometer is a new project within OpenStack, it was introduced in Folsom as an incubated project but has made it into Grizzly as a full component. It enables organisations to implement a flexible chargeback model on pretty much anything they want to plug it into. It vastly extends the very basic quotas and utilisation that Folsom used to provide. There are still some limitations but it&#8217;s extremely powerful. (<a href="http://www.openstack.org/summit/portland-2013/session-videos/presentation/ceilometer-from-metering-to-metrics">http://www.openstack.org/summit/portland-2013/session-videos/presentation/ceilometer-from-metering-to-metrics</a>)</p>
<p>OpenStack HA with Mirantis &#8211; This talk actually turned into a product demonstration/pitch, but it was the one I was most impressed by. This demonstrates Mirantis&#8217; Fuel implementation for managing OpenStack environments from bare-metal. Many organisations keep asking &#8220;how can we deploy OpenStack to scale?&#8221; or &#8220;How can we make OpenStack Highly Available?&#8221;. Mirantis attempts to solve the deployment and high availability problems with their tools and ammusingly they say it&#8217;s so easy, even a goat can do it! (<a href="http://www.openstack.org/summit/portland-2013/session-videos/presentation/standup-ha-openstack-with-open-puppet-manifests-in-under-20-minutes-for-goat">http://www.openstack.org/summit/portland-2013/session-videos/presentation/standup-ha-openstack-with-open-puppet-manifests-in-under-20-minutes-for-goat</a>)</p>
<p>Deploying and Managing OpenStack with Heat &#8211; This talk discusses how the &#8220;triple-o&#8221; or &#8220;OpenStack-on-OpenStack&#8221; project uses the Heat API (and nova-baremetal) to deploy entire OpenStack environments automatically, blurring the differences between the cloud layer and the physical world. (<a href="http://www.openstack.org/summit/portland-2013/session-videos/presentation/deploying-and-managing-openstack-with-heat">http://www.openstack.org/summit/portland-2013/session-videos/presentation/deploying-and-managing-openstack-with-heat</a>)</p>
<p>Software Defined Networking (Scaling in the Cloud) &#8211; One of the things I mentioned earlier was not being a networking guy, these sorts of presentations helped me understand how things fit in, where things were going and how virtual networking was solving real world problems with scale. Gone are the days where we provide L2 bridges (+ VLAN tagging) to virtual machines, in the world of software defined networking we can remove a lot of underlying complexity and control it all in software. This is an area that will become extremely important in the future. (<a href="http://www.openstack.org/summit/portland-2013/session-videos/presentation/scaling-in-the-cloud-the-hype-and-happenings-of-software-defined-networking">http://www.openstack.org/summit/portland-2013/session-videos/presentation/scaling-in-the-cloud-the-hype-and-happenings-of-software-defined-networking</a>)</p>
<p>Note, ALL of the Summit videos are freely available online at: <a href="http://www.openstack.org/summit/portland-2013/session-videos/">http://www.openstack.org/summit/portland-2013/session-videos/</a></p>
<p>Cheers,<br />
Rhys</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rdoxenham.com/?feed=rss2&#038;p=325</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MacBook Pro Retina with Linux (Fedora 18)</title>
		<link>http://www.rdoxenham.com/?p=317</link>
		<comments>http://www.rdoxenham.com/?p=317#comments</comments>
		<pubDate>Tue, 23 Apr 2013 23:04:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.rdoxenham.com/?p=317</guid>
		<description><![CDATA[I recently purchased a new MacBook Pro 13&#8243; w/Retina (Early 2013, MacBookPro10,2), it&#8217;s absolutely stunning and love using it. As I work on a day-to-day basis with Linux, I decided to remove MacOS and deploy Fedora 18 on it. I &#8230; <a href="http://www.rdoxenham.com/?p=317">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I recently purchased a new MacBook Pro 13&#8243; w/Retina (Early 2013, <strong>MacBookPro10,2</strong>), it&#8217;s absolutely stunning and love using it. As I work on a day-to-day basis with Linux, I decided to remove MacOS and deploy Fedora 18 on it. I was pleasantly surprised that almost everything works out of the box. I did have to make some modifications once it was installed, mainly for performance but also to get sound and the wireless working. As the installation is just as easy as installing it on a non-Apple machine, this guide assumes that you have already done so. If you&#8217;re having problems installing, I&#8217;d be happy to assist.</p>
<p>What currently doesn&#8217;t work? Well, Thunderbolt hotplug currently isn&#8217;t supported; Mac OSX seems to use some form of magic to enable hotplugging and to control the thunderbolt controllers. Whilst the Linux kernel supports the thunderbolt controllers, it only ever works if the adapter is plugged in before the system is booted, I&#8217;ve successfully used a Thunderbolt Ethernet adapter. I wouldn&#8217;t expect thunderbolt hotplug anytime soon either, which is a shame. There&#8217;s also currently a bug with the mini-displayport -&gt; VGA, although HDMI works out of the box. I&#8217;ll work on the VGA adapter problem and will update this post if/when it&#8217;s working.</p>
<p><strong>Step One (Wireless):</strong> The MacBook Pro ships with a Broadcom BCM4331 wireless adapter, there&#8217;s an open-source driver available in the kernel (<strong>b43</strong>) but it requires additional proprietary firmware from Broadcom to use it successfully. I had no end of trouble with this driver, it didn&#8217;t support 5GHz/N networks and constantly dropped connectivity &#8211; completely unreliable. <strong> </strong></p>
<p>The solution that worked for me and has been rock-solid so far is the proprietary driver direct from Broadcom (<strong>wl</strong>), it has open-source code to support the driver and provide a standard interface to the binary driver. Broadcom ship this package on their website (http://www.broadcom.com/support/802.11/linux_sta.php) but for reasons unknown to me do not ship the latest code, in addition, via the rpmfusion repositories it&#8217;s available as a package for Fedora. The guys over at Ubuntu managed to get access to the latest packages and I was able to build it successfully on Fedora (after reading lots of threads!). The downside is that the compiled module is inserted into each kernel manually after its built and therefore it needs to be built each time there&#8217;s a kernel update. I would rather do this and have stable WiFi than use the b43 driver though; perhaps in the future either the <strong>b43</strong> or <strong>wl</strong> driver will be stable enough upstream to use without manual compilation.</p>
<p>Below I&#8217;ve outlined the necessary steps for getting the driver working on Fedora 18, note that the package comes as a Debian package that we&#8217;ll extract:</p>
<pre class="brush: text; gutter: false">$ su -
# yum groupinstall &quot;Development Tools&quot; -y
# yum install binutils -y

# mkdir ~/bcm4331 &amp;&amp; cd ~/bcm4331
# wget http://shared.teratan.net/~rdo/bcm4331/wireless-bcm43142-dkms_6.20.55.19-1_amd64.deb
# ar vx wireless-bcm43142-dkms_6.20.55.19-1_amd64.deb
# tar -zxvf data.tar.gz

# cd usr/src/wireless-bcm43142-6.20.55.19
# wget http://shared.teratan.net/~rdo/bcm4331/wl_cfg80211.c
# mv wl_cfg80211.c src/wl/sys/
# make &amp;&amp; make install

# depmod -a
# modprobe -r b43 ssb bcma
# modprobe wl

# echo &quot;blacklist bcma&quot; &gt;&gt; /etc/modprobe.d/blacklist.conf
# echo &quot;blacklist ssb&quot; &gt;&gt; /etc/modprobe.d/blacklist.conf
# echo &quot;blacklist b43&quot; &gt;&gt; /etc/modprobe.d/blacklist.conf

# echo &quot;wl&quot; &gt;&gt; /etc/modules-load.d/wireless.conf
# restorecon -v /etc/modules-load.d/wireless.conf</pre>
<p>The above commands basically grab the Ubuntu package, over-write some minor changes required to build it on a 3.8+ kernel, compile the module for the local system and install it for the current kernel. In addition it also updates the module &#8220;database&#8221; and inserts the module with associated dependencies (cfg80211, lib80211 and lib80211_crypt_tkip). Finally, it blacklists the open-source drivers and enables the &#8216;<strong>wl</strong>&#8216; driver to be started on boot up.</p>
<p>The system should now report that the wireless adapter is available and that it&#8217;s using the correct driver:</p>
<pre class="brush: text; gutter: false"># lspci -k | grep -n2 4331 | tail -n3
42:03:00.0 Network controller: Broadcom Corporation BCM4331 802.11a/b/g/n (rev 02)
43-	Subsystem: Apple Inc. Device 010f
44-	Kernel driver in use: wl

# lsmod | grep wl
wl                   3074693  0 
cfg80211              495993  1 wl
lib80211               13968  2 wl,lib80211_crypt_tkip</pre>
<p>At this point I&#8217;d recommend rebooting to ensure that the machine comes up successfully and that the drivers are loaded automatically (confirm using the above steps again). You should also not be able to see the &#8216;<strong>b43</strong>&#8216; driver in the list of modules.</p>
<p><strong>Note</strong>: I did have some instabilities when using &#8216;<em>iwconfig</em>&#8216;, I&#8217;d recommend that you avoid this tool if you can, &#8216;<em>ifconfig&#8217;</em> works without problem.</p>
<p><strong>Step Two (Sound/Audio):</strong> As the device is very much like any other manufacturers equipment, it utilises commodity components. The Ivybridge CPU provides the standard Intel HD4000 video card and therefore works right out of the box; upstream support has been there for a long time. This is also the same story for a number of other components, the sound card whilst supported requires a slight module modification to get it to work properly. What you may find is that the modules get automatically loaded by Fedora but no sound card is visible.</p>
<p>The module that we&#8217;re using to provide audio is &#8216;<strong>snd_hda_intel</strong>&#8216;, we need to pass an additional model identifier to it in order to initialise the card:</p>
<pre class="brush: text; gutter: true">$ su -
# echo &quot;options snd_hda_intel model=mbp101&quot; &gt;&gt; /etc/modprobe.d/snd_hda_intel.conf
# restorecon -v /etc/modprobe.d/snd_hda_intel.conf</pre>
<p>Note that you will either need to reboot or reload the module in order to get sound working; I recommend the former as it will integrate with the rest of your environment without having to restart all of the required services manually. When the machine has come back up, confirm that the module was loaded correctly with the model identifier:</p>
<pre class="brush: text; gutter: false">$ cat /sys/module/snd_hda_intel/parameters/model 
mbp101,(null),(null),(null),(null)......</pre>
<p>Step Three (Performance): Regardless of the specification you chose to buy, the MacBook Pro is a very capable machine. There are a number of recommendations that I&#8217;d like to make in order to maximise the performance of your system. Firstly, any modern machine with plenty of RAM will very rarely need to touch swap space but it certainly still is a requirement, e.g. for hibernation or for various types of workloads. That being said, we should still ask Linux to avoid using the swap space wherever possible:</p>
<pre class="brush: text; gutter: false">$ su -
# echo &quot;vm.swappiness=1&quot; &gt;&gt; /etc/sysctl.d/performance.conf
# echo &quot;vm.vfs_cache_pressure=50&quot; &gt;&gt; /etc/sysctl.d/performance.conf
# restorecon -v /etc/sysctl.d/performance.conf</pre>
<p>Next, as we&#8217;re using non-rotational disks (i.e. SSD/Flash), the &#8216;<strong>noop</strong>&#8216; block scheduler provides a number of performance benefits that we can exploit; it&#8217;s essentially no scheduling at all, just basic FIFO (first in, first out), alternatively the &#8216;<strong>deadline</strong>&#8216; scheduler can be used which tries to prioritise reads to enable some sort of read-performance when there is heavy write I/O. My personal preference is &#8216;<strong>noop</strong>&#8216; but your workload may require &#8216;<strong>deadline</strong>&#8216;. You can view the current scheduler algorithm by using the following command:</p>
<pre class="brush: text; gutter: false">$ cat /sys/block/sda/queue/scheduler
noop deadline [cfq]</pre>
<p>In the above example, you can see that I&#8217;m currently using the &#8216;<strong>cfq</strong>&#8216; method. It&#8217;s easy to make a one-time change to the scheduler by echoing values into that virtual filesystem but to make this persistent we need to add a udev rule:</p>
<pre class="brush: text; gutter: false"># echo ACTION==&quot;add|change&quot;, KERNEL==&quot;sda&quot;, ATTR{queue/rotational}==&quot;0&quot;, ATTR{queue/scheduler}=&quot;noop&quot; &gt;&gt; /etc/udev/rules.d/60-scheduler.rules
# restorecon -v /etc/udev/rules.d/60-scheduler.rules</pre>
<p>Note that I have explicity specified the &#8216;sda&#8217; device here (the internal SSD) and not all sd*, this is because I may want to attach external disks, e.g. via USB, which will be rotational disks and would therefore benefit from the default scheduler. Feel free to adjust the above udev rule to specify &#8216;<strong>deadline</strong>&#8216; if that&#8217;s your preference.</p>
<p>Finally, as we&#8217;re using a solid state disk it makes sense to implement trim/discard to aid with the wearing of the disk; I&#8217;m not going to go into too much detail of why we do this but it will prolong the life of the drive. There are a number of changes to make, firstly your fstab needs to be updated to mount your drives with these options:</p>
<pre class="brush: text; gutter: false">$ su -
# vi /etc/fstab</pre>
<p>Depending on your partition layout and whether you use encrypted volumes the next steps may be quite different for you. I will, however, assume that you&#8217;re using a default partition layout with a separate <strong>/home</strong> and <strong>/ </strong>mount points. Simply add the parameters &#8216;discard&#8217; and &#8216;noatime&#8217; to each mount. For example:</p>
<pre class="brush: text; gutter: false">(change)
/dev/mapper/vol0-rootVol    /    ext4    defaults    1 1

(to)
/dev/mapper/vol0-rootVol    /    ext4    defaults,discard    1 1

(repeat for /home)

(&#039;i&#039; to edit and &#039;Esc -&gt; :wq!&#039; to save and quit)</pre>
<p>Once that&#8217;s complete we need to test your changes:</p>
<pre class="brush: text; gutter: false"># mount -o remount /
# mount -o remount /home
# mount | egrep &#039;(on /|/home)&#039;
/dev/mapper/vol0-rootVol on / type ext4 (rw,relatime,seclabel,discard,data=ordered)
/dev/mapper/cryptoVol on /home type ext4 (rw,relatime,seclabel,discard,data=ordered)</pre>
<p>If successful, you should see the discard option listed in your output, yours my vary but ensure it has discard listed.</p>
<p>Please note: If you want to increase the performance further and are willing to accept a bit of risk, you can mount your volumes with the &#8216;<strong>noatime</strong>&#8216; option too; this removes the requirement for file updates for just reads&#8230; just bear in mind that applications may break! Fedora by default uses &#8216;<strong>relatime</strong>&#8216; which is a nice compromise.</p>
<p>&#8212; Additional tweaks coming tomorrow &#8212;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rdoxenham.com/?feed=rss2&#038;p=317</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to fix mouse sensitivity in GNOME 3</title>
		<link>http://www.rdoxenham.com/?p=288</link>
		<comments>http://www.rdoxenham.com/?p=288#comments</comments>
		<pubDate>Tue, 03 Jul 2012 22:52:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.rdoxenham.com/?p=288</guid>
		<description><![CDATA[One of my pet hates in GNOME 3 on Fedora 16/17 (perhaps in other distributions also) is the apparent lack of functionality in the mouse pointer speed/acceleration. The GUI seems to have very little influence on the user experience&#8230; As &#8230; <a href="http://www.rdoxenham.com/?p=288">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>One of my pet hates in GNOME 3 on Fedora 16/17 (perhaps in other distributions also) is the apparent lack of functionality in the mouse pointer speed/acceleration. The GUI seems to have very little influence on the user experience&#8230;<span id="more-288"></span></p>
<p><a href="http://www.rdoxenham.com/wp-content/uploads/2012/07/mouseproperties.png"><img class="alignnone size-full wp-image-289" title="mouseproperties" src="http://www.rdoxenham.com/wp-content/uploads/2012/07/mouseproperties.png" alt="" width="684" height="519" /></a></p>
<p>As you can see, despite the fact that these options are dropped to the lowest setting possible, I found that the mouse pointers sensitivity was ridiculous. There have been a number of bugs raised previously, e.g. <a href="https://bugzilla.redhat.com/show_bug.cgi?id=390131">https://bugzilla.redhat.com/show_bug.cgi?id=390131</a> but was closed years ago. It appears that this bug has shown it&#8217;s ugly face again! Until this is fixed, an easy solution to this problem is to modify some of the properties in xinput. Modifications are typically done via a terminal but it&#8217;s (of course) easy to make these persist by scripting it and making sure it gets executed upon login (see further below for an example)</p>
<p>To use xinput properly, you need to know which device&#8217;s properties you want to modify, a simple &#8216;xinput&#8217; command can show you all of the devices currently being used (and can be modified)&#8230;</p>
<pre class="brush: text; gutter: false">[rdo@soundwave ~]$ xinput
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ Logitech USB Laser Mouse                	id=10	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Power Button                            	id=7	[slave  keyboard (3)]
    ↳ Apple, Inc Apple Keyboard               	id=8	[slave  keyboard (3)]
    ↳ Apple, Inc Apple Keyboard               	id=9	[slave  keyboard (3)]
    ↳ Eee PC WMI hotkeys                      	id=11	[slave  keyboard (3)]</pre>
<p>So, in my case, I want to modify my &#8216;Logitech USB Laser Mouse&#8217;; to show all of the properties you can use the following:</p>
<pre class="brush: text; gutter: false">[rdo@soundwave ~]$ xinput list-props &#039;Logitech USB Laser Mouse&#039;
Device &#039;Logitech USB Laser Mouse&#039;:
	Device Enabled (131):	1

...(and so on)...</pre>
<p>But the ones we&#8217;re primarily interested in here are as follows-</p>
<ul>
<li>&#8220;Device Accel Constant Deceleration&#8221;</li>
<li>&#8220;Device Accel Velocity Scaling&#8221;</li>
</ul>
<p>You can have a play with these values, making sure you&#8217;re happy with the speed/acceleration of your mouse, specific for your device. I set the following attributes/properties:</p>
<pre class="brush: text; gutter: false">$ xinput --set-prop &quot;Logitech USB Laser Mouse&quot; &quot;Device Accel Constant Deceleration&quot; 1.5

$ xinput --set-prop &quot;Logitech USB Laser Mouse&quot; &quot;Device Accel Velocity Scaling&quot; 1</pre>
<p>Obviously, this is set dynamically and will not persist after a logout/reboot. So an easy fix is to write a bash script that is called upon login:</p>
<pre class="brush: text; gutter: false">[rdo@soundwave ~]$ cat .fix-mouse.sh 
#!/bin/bash
xinput --set-prop &quot;Logitech USB Laser Mouse&quot; &quot;Device Accel Constant Deceleration&quot; 1.5
xinput --set-prop &quot;Logitech USB Laser Mouse&quot; &quot;Device Accel Velocity Scaling&quot; 1</pre>
<p>I basically make this a &#8216;hidden&#8217; file and have GNOME3 execute this script upon login, this is easily done, simply open up a terminal and launch &#8216;gnome-session-properties&#8217;, i.e.</p>
<pre class="brush: text; gutter: false">$ gnome-session-properties</pre>
<p>You can then click on &#8216;Add&#8217; (when on the &#8216;Startup Programs&#8217; tab) and simply set the command path to be your recently created script. My example is shown below&#8230;</p>
<p><a href="http://www.rdoxenham.com/wp-content/uploads/2012/07/startup.png"><img class="alignnone size-full wp-image-290" title="startup" src="http://www.rdoxenham.com/wp-content/uploads/2012/07/startup.png" alt="" width="686" height="493" /></a></p>
<p>Any questions, as always, let me know <img src='http://www.rdoxenham.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.rdoxenham.com/?feed=rss2&#038;p=288</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to Enable Nested KVM</title>
		<link>http://www.rdoxenham.com/?p=275</link>
		<comments>http://www.rdoxenham.com/?p=275#comments</comments>
		<pubDate>Mon, 25 Jun 2012 23:14:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[KVM]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.rdoxenham.com/?p=275</guid>
		<description><![CDATA[If you&#8217;ve arrived at this blog post I&#8217;d have to assume you&#8217;re familiar with what KVM is, but for the benefit of those who are unaware or are just interested in reading more, I&#8217;ll give a bit of a background&#8230; &#8230; <a href="http://www.rdoxenham.com/?p=275">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>If you&#8217;ve arrived at this blog post I&#8217;d have to assume you&#8217;re familiar with what KVM is, but for the benefit of those who are unaware or are just interested in reading more, I&#8217;ll give a bit of a background&#8230; Kernel-based Virtual Machine (KVM) is a kernel module that was originally developed by an Israeli organisation called Qumranet to provide native virtualisation technology for Linux-based platforms; essentially turning the kernel into a Tier-1 hypervisor. It has since been ported to multiple other platforms and architectures other than 32/64-bit x86. It got initially adopted into the upstream Linux kernel as of 2.6.20 (back in 2007).<span id="more-275"></span></p>
<p>Typically KVM is designed to run on-top of a bare-metal Linux machine with a CPU that supports virtualisation extensions, i.e. Intel VMX and AMD SVM. This allowed a physical machine to run multiple virtual machines on-top (using associated components such as libvirt and qemu), but there&#8217;s a new neat technology known as &#8216;nested KVM&#8217;, in other words, KVM support within a KVM-based guest or a hypervisor within a guest. You may ask the question &#8216;why do we need this?&#8217;&#8230; well, in my position I&#8217;m often running into situations where I have to carry out product demonstrations or debugging hypervisor environments, having another layer of virtualisation abstraction with nested-KVM is great, especially when on the train or on a plane!</p>
<p>There are, of course, some performance problems with doing this but for debugging or wanting to spin up a test environment with technologies such as Red Hat Enterprise Virtualisation or VMware on a single machine it&#8217;s quite a nice solution. So let&#8217;s look at how to enable it first, by default it&#8217;s usually disabled, at least on my Fedora 16 machine (you can replace Intel with AMD here if you have an AMD-based processor)&#8230;</p>
<pre class="brush: text; gutter: false">$ cat /sys/module/kvm_intel/parameters/nested 
N</pre>
<p>To enable it, we need to make sure the KVM architecture specific module is loaded with the nested option. There are a few options for enabling it, the first way to do this is just update your boot loader to specify the nested option; that way it persists with a reboot or kernel upgrade. Assuming you&#8217;re using Fedora with GRUB2, (as root) you need to update the &#8216;<em>/etc/default/grub</em>&#8216; file and append &#8216;<em>kvm-intel.nested=1</em>&#8216; to the <em>&#8216;GRUB_CMDLINE_LINUX</em>&#8216; line. For reference, mine is specified below, remember to replace &#8216;intel&#8217; with &#8216;amd&#8217; if required.</p>
<pre class="brush: text; gutter: false"># cat /etc/default/grub | grep CMDLINE
GRUB_CMDLINE_LINUX=&quot;rd.lvm.lv=vol0/swapVol rd.md=0 rd.dm=0  KEYTABLE=us quiet rd.lvm.lv=vol0/rootVol rhgb rd.luks=0 SYSFONT=latarcyrheb-sun16 LANG=en_US.UTF-8 kvm-intel.nested=1&quot;</pre>
<p>Once this is specified, you&#8217;ll need to rebuild your GRUB configuration files so that when you next reboot the command line arguments you just specified are loaded, note the GRUB2 configuration location may be different on a non-Fedora machine&#8230;</p>
<pre class="brush: text; gutter: false"># grub2-mkconfig -o /boot/grub2/grub.cfg</pre>
<p>Alternatively, (thanks to Dominic Cleal for the suggestion) this can be modified using the modprobe configuration files, making things slightly easier-</p>
<pre class="brush: text; gutter: false">$ echo “options kvm-intel nested=1″ | sudo tee /etc/modprobe.d/kvm-intel.conf</pre>
<p>I would now recommend rebooting your machine to verify the changes have been made. Once again, you can re-run the previous command to check this and you should see that the changes to the module have been made.</p>
<pre class="brush: text; gutter: false">$ cat /sys/module/kvm_intel/parameters/nested 
Y</pre>
<p>And that&#8217;s it, you&#8217;ve successfully enabled nested-KVM. Next, when you create new virtual machines, e.g. with virt-manager, you will need to &#8216;require&#8217; vmx or svm to be presented to the virtual machine; that way the guests can make use of the underlying nested-KVM features that have been enabled. This can also be done via direct modification of the libvirt XML definition of a given virtual machine, an example of one of my VM&#8217;s is shown below-</p>
<pre class="brush: text; gutter: false">&lt;cpu match=&#039;exact&#039;&gt;
  &lt;model&gt;Westmere&lt;/model&gt;
 &lt;feature policy=&#039;require&#039; name=&#039;vmx&#039;/&gt;
&lt;/cpu&gt;</pre>
<p>Any questions please feel free to get in touch, I&#8217;d be happy to help out. <img src='http://www.rdoxenham.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Further reading: https://github.com/torvalds/linux/blob/master/Documentation/virtual/kvm/nested-vmx.txt</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rdoxenham.com/?feed=rss2&#038;p=275</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Switching trackpad scroll direction in Linux</title>
		<link>http://www.rdoxenham.com/?p=273</link>
		<comments>http://www.rdoxenham.com/?p=273#comments</comments>
		<pubDate>Thu, 07 Jun 2012 08:26:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.rdoxenham.com/?p=273</guid>
		<description><![CDATA[If you&#8217;re like me and use both a Mac and a Linux laptop (or perhaps dual-booting on the same hardware) and like the scroll-direction that Lion gives you, you probably found it annoying having to switch between the two platforms&#8230; &#8230; <a href="http://www.rdoxenham.com/?p=273">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>If you&#8217;re like me and use both a Mac and a Linux laptop (or perhaps dual-booting on the same hardware) and like the scroll-direction that Lion gives you, you probably found it annoying having to switch between the two platforms&#8230; going the wrong way and forgetting which way is which on each platform!<span id="more-273"></span></p>
<p>I take no credit for this solution, but I thought I&#8217;d write an easy article on how to change the scroll behaviour on your Linux machine to be the <strong>same </strong>as your Mac. It&#8217;s a very simple procedure; open up a terminal as your local user (which, I hope, isn&#8217;t root!) and type the following:</p>
<pre class="brush: text; gutter: false">$ echo &quot;pointer = 1 2 3 5 4 6 7 8 9 10 11 12&quot; &gt;&gt; ~/.Xmodmap</pre>
<p>After you restart your session, it should have switched the scrolling direction. For the curious amongst you, you&#8217;ll notice that the &#8217;4&#8242; and &#8217;5&#8242; are switched around here. You can easily verify that the above has successfully included your changes by simply using the following command:</p>
<pre class="brush: text; gutter: false">$ cat ~/.Xmodmap | grep pointer
pointer = 1 2 3 5 4 6 7 8 9 10 11 12</pre>
<p>I tested this on my Fedora 16 laptop using GNOME3. Any problems, let me know&#8230; have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rdoxenham.com/?feed=rss2&#038;p=273</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Fixing&#8221; kernel_task CPU Problems in MacOS 10.7/10.8</title>
		<link>http://www.rdoxenham.com/?p=259</link>
		<comments>http://www.rdoxenham.com/?p=259#comments</comments>
		<pubDate>Tue, 05 Jun 2012 22:29:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.rdoxenham.com/?p=259</guid>
		<description><![CDATA[Update (Early 2013): When I wrote this guide it was focusing on Lion 10.7, many people have, of course, upgraded to 10.8 and have reported success using the same principles. However, the plist entries have not been added for newer &#8230; <a href="http://www.rdoxenham.com/?p=259">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><strong>Update (Early 2013)</strong>: When I wrote this guide it was focusing on Lion 10.7, many people have, of course, upgraded to 10.8 and have reported success using the same principles. However, the plist entries have not been added for newer models, e.g. the new MacBook Air or MacBook Pro (+retina). Therefore, if you follow the guide exactly you may run into problems such as your model identifier not being visible. After diagnosing this with others via email it would appear that the system uses another plist in the directory, therefore removing all of the plists has worked. I cannot comment further or prove this to be the case as I don&#8217;t have the available hardware. Let me know whether this works for you&#8230;..</p>
<p>I use a wide variety of operating systems at home, all services are provided by Linux, e.g. firewall, routing, file-storage and DLNA media. However, I like using a Mac too, I have a late-2009 MacBook Air which I use whilst traveling. Despite all of Lion&#8217;s flaws, I really like using it- full-screen apps, gestures and the new Mail.app is really impressive. The specification of this machine really isn&#8217;t anything special, the lack of expansion really leaves a lot to be desired but for what I do- it&#8217;s plenty. I will certainly be upgrading to the new Ivy Bridge MacBook Air when it comes out, perhaps then I&#8217;ll have more than 2GB memory and can run VM&#8217;s too(!).<span id="more-259"></span></p>
<p>The biggest problem I&#8217;ve been having with this machine on Lion (didn&#8217;t have it on Snow Leopard) is to do with kernel_task. Instead of splitting all of the underlying kernel operations into their own individual processes (and associated threads) they are all consumed by a single &#8216;task&#8217; (more of a representation of the underpinnings of the microkernel architecture) that appears in the process list. What I&#8217;ve been noticing is that this &#8216;task&#8217; sometimes goes out of control, consumes CPU resources with the utmost priority. For a long time I wasn&#8217;t sure what it was doing, it seemed to be kicking in when I was doing something that was relatively intensive (for a Mac anyway), e.g. YouTube.</p>
<p>A lot of people suggested that &#8216;rogue kexts&#8217; (kernel drivers/modules) could be causing the problem, perhaps an incompatible module was being started by OS X that was installed when the system was running Snow Leopard. This seemed to make sense as a boot in safe-mode would cause no problems. Suffice to say, I created a Lion Install-USB and re-installed from scratch; guess what&#8230; same problem within hours! After a bit of digging around and investigating the kernel_task &#8216;process&#8217; it was clear to see that it was looping through something continually. After further research I discovered that the kernel will keep looping some very simple tasks, e.g. getting the date, therefore &#8216;consuming&#8217; (with the highest priority) the majority of the CPU in a bid to cool the system down.</p>
<p>So, it&#8217;s all to do with temperature control- you &#8216;remove&#8217; a large portion of the CPU share from other applications and carry out low-overhead tasks continually until the CPU temperature drops. This sounds like a great solution to cooling, but it&#8217;s very intrusive. It&#8217;s agressive nature drags the system to a halt in a lot of ways, despite the fact that the CPU in my MacBook Air rarely exceeds 70 degrees (centigrade). Considering the TJ Max of my little 2.13GHz Core2Duo is 85 degrees I&#8217;d rather kernel_task not take this invasive action.</p>
<p>Thankfully, this &#8220;feature&#8221; is built into a kext, in which each model identifier specifies how to control the temperature of the CPU via this invasive action. The simple fix is to remove the entry for your model identifier from this kext- if it &#8220;doesn&#8217;t know&#8221; what to do with your particular model, it won&#8217;t take any action. Now, here comes the disclaimer&#8230; by taking the same action as I will outline below,<strong> I take absolutely no responsibility for any damage or loss caused to you or your property, you do this of your own free will</strong>. You&#8217;re over-ruling functionality that was designed to prolong the life of your equipment, despite the fact that it&#8217;s invasive and very annoying it&#8217;s there for a reason. Anyway, on to the fun stuff&#8230;</p>
<p>Firstly, you&#8217;re going to need the model identifier of your pesky Mac:</p>
<pre class="brush: text; gutter: false">$ system_profiler -detailLevel mini | grep &quot;Model Identifier:&quot;
      Model Identifier: MacBookAir2,1</pre>
<p>The kext we need to modify is <em>IOPlatformPluginFamily.kext, </em>you can verify it is running by-</p>
<pre class="brush: text; gutter: false">sh-3.2# kextstat | grep IOPlatformPluginFamily
   67    3 0xffffff7f81229000 0x7000     0x7000     com.apple.driver.IOPlatformPluginFamily (5.1.0d17) &lt;8 7 6 5 4 3&gt;</pre>
<p><em>Within this kext will be another further kext- ACPI_SMC_PlatformPlugin.kext</em>, in which each recent Macintosh model is listed with relevant instructions that the kernel uses to determine how and when to invoke the control. (Make sure you switch to root now)</p>
<pre class="brush: text; gutter: false">sh-3.2# cd /System/Library/Extensions/IOPlatformPluginFamily.kext/
sh-3.2# cd Contents/PlugIns/ACPI_SMC_PlatformPlugin.kext/
sh-3.2# cd Contents/Resources/
sh-3.2# ls | wc -l
49</pre>
<p>So, there&#8217;s 49 different profiles listed in this kext as of the writing of this. We simply need to move the &#8216;plist&#8217; file for the model identifier we discovered earlier out of that directory, so in my case I need to move file &#8216;MacBookAir2_1.plist&#8217; out of this directory (to somewhere safe), but replace my model identifier with your specific one.</p>
<pre class="brush: text; gutter: false">sh-3.2# mv MacBookAir2_1.plist /Users/&lt;your username&gt;/</pre>
<p>You can simply reboot now for the changes to take effect. We could have removed the entire kext but it&#8217;s much safer to remove the plist file for the specific model as (to be honest) I don&#8217;t know what the rest of that kernel module does. I&#8217;ve been using this &#8216;fix&#8217; for a few days now and not noticed any problems at all- overall it&#8217;s <strong>much</strong> quicker and I don&#8217;t have to worry about it running out of steam. What I would recommend is that you be a bit more careful about the placement of your Mac, you don&#8217;t want to be covering the exhaust. The Mac should protect itself if it *does* reach max temperature but I would just be a little more careful.</p>
<p><strong>Note:</strong> It&#8217;s likely that this kext will get updated in the future by Apple in their update packs and as a result will replace the file you deleted/moved therefore you may have to repeat this process in the future <img src='http://www.rdoxenham.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Let me know how you get on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rdoxenham.com/?feed=rss2&#038;p=259</wfw:commentRss>
		<slash:comments>80</slash:comments>
		</item>
		<item>
		<title>Fixing VMware PVSCSI Kernel-Update Problem [RHEL5]</title>
		<link>http://www.rdoxenham.com/?p=218</link>
		<comments>http://www.rdoxenham.com/?p=218#comments</comments>
		<pubDate>Thu, 12 Apr 2012 15:30:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[RHEL]]></category>

		<guid isPermaLink="false">http://www.rdoxenham.com/?p=218</guid>
		<description><![CDATA[Recently, I worked on a customer problem which involved using the para-virtualisation drivers that VMware ship as part of their guest tools package for Linux operating systems. The VMware package provides a number of kernel modules, the most significant being &#8230; <a href="http://www.rdoxenham.com/?p=218">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Recently, I worked on a customer problem which involved using the para-virtualisation drivers that VMware ship as part of their guest tools package for Linux operating systems. The VMware package provides a number of kernel modules, the most significant being their pvscsi (block-storage) and vmxnet3 (network) allowing enhanced performance in a virtual environment- rather than emulating SCSI or an ethernet adaptor such as Intel&#8217;s e1000- the choice of what to present to the virtual machine can be configured at any time, but if the drivers/modules aren&#8217;t available in the guest operating system, the devices cannot be used.<span id="more-218"></span></p>
<p>This is where the problem starts- the Red Hat Enterprise Linux (RHEL) 5 kernel does not have these modules available out of the box, therefore typically an installation of RHEL takes place using emulation to get the system up and running, the tools are then installed (which typically install pre-compiled kernel modules) and the system administrator can then present the para-virtualised devices instead. However, when a new kernel is installed the drivers will not automatically be part of the freshly installed kernel therefore upon a reboot the system will not be able to find it&#8217;s disks or network devices (depending on which are being used).</p>
<p>It&#8217;s not good enough to simply re-install the tools immediately after a kernel-update because the tools will simply install onto the currently running kernel. Whilst it&#8217;s possible to manually select a kernel version to install for, the VMware tools expect to build the modules from source (rather than using the pre-compiled versions) which doesn&#8217;t really help our situation- we don&#8217;t always want compilers and associated libraries on every system. So, we need a solution where the drivers are automatically present in the new kernel, so after a reboot there&#8217;s no issue in the system coming up as expected.</p>
<p>The main problem that needs to be addressed is the pvscsi (block-storage) driver- if your root filesystem resides on a pvscsi device then the system will completely fail to boot. If, at least, pvscsi is available- the system can continue to boot as normal, but the rest of the drivers would need to be reinstalled post-reboot, which as explained earlier is no problem as the tools will install for the current kernel (i.e. the one you just updated to). I focussed my efforts on working to ensure that post-kernel installation there would be an automatic installation of the pvscsi kernel module into the new kernel tree.</p>
<p>The solution I came up with is very simple- I looked through the source of the VMware tools install script and found that the code does the following-</p>
<p>1) Checks to see if there are compatible pre-built kernel modules within the tools<br />
2) If so, it places the modules into /lib/modules/&lt;kernel-version&gt;/misc<br />
3) Executes a &#8216;depmod&#8217; to scan and refresh the module tree<br />
4) Creates a new initrd with the required modules included for boot</p>
<p>As I know that my customer runs RHEL 5, there will always be a compatible pre-built kernel module available within the tree and due to Red Hat&#8217;s extensive effort to keep the kABI/API compatibility across the life-cycle of the major version, we can simply copy the existing pre-built kernel module from the existing kernel tree straight over to the new one and manually create an initrd for the new kernel.</p>
<p>During testing of this code, I wrote the following bash script which takes care of ensuring that the pvscsi module is in the new kernel and a new initrd is in-place:</p>
<pre class="brush: bash; gutter: false">#!/bin/bash

# Get the latest kernel installed
NEW_VERSION=`ls -tA1 /lib/modules | head -n 1`

# Check if the module is already present, if not- continue
if [ ! -e /lib/modules/$NEW_VERSION/misc/pvscsi.ko ]; then

    # Log output to show version we&#039;re fixing
	/bin/logger &quot;Fixing VMware Paravirtual Drivers for reboot. Kernel: $NEW_VERSION&quot;

    # Create the misc directory that VMware tools would
	mkdir /lib/modules/$NEW_VERSION/misc &gt; /dev/null 2&gt;&amp;1

    # Find the current running kernel
	OLD_VERSION=`uname -r`

    # Copy the existing module to new kernel tree
	cp /lib/modules/$OLD_VERSION/misc/pvscsi.ko /lib/modules/$NEW_VERSION/misc &gt; /dev/null 2&gt;&amp;1

    # Rebuild our modules cache
	depmod -a $NEW_VERSION &gt; /dev/null 2&gt;&amp;1

    # Create a new initrd, including the new pvscsi module
	mkinitrd -f --with=pvscsi /boot/initrd-$NEW_VERSION.img $NEW_VERSION &gt; /dev/null 2&gt;&amp;1

else
    # This would occur when module is already present
	/bin/logger &quot;VMware Paravirtual Drivers Fix Installed&quot;
fi
exit 0</pre>
<p>Whilst this will fix the new kernel to have the freshly installed VMware pvscsi driver present (and therefore allow a normal boot) we need to look at automating this procedure to avoid accidental reboots without the fix being put in place. With RHEL/rpm-based platforms we can use RPM triggers to execute on a particular event. For example, we can create a &#8216;dummy-rpm&#8217; which has the above script in that executes every time a particular event, such as a package upgrade/install occurs. Therefore, in our example we would need to create an rpm which simply ran the above code every time the kernel package was installed/upgraded. This is done by the tag &#8216;%triggerin &#8212; kernel&#8217; (short for trigger &#8216;install&#8217;) within the rpm spec file.</p>
<p>If we create a very basic rpm spec file such as the following, we can use rpmbuild to build an rpm for us. Once this is installed on the target system it will simply execute the script code every time there&#8217;s a modification to the kernel package:</p>
<pre class="brush: bash; gutter: false">Name:	    fix-vmware
Version:	0.1
Release:	1%{?dist}
Summary:	Fixes pvscsi.ko to ensure it survives kernel-upgrades with reboot
Packager:	Rhys Oxenham &lt;roxenham@redhat.com&gt;

Group:	    Applications/System
License:	GPLv2+
URL:		http://www.rdoxenham.com
BuildArch:	noarch

%description

This package fixes the VMware paravirtual SCSI driver issue in RHEL5, ensuring
that the pvscsi.ko module is available after a reboot and that the
vmware-config-tools.pl script can execute to re-enable everything else.

%triggerin -- kernel

NEW_VERSION=`ls -tA /lib/modules | head -n 1`

if [ ! -e /lib/modules/$NEW_VERSION/misc/pvscsi.ko ]; then
	/bin/logger &quot;Fixing VMware Paravirtual Drivers for reboot. Kernel: $NEW_VERSION&quot;
	mkdir /lib/modules/$NEW_VERSION/misc &gt; /dev/null 2&gt;&amp;1
	OLD_VERSION=`uname -r`
	cp /lib/modules/$OLD_VERSION/misc/pvscsi.ko /lib/modules/$NEW_VERSION/misc &gt; /dev/null 2&gt;&amp;1
	depmod -a $NEW_VERSION &gt; /dev/null 2&gt;&amp;1
	mkinitrd -f --with=pvscsi /boot/initrd-$NEW_VERSION.img $NEW_VERSION &gt; /dev/null 2&gt;&amp;1
else
	/bin/logger &quot;VMware Paravirtual Drivers Fix Installed&quot;
fi
exit 0

* Wed Apr 4 2012 Rhys Oxenham &lt;roxenham@redhat.com&gt; 0.1-1
- Initial release</pre>
<p>For those unfamiliar with building rpm&#8217;s, the spec file simply lists how the rpm is built and how the rpm reacts to certain events such as install, remove, upgrade etc. It will also allow for clean removals of packages by maintaining a list of all files the rpm controls. To build an rpm from the above spec file, simply copy the text into a file named fix-vmware.spec and use rpmbuild to create the rpm for you-</p>
<pre class="brush: bash; gutter: false">(root) $ yum install rpm-build
 $ rpmbuild -bb /path/to/fix-vmware.spec</pre>
<p>It will then create a non-arch specific RPM for us, either in your home directory or in /usr/src/redhat if you build using root. We can then install this locally onto the system (or alternatively make this rpm part of your standard build process if you include it in a repository):</p>
<pre class="brush: bash; gutter: false">(root) $ yum localinstall /path/to/fix-vmware-0.1-1.noarch.rpm --nogpgcheck</pre>
<p><strong>Note</strong>: You may want to consider signing your rpm to get around the &#8216;&#8211;nogpgcheck&#8217; issue.</p>
<p>For those not wanting to build this themselves, I have a pre-built version available <a href="http://people.redhat.com/roxenham/fix-vmware-0.1-1.noarch.rpm">here</a>.</p>
<p>Finally, it&#8217;s very important that upon the reboot of the system that the full suite of VMware-tools are reinstalled as per your typical requirements (and over-writing the existing pvscsi module that the script described on this page to ensure the module gets updated over time). The tools will ensure that other modules such as vmxnet3 are installed and that the system can continue on with it&#8217;s required workloads. A typical way of doing this would be to create an /etc/rc.d/ boot-up script which runs the following line <strong>if </strong>the modules cannot be found.</p>
<pre class="brush: bash; gutter: false">vmware-config-tools.pl -d --clobber-kernel-modules=pvscsi</pre>
<p>Any questions, please leave a comment or get in contact <img src='http://www.rdoxenham.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.rdoxenham.com/?feed=rss2&#038;p=218</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
