<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" gd:etag="W/&quot;DEIFSXcyeyp7ImA9WhBaE0w.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239</id><updated>2013-05-23T14:41:58.993+01:00</updated><category term="http_proxy" /><category term="Natty" /><category term="java" /><category term="CSS" /><category term="rsync" /><category term="Debian" /><category term="gnome-screensaver" /><category term="WindowButtons" /><category term="apt-get" /><category term="UI" /><category term="XML" /><category term="Grub" /><category term="bash" /><category term="RAM" /><category term="WeatherStation" /><category term="dbus" /><category term="OSX" /><category term="DroboFS" /><category term="do-release-upgrade" /><category term="ISO8859-1" /><category term="which" /><category term="BusyBox" /><category term="DroboApps" /><category term="sudo" /><category term="blogger" /><category term="Firefox" /><category term="dynamic views" /><category term="clearlock" /><category term="Chrome" /><category term="Lucid" /><category term="Linux" /><category term="Atheros" /><category term="no_proxy" /><category term="RaspberryPi" /><category term="QEMU" /><category term="Raspian" /><category term="Ubuntu" /><category term="Terminal" /><category term="cron" /><category term="lock-input" /><category term="Maverick" /><category term="WindowControls" /><title>Troy's Blog</title><subtitle type="html">A place to record obscure technical facts before I forget them.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://blog.troyastle.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/troyastle" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="troyastle" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Ftroyastle" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><entry gd:etag="W/&quot;DEIFSH47eCp7ImA9WhBaE0w.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-8777167322101752806</id><published>2013-05-23T14:41:00.003+01:00</published><updated>2013-05-23T14:41:59.000+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-05-23T14:41:59.000+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WindowButtons" /><category scheme="http://www.blogger.com/atom/ns#" term="WindowControls" /><category scheme="http://www.blogger.com/atom/ns#" term="Chrome" /><category scheme="http://www.blogger.com/atom/ns#" term="UI" /><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu" /><title>Move the window controls to the left in Chrome on Ubuntu</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
I regularly switch between using Mac's and Linux machines at home and at work and as such I like to keep my window controls consistent across machines.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
My home machine is a Mac running OSX 10.08 and my work Laptop runs Ubuntu Linux 13.04 with Gnome Shell. Both of these desktops have their window controls on the left in the same order:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-uZJFndM9ne8/UZqhozmAR_I/AAAAAAAAVGE/7w0oXyPQ7TU/s1600/Screen+Shot+2013-05-20+at+11.19.30+PM.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-uZJFndM9ne8/UZqhozmAR_I/AAAAAAAAVGE/7w0oXyPQ7TU/s1600/Screen+Shot+2013-05-20+at+11.19.30+PM.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
OSX 10.8&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-BXZWmrrczac/UZ4bKS39s3I/AAAAAAAAVIs/7MprfX4uUKM/s1600/ubuntu_default.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-BXZWmrrczac/UZ4bKS39s3I/AAAAAAAAVIs/7MprfX4uUKM/s1600/ubuntu_default.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
Ubuntu 13.04&amp;nbsp;+ Gnome Shell&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
This is all nice and harmonious until I install my preferred browser, Google Chrome, on Ubuntu. Chrome places its window controls on the right as per the MS Windows layout.&amp;nbsp;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-aavbSUTVSYE/UZ4a4Bg3JUI/AAAAAAAAVIk/dB94jVpPTvU/s1600/chrome_default.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-aavbSUTVSYE/UZ4a4Bg3JUI/AAAAAAAAVIk/dB94jVpPTvU/s1600/chrome_default.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
Google Chrome&amp;nbsp;+ Ubuntu 13.04&amp;nbsp;+ Gnome Shell (Default)&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
To resolve this you can change the default configuration exposed by Chrome by entering the following command at the terminal:&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;/div&gt;
&lt;pre&gt;$ gconftool-2 --set /apps/metacity/general/button_layout --type string "close,minimize,maximize:"&lt;/pre&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;b style="color: #333333; font-family: Arial, serif; font-size: 14px; line-height: 22.390625px;"&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;span style="color: #333333; font-family: Arial, serif;"&gt;&lt;span style="font-size: 14px; line-height: 22.390625px;"&gt;To re-load the configuration you'll need to start a new desktop session (log out or restart). Once this is done your chrome window controls will fit in with the rest of your system.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br class="Apple-interchange-newline" /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-eveyjGoSuHY/UZ4cbaemy7I/AAAAAAAAVI8/tX5gCfJ88-o/s1600/Screenshot+from+2013-05-23+14:38:01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-eveyjGoSuHY/UZ4cbaemy7I/AAAAAAAAVI8/tX5gCfJ88-o/s1600/Screenshot+from+2013-05-23+14:38:01.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="text-align: center;"&gt;
Google Chrome&amp;nbsp;+ Ubuntu 13.04&amp;nbsp;+ Gnome Shell (Modified)&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: left;"&gt;
I know I'll want to do this again some time and am writing this here for my own reference, hopefully someone else finds it useful also.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/8777167322101752806/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2013/05/move-window-controls-to-left-in-chrome.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/8777167322101752806?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/8777167322101752806?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2013/05/move-window-controls-to-left-in-chrome.html" title="Move the window controls to the left in Chrome on Ubuntu" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-uZJFndM9ne8/UZqhozmAR_I/AAAAAAAAVGE/7w0oXyPQ7TU/s72-c/Screen+Shot+2013-05-20+at+11.19.30+PM.png" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;C0UNQHc4eip7ImA9WhBREU4.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-5607123349803912240</id><published>2013-03-01T05:30:00.000Z</published><updated>2013-03-01T09:48:11.932Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-03-01T09:48:11.932Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="OSX" /><category scheme="http://www.blogger.com/atom/ns#" term="Terminal" /><category scheme="http://www.blogger.com/atom/ns#" term="RAM" /><title>Discover how much memory is installed in OSX from the terminal</title><content type="html">&lt;p&gt;Today I was sitting SSHed into an OSX box and needed to know how much RAM was physically installed in the machine. Top of course told me how much RAM was in use however finding the installed RAM took me a few minutes longer than I would have liked.&lt;/p&gt;

&lt;p&gt;So this is a note to myself for next time, use the following:&lt;/p&gt;

&lt;pre&gt;trastle$ system_profiler |  grep -A 9 "BANK [0-9]/DIMM[0-9]"
        BANK 0/DIMM0:

          Size: 2 GB
          Type: DDR3
          Speed: 1333 MHz
          Status: OK
          Manufacturer: 0x80AD
          Part Number: 0x484D54333235533642465238432D48392020
          Serial Number: 0xDEADBEEF

        BANK 1/DIMM0:

          Size: 2 GB
          Type: DDR3
          Speed: 1333 MHz
          Status: OK
          Manufacturer: 0x80AD
          Part Number: 0x484D54333235533642465238432D48392020
          Serial Number: 0xDEADBEEF&lt;/pre&gt;

&lt;p&gt;Have fun!&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/5607123349803912240/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2013/03/discover-how-much-memory-is-installed.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/5607123349803912240?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/5607123349803912240?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2013/03/discover-how-much-memory-is-installed.html" title="Discover how much memory is installed in OSX from the terminal" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;D04DQHw7eCp7ImA9WhBSGU8.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-5791225442617814415</id><published>2013-02-27T00:44:00.000Z</published><updated>2013-02-27T00:46:11.200Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2013-02-27T00:46:11.200Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><category scheme="http://www.blogger.com/atom/ns#" term="Terminal" /><category scheme="http://www.blogger.com/atom/ns#" term="Raspian" /><category scheme="http://www.blogger.com/atom/ns#" term="WeatherStation" /><category scheme="http://www.blogger.com/atom/ns#" term="RaspberryPi" /><title>Raspberry Pi + Weather Station = A bit of fun</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
Over the past six months or so I have been working on a new release of the &lt;a href="http://wow.metoffice.gov.uk/" target="_blank"&gt;UK Met Office's WOW service&lt;/a&gt;. It's been a fun project so when my Dad's birthday rolled around earlier in the year I decided the best way to show him what I was working on was to give him a weather station and hook it up to WOW.&lt;br /&gt;
&lt;br /&gt;
In the end I bought him a &lt;a href="http://www.clasohlson.com/uk/Weather-Station/Pr363242000" target="_blank"&gt;USB weather station&lt;/a&gt; and a &lt;a href="http://www.raspberrypi.org/" target="_blank"&gt;Raspberry Pi&lt;/a&gt; and hooked the two together to upload data to the web. I have finally gotten around to writing up some instructions for the project and have posted them on github along with a couple of bash and udev files to make the process easier.&lt;br /&gt;
&lt;br /&gt;
For anyone who is interested in using a Raspberry Pi to upload data from their USB weather station the instructions are here: &lt;a href="http://trastle.github.com/rpi-weather/"&gt;http://trastle.github.com/rpi-weather/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://trastle.github.com/rpi-weather/" target="_blank"&gt;&lt;img border="0" height="195" src="https://lh3.ggpht.com/-DinDXoewmt0/US1WhiGc4oI/AAAAAAAATkk/yMJtan30TN4/s1600/Screen+Shot+2013-02-27+at+12.42.13+AM.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
Enjoy.&lt;/div&gt;
</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/5791225442617814415/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2013/02/over-past-six-months-or-so-i-have-been.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/5791225442617814415?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/5791225442617814415?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2013/02/over-past-six-months-or-so-i-have-been.html" title="Raspberry Pi + Weather Station = A bit of fun" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CkAFQ3c9cCp7ImA9WhNTF0k.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-1678461986000794569</id><published>2012-03-13T10:09:00.000Z</published><updated>2012-10-20T14:45:12.968+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-10-20T14:45:12.968+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="blogger" /><category scheme="http://www.blogger.com/atom/ns#" term="dynamic views" /><category scheme="http://www.blogger.com/atom/ns#" term="CSS" /><title>Hiding elements from Blogger's Dynamic View Template</title><content type="html">&lt;div&gt;I've been playing a little with Blogger's Dynamic Views template in the past week, so far it seems pretty neat for photo based content.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;

&lt;div&gt;One of the quirks of the new Dynamic Views is that, unlike standard Blogger templates, users cannot edit the HTML of the page. This is a pretty huge drawback but it is tempered by the fact that you can still &lt;a href="http://support.google.com/blogger/bin/answer.py?hl=en&amp;amp;answer=175740"&gt;modify the CSS using the template designer&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;

&lt;div&gt;In order to make the blog I was working on a little less cluttered I wanted to hide a number of elements on the page. This may be useful to others so I have itemised my changes below.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;
&lt;span style="font-style:italic"&gt;Hide the search box (from the top right):&lt;/span&gt;
&lt;pre&gt;/* Hide search */
.header-bar #search{ display: none !important; }&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;div&gt;
&lt;span style="font-style:italic"&gt;Hide the Google Chrome feedback link (from the bottom right):&lt;/span&gt;
&lt;pre&gt;/* Hide the google chrome feedback button */
a.feedback  { display: none !important; }&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;div&gt;
&lt;span style="font-style:italic"&gt;Hide the "Home" button (from the pages list):&lt;br /&gt;
Note: This assumes the home button is the first page in your list of pages.&lt;/span &gt;
&lt;pre&gt;/* Hide the home button */
#pages ul li:first-child  { display: none !important; }
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;div&gt;
&lt;span style="font-style:italic"&gt;Hide the "Sharing Controls" (Facebook, Twitter buttons etc):&lt;/span &gt;
&lt;pre&gt;/* Hide the sharing controls */ 
.share-controls { display: none !important; }
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;div&gt;
&lt;span style="font-style:italic"&gt;Hide the gadget dock (from the right hand side of the page):&lt;/span &gt;
&lt;pre&gt;/* Hide the gadget Dock */
#gadget-dock { display: none !important; }
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;div&gt;
&lt;span style="font-style:italic"&gt;Hide the views on the main page:&lt;/span &gt;
&lt;pre&gt;
/* Hide the views on the main page */
#views  { display: none !important; }
&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;div&gt;
&lt;span style="font-style:italic"&gt;Hide the dynamic view switcher:&lt;/span &gt;
&lt;pre&gt;/* Hide the views on the main page */
#views { display: none !important; }
/*Hide the vertical bar from before the first page link */
#pages::before { border-left-width: 0 !important;}&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div&gt;It is worth noting that these changes do not remove elements from the structure of the page (anyone reading the source of the page can still see the elements) but it does make the overall page a little cleaner.&lt;br /&gt; &lt;br /&gt;&lt;/div&gt;

&lt;div&gt;You can see the results of my changes &lt;a href="http://daily.troyastle.com/"&gt;here&lt;/a&gt; and &lt;a href="http://morboandlrrr.blogspot.com/"&gt;here&lt;/a&gt;.&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/1678461986000794569/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2012/03/hiding-elements-from-bloggers-dynamic.html#comment-form" title="40 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/1678461986000794569?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/1678461986000794569?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2012/03/hiding-elements-from-bloggers-dynamic.html" title="Hiding elements from Blogger's Dynamic View Template" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>40</thr:total></entry><entry gd:etag="W/&quot;DU8CSHk7fip7ImA9WhRbGEk.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-1743748287897125689</id><published>2012-02-10T04:24:00.000Z</published><updated>2012-02-10T04:24:29.706Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-10T04:24:29.706Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="bash" /><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><category scheme="http://www.blogger.com/atom/ns#" term="which" /><title>Bash function to show the linked locations of a binary</title><content type="html">The &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?which"&gt;which&lt;/a&gt; command on Linux will show you the location, from your &lt;a href="http://en.wikipedia.org/wiki/PATH_(variable)"&gt;PATH&lt;/a&gt;, that a binary will be executed from.&lt;br /&gt;
&lt;pre&gt;trastle@w500:~$ which javac
/usr/bin/javac&lt;/pre&gt;&lt;br /&gt;
This is very useful, however often you will find that the location in your PATH is actually a symbolic link to another location.&lt;br /&gt;
&lt;pre&gt;trastle@w500:~$ which java | xargs readlink $1
/etc/alternatives/java&lt;/pre&gt;&lt;br /&gt;
This in turn can be another symbolic link:&lt;br /&gt;
&lt;pre&gt;trastle@w500:~$ which java | xargs readlink $1 | xargs readlink $1
/opt/ibm/java/ibm-java2-i386-60/bin/java&lt;/pre&gt;&lt;br /&gt;
This means it can take a few commands to view all the links in play when a command is called. Oddly I find myself doing this quite often so I throw a small function in my .bashrc to help out:&lt;br /&gt;
&lt;pre&gt;function whichlink
{
  local loc=`/usr/bin/which $1`;
  echo "$loc"
  
  while [ -h "$loc" ]
  do
    loc=`/bin/readlink $loc`
    echo "--&gt; $loc"
  done
}&lt;/pre&gt;&lt;br /&gt;
The output is as follows:&lt;br /&gt;
&lt;pre&gt;trastle@w500:~$ whichlink javac
/usr/bin/javac
--&gt; /etc/alternatives/javac
--&gt; /opt/ibm/java/ibm-java2-i386-60/bin/java&lt;/pre&gt;&lt;br /&gt;
Alternately if you don't want to print all of the links along the way and just want to know the final destination the following is useful:&lt;br /&gt;
&lt;pre&gt;trastle@w500:~$ readlink -f `which javac`
/opt/ibm/java/ibm-java2-i386-60/bin/javac&lt;/pre&gt;&lt;br /&gt;
I am certain at some point I'll want to do this on another machine and text is more reliable than my long term memory. Enjoy.</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/1743748287897125689/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2012/02/bash-function-to-show-linked-locations.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/1743748287897125689?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/1743748287897125689?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2012/02/bash-function-to-show-linked-locations.html" title="Bash function to show the linked locations of a binary" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DUYNRng_cCp7ImA9WhRRFUo.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-7968138398705205154</id><published>2011-11-29T14:33:00.000Z</published><updated>2011-11-29T14:33:17.648Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-29T14:33:17.648Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><category scheme="http://www.blogger.com/atom/ns#" term="Terminal" /><category scheme="http://www.blogger.com/atom/ns#" term="rsync" /><title>Using --exclude-from in rsync</title><content type="html">I've been toying with some &lt;a href="http://en.wikipedia.org/wiki/Rsync"&gt;rsync&lt;/a&gt; scripts tonight and after reading the &lt;a href="http://www.samba.org/ftp/rsync/rsync.html"&gt;rsync man page&lt;/a&gt; I still needed a little trial and error to determine the exact behaviour of the &lt;tt&gt;--exclude-from&lt;/tt&gt; flag. &lt;br /&gt;
&lt;br /&gt;
The &lt;tt&gt;--exclude-from&lt;/tt&gt; flag specifies a file that contains exclude patterns (one per line). The rsync man page is VERY detailed on the subject of filters and how they can be used. &lt;br /&gt;
&lt;br /&gt;
Looking at a simplified version of my scenario, consider the following directory structure:&lt;br /&gt;
&lt;pre&gt;   Source
   |---.DS_Store
   |---Alpha
   |  |---.DS_Store
   |  |---Document 1.txt
   |  |---Document 2.txt
   |  `---Temporary Items
   |     |---.DS_Store
   |     |---TI1.tmp
   |     `---TI2.tmp
   |---Beta
   |  |---.DS_Store
   |  |---Document 3.txt
   |  |---Document 4.txt
   |  `---Temporary Items
   |     |---.DS_Store
   |     |---TI2.tmp
   |     `---TI4.tmp
   `---Temporary Items
      |---.DS_Store
      `---TI5.tmp
&lt;/pre&gt;I want backup the Source directory shown above and exclude the following from my backup:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;All of the ".DS_Store" files.&lt;/li&gt;
&lt;li&gt;All of the "Temporary Items" directories.&lt;/li&gt;
&lt;li&gt;All files contained in the "Temporary Items" directories.&lt;/li&gt;
&lt;/ol&gt;My final backup will look like this:&lt;br /&gt;
&lt;pre&gt;   Destination
   |---Alpha
   |  |---Document 1.txt
   |  `---Document 2.txt
   `---Beta
      |---Document 3.txt
      `---Document 4.txt
&lt;/pre&gt;&lt;br /&gt;
Making this happen is very simple. The exclusions file (skip.txt) only needs to contain the following two lines:&lt;br /&gt;
&lt;pre&gt;Temporary Items
.DS_Store
&lt;/pre&gt;The rsync command to perform the backup is as follows:&lt;br /&gt;
&lt;pre&gt;rsync -az  --exclude-from=./skip.txt ./Source/ ./Destination/&lt;/pre&gt;The output of this command is the "Destination" directory shown above.&lt;br /&gt;
&lt;br /&gt;
There were two things that caused me greif getting my script to work:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;To exclude a file (or directory) with spaces in the name, the names &lt;strong&gt;DO NOT&lt;/strong&gt; need to be quoted or escaped.&lt;/li&gt;
&lt;li&gt;To exclude all files underneath a directory you need only exclude the directory itself.&lt;/li&gt;
&lt;/ol&gt;Now that this is committed to my long term memory I can move on.</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/7968138398705205154/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2011/11/using-exclude-from-in-rsync.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/7968138398705205154?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/7968138398705205154?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2011/11/using-exclude-from-in-rsync.html" title="Using --exclude-from in rsync" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>1</thr:total></entry><entry gd:etag="W/&quot;CUcHQHw4fCp7ImA9WhRSGEg.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-1034477244577359697</id><published>2011-11-21T05:23:00.001Z</published><updated>2011-11-21T05:23:51.234Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-21T05:23:51.234Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="Terminal" /><category scheme="http://www.blogger.com/atom/ns#" term="ISO8859-1" /><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu" /><title>Fixing unmappable character during Java compilation on Ubuntu</title><content type="html">In the lab we have a standard header at the top of our source files, a copyright statement and licence. This header contains an &lt;a href="http://en.wikipedia.org/wiki/ISO/IEC_8859-1"&gt;ISO 8859-1&lt;/a&gt; encoded copyright character (©).&lt;br /&gt;
&lt;br /&gt;
Normally the header blurs into the background, the exception to this rule is the first time a do a build on a new Ubuntu system and I see the following error: &lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;[javac] /src/com/yourcorp/HelloWorld.java:8: unmappable character for encoding ASCII
[jacac] /* ?? Copyright Yourcorp 2011&lt;/pre&gt;&lt;br /&gt;
The Java compiler is expecting ASCII characters rather than ISO 8859-1. To resolve this error I do the following:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Edit &lt;b&gt;/var/lib/locales/supported.d/local&lt;/b&gt; and add:&lt;br /&gt;
&lt;pre&gt;en_AU ISO-8859-1
en_US ISO-8859-1

&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Open a terminal and run:&lt;br /&gt;
&lt;pre&gt;$ sudo dpkg-reconfigure locales

&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Edit &lt;b&gt;/etc/environment&lt;/b&gt; and add:&lt;br /&gt;
&lt;pre&gt;LANG="EN_US"

&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Reboot.&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;With Ubuntu being so stable these days it's a long time between re-installs so I have posted this here for next time when I forget.</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/1034477244577359697/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2011/11/fixing-unmappable-character-during-java.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/1034477244577359697?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/1034477244577359697?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2011/11/fixing-unmappable-character-during-java.html" title="Fixing unmappable character during Java compilation on Ubuntu" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;A0AMQXs5eyp7ImA9WhZaGU0.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-2130645095502720036</id><published>2011-06-26T08:54:00.074+01:00</published><updated>2011-07-06T00:49:40.523+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-06T00:49:40.523+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="sudo" /><category scheme="http://www.blogger.com/atom/ns#" term="Terminal" /><category scheme="http://www.blogger.com/atom/ns#" term="dbus" /><category scheme="http://www.blogger.com/atom/ns#" term="gnome-screensaver" /><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu" /><title>Run scripts when gnome-screensaver starts or stops in Ubuntu</title><content type="html">For a project I have been playing with I need to be able to run a script when gnome-screensaver starts or stops on Ubuntu (10.04). &lt;br /&gt;
&lt;br /&gt;
The gnome-screensaver &lt;a href="http://live.gnome.org/GnomeScreensaver/FrequentlyAskedQuestions"&gt;FAQ&lt;/a&gt; provides detail on the dbus signal fired when gnome-screensaver activates and deactivates. The FAQ even has sample perl code to respond to the signal. Unfortunately the sample code polls dbus-monitor which is too inefficient for script I plan to run in the background on my laptop.&lt;br /&gt;
&lt;br /&gt;
Python offers a great &lt;a href="http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html"&gt;dbus library&lt;/a&gt; which allows signal receivers to be registered with dbus resulting in an efficient event listener.&lt;br /&gt;
&lt;br /&gt;
On to the script.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step 1: Setup the required files and directories&lt;/strong&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Make a directory for your work:&lt;br /&gt;
&lt;pre&gt;sudo mkdir -p /opt/ssTrigger&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Change yourself the owner of the new directory:&lt;br /&gt;
&lt;pre&gt;sudo chown `whoami`:`whoami` /opt/ssTrigger&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Create stubs for the scripts to be used&lt;br /&gt;
&lt;pre&gt;touch /opt/ssTrigger/ssTrigger /opt/ssTrigger/ssStart /opt/ssTrigger/ssStop&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Make the stub scripts executable:&lt;br /&gt;
&lt;pre&gt;chmod 755 /opt/ssTrigger/*&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;strong&gt;Step 2: Edit the ssTrigger script&lt;/strong&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Open the ssTriger file created earlier:&lt;br /&gt;
&lt;pre&gt;gedit /opt/ssTrigger/ssTrigger&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Add the following to ssTrigger:&lt;br /&gt;
&lt;pre&gt;#!/usr/bin/env python
from gobject import MainLoop
from dbus import SessionBus
from dbus.mainloop.glib import DBusGMainLoop
from subprocess import Popen

class SSTrigger:
    def __init__(self):
        DBusGMainLoop(set_as_default=True)
        self.mem='ActiveChanged'
        self.dest='org.gnome.ScreenSaver'
        self.bus=SessionBus()
        self.loop=MainLoop()
        self.bus.add_signal_receiver(self.catch,self.mem,self.dest)
    def catch(self,ssOn):
        if ssOn == 1: #Screensaver turned on
            Popen(["/opt/ssTrigger/ssStart"])
        else: #Screensaver turned off
            Popen(["/opt/ssTrigger/ssStop"])

SSTrigger().loop.run()
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Save and close the file.&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;strong&gt;Step 3: Set ssTrigger to start when you login:&lt;/strong&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Open the Startup Applications menu:&lt;br /&gt;
System -&gt; Preferences -&gt; Startup Applications&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Click "Add" to create a new startup application.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Enter the following details:&lt;br /&gt;
Name: Screensaver Trigger Script&lt;br /&gt;
Command: /opt/ssTrigger/ssTrigger&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Click "Add" to save your new application.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Restart your computer.&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;strong&gt;Finishing up:&lt;/strong&gt;&lt;br /&gt;
Once you have restarted you can run:&lt;br /&gt;
&lt;pre&gt;ps aux | grep ssTrigger&lt;/pre&gt;Check the output to make sure the ssTrigger script has started at login.&lt;br /&gt;
&lt;br /&gt;
Edit the &lt;strong&gt;ssStart&lt;/strong&gt; and &lt;strong&gt;ssStop&lt;/strong&gt; scripts to run commands as gnome-screensaver starts and stops respectively.</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/2130645095502720036/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2011/06/run-scripts-when-gnome-screensaver.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/2130645095502720036?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/2130645095502720036?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2011/06/run-scripts-when-gnome-screensaver.html" title="Run scripts when gnome-screensaver starts or stops in Ubuntu" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>3</thr:total></entry><entry gd:etag="W/&quot;DE8BSXc_fip7ImA9WhRQEU8.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-2337439753586412182</id><published>2011-06-24T14:39:00.011+01:00</published><updated>2011-12-05T23:14:18.946Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-05T23:14:18.946Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><category scheme="http://www.blogger.com/atom/ns#" term="apt-get" /><category scheme="http://www.blogger.com/atom/ns#" term="Natty" /><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu" /><category scheme="http://www.blogger.com/atom/ns#" term="Firefox" /><title>Downgrade to Firefox 3.6 on Ubuntu 11.04 Natty</title><content type="html">We have a requirement in the office to downgrade to Firefox 3.6 on some test machines running Ubuntu Natty (11.04). To do this you can pin the firefox and firefox-branding packages to older packages from the Ubuntu Maverick (10.10) release.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Step 1: Edit your software sources to add Maverick&lt;/strong&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Open your sources.list file:&lt;br /&gt;
&lt;pre&gt;sudo gedit /etc/apt/sources.list&lt;/pre&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Add the folowing three lines:&lt;br /&gt;
&lt;pre&gt;# Maverick, used for firefox and firefox-branding 
deb http://ftp.iinet.net.au/pub/ubuntu/ maverick main 
deb http://ftp.iinet.net.au/pub/ubuntu/ maverick-updates main&lt;/pre&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Save and close the file&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;strong&gt;Step 2: Pin the packages firefox and firefox-branding&lt;/strong&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Create the pin file for firefox:&lt;br /&gt;
&lt;pre&gt;sudo gedit /etc/apt/preferences.d/firefox&lt;/pre&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Add the following:&lt;br /&gt;
&lt;pre&gt;Package: firefox
Pin: release n=natty
Pin-Priority: -10

Package: firefox
Pin: release n=maverick
Pin-Priority: 900&lt;/pre&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Save and close the file.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Create the pin file for firefox-branding:&lt;br /&gt;
&lt;pre&gt;sudo gedit /etc/apt/preferences.d/firefox-branding&lt;/pre&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Add the following:&lt;br /&gt;
&lt;pre&gt;Package: firefox-branding
Pin: release n=natty
Pin-Priority: -10

Package: firefox-branding
Pin: release n=maverick
Pin-Priority: 900&lt;/pre&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Save and close the file.&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;strong&gt;Step 3: Check your apt policy to make sure it worked&lt;/strong&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Update your apt cache:&lt;br /&gt;
&lt;pre&gt;sudo apt-get update&lt;/pre&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Show the apt policy for firefox:&lt;br /&gt;
&lt;pre&gt;sudo apt-cache policy firefox&lt;/pre&gt;&lt;br /&gt;
Sample output:&lt;br /&gt;
&lt;pre&gt;sudo apt-cache policy firefox
firefox:
  Installed: 5.0+build1+nobinonly-0ubuntu0.11.04.2
  Candidate: 3.6.18+build2+nobinonly-0ubuntu0.10.10.1
  Package pin: 3.6.18+build2+nobinonly-0ubuntu0.10.10.1
  Version table:
 *** 5.0+build1+nobinonly-0ubuntu0.11.04.2 900
        500 http://ftp.iinet.net.au/pub/ubuntu/ natty-updates/main i386 Packages
        500 http://ftp.iinet.net.au/pub/ubuntu/ natty-security/main i386 Packages
        100 /var/lib/dpkg/status
     4.0+nobinonly-0ubuntu3 900
        500 http://ftp.iinet.net.au/pub/ubuntu/ natty/main i386 Packages
     3.6.18+build2+nobinonly-0ubuntu0.10.10.1 900
        500 http://ftp.iinet.net.au/pub/ubuntu/ maverick-updates/main i386 Packages
     3.6.10+build1+nobinonly-0ubuntu3 900
        500 http://ftp.iinet.net.au/pub/ubuntu/ maverick/main i386 Packages&lt;/pre&gt;&lt;br /&gt;
The line you are most interested in is "Candidate".&lt;br /&gt;
This indicates the package that apt ranks as the installation candidate.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Repeat this check for firefox-branding&lt;br /&gt;
&lt;pre&gt;sudo apt-cache policy firefox-branding&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;strong&gt;Step 4: Install firefox 3.6&lt;/strong&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Remove firefox 5.x:&lt;br /&gt;
&lt;pre&gt;sudo apt-get remove firefox&lt;/pre&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Install firefox 3.6:&lt;br /&gt;
&lt;pre&gt;sudo apt-get install firefox&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
And you're done. Enjoy your outdated version of Firefox!&lt;br /&gt;
&lt;br /&gt;
&lt;hr&gt;&lt;strong&gt;Update - July 24th 2011:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
How to reverse the process:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Remove these three (3) lines you added to /etc/apt/sources.list&lt;br /&gt;
&lt;pre&gt;# Maverick, used for firefox and firefox-branding 
deb http://ftp.iinet.net.au/pub/ubuntu/ maverick main 
deb http://ftp.iinet.net.au/pub/ubuntu/ maverick-updates main
&lt;/pre&gt;&lt;/li&gt;

&lt;li&gt;Unpin the firefox and firefox-branding packages:&lt;br /&gt;
&lt;pre&gt;sudo rm /etc/apt/preferences.d/firefox
sudo rm /etc/apt/preferences.d/firefox-branding
&lt;/pre&gt;&lt;/li&gt;

&lt;li&gt;Update your apt cache&lt;br /&gt;
&lt;pre&gt;sudo apt-get update
&lt;/pre&gt;&lt;/li&gt;

&lt;li&gt;Install the latest Firefox:&lt;br /&gt;
&lt;pre&gt;sudo apt-get upgrade
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Close ALL your Firefox windows and re-open Firefox.&lt;br /&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;hr&gt;&lt;strong&gt;Update - December 6th 2011:&lt;/strong&gt;&lt;br /&gt;
&lt;p&gt;From the comments people have posted below I can see that this process works to downgrade Firefox on Ubuntu 11.10 as well as Ubuntu 10.04.&lt;/p&gt;&lt;p&gt;Downgrading packages to the Ubuntu 10.10 release will only work on Ubuntu 11.04 or better. Do not use this procedure on Ubuntu releases older than 11.04. If you try to do this you will be upgrading packages not downgrading.&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/2337439753586412182/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2011/06/downgrade-to-firefox-36-on-ubuntu-natty.html#comment-form" title="21 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/2337439753586412182?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/2337439753586412182?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2011/06/downgrade-to-firefox-36-on-ubuntu-natty.html" title="Downgrade to Firefox 3.6 on Ubuntu 11.04 Natty" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>21</thr:total></entry><entry gd:etag="W/&quot;DE4ASX8-fCp7ImA9WhZXE0w.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-4292143438470636159</id><published>2011-04-29T08:50:00.008+01:00</published><updated>2011-05-02T07:15:48.154+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-02T07:15:48.154+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="lock-input" /><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu" /><category scheme="http://www.blogger.com/atom/ns#" term="clearlock" /><title>Lock input without a screen saver in Linux</title><content type="html">We came across this problem in the office today. How do we lock the input devices on a Linux machine (we were using Ubuntu 11.04) and keep a the current applications showing and updating? The solution we ended up with was to use xlock.&lt;br /&gt;
&lt;br /&gt;
First you'll need to install xlock: &lt;br /&gt;
&lt;pre&gt;sudo apt-get install xlockmore&lt;/pre&gt;Then run xlock from a terminal with the following options: &lt;br /&gt;
&lt;pre&gt;xlock -mode blank -geometry 0x0 -timeout 2&lt;/pre&gt;&lt;br /&gt;
The xlock command locks keyboard and mouse input, the flags do the following:&lt;br /&gt;
&lt;tt style="color: #993300;"&gt;-mode blank&lt;/tt&gt;  displays a blank box in the top left corner of your monitor.&lt;br /&gt;
&lt;tt style="color: #993300;"&gt;-geometry 0x0&lt;/tt&gt;  makes the size of the blank box 0x0 pixels.&lt;br /&gt;
&lt;tt style="color: #993300;"&gt;-timeout 2&lt;/tt&gt;  sets the timeout (in seconds) for the password prompt if anyone hits a key.&lt;br /&gt;
&lt;br /&gt;
Update 2011-05-02: A second (better) solution&lt;br /&gt;
&lt;br /&gt;
First you'll need to install xtrlock: &lt;br /&gt;
&lt;pre&gt;sudo apt-get install xtrlock&lt;/pre&gt;Then run xtrlock from a terminal: &lt;br /&gt;
&lt;pre&gt;xtrlock&lt;/pre&gt;&lt;br /&gt;
This will start xtrlock and lock the screen. To unlock the screen type your password and hit enter.</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/4292143438470636159/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2011/04/lock-input-without-screen-saver-in.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/4292143438470636159?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/4292143438470636159?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2011/04/lock-input-without-screen-saver-in.html" title="Lock input without a screen saver in Linux" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;DkUERH87eip7ImA9Wx5UEU0.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-5346475255008513882</id><published>2010-10-15T01:56:00.000+01:00</published><updated>2010-10-15T01:56:45.102+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-10-15T01:56:45.102+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><category scheme="http://www.blogger.com/atom/ns#" term="Terminal" /><category scheme="http://www.blogger.com/atom/ns#" term="do-release-upgrade" /><category scheme="http://www.blogger.com/atom/ns#" term="Maverick" /><category scheme="http://www.blogger.com/atom/ns#" term="Lucid" /><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu" /><title>Upgrading from Lucid to Maverick using a local mirror</title><content type="html">I maintain a local Ubuntu mirror in our Lab at work. This morning the first user tried to update from Lucid to Maverick. There was a couple of teething issues but with a couple of changes it went off without a hitch. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1: Correctly specify your mirror to the Software Sources dialog:&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Open a terminal&lt;br&gt;&lt;br /&gt;
(Applications -&amp;gt; Accessories -&amp;gt; Terminal)&lt;/li&gt;
&lt;li&gt;Open your list of mirrors:&lt;br&gt;&lt;pre&gt;trastle$ sudo gedit /usr/share/python-apt/templates/Ubuntu.mirrors&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Add a location for your local mirror. Mine looks like this:&lt;br&gt;&lt;pre&gt;...
#LOC:ADL
http://adl-mirror/ubuntu-repo/ubuntu/
...&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Save and close the file.&lt;/li&gt;
&lt;li&gt;Close the terminal.&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;b&gt;Step 2: Select your mirror in the software sources dialog&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Open the software sources dialog&lt;br&gt;(System -&amp;gt; Administration -&amp;gt; Software Sources)&lt;/li&gt;
&lt;li&gt;Open the "&lt;b&gt;Ubuntu Software&lt;/b&gt;" tab&lt;/li&gt;
&lt;li&gt;Click the "&lt;b&gt;Download From:&lt;/b&gt;" combo box.&lt;/li&gt;
&lt;li&gt;Select "&lt;b&gt;Other...&lt;/b&gt;"&lt;/li&gt;
&lt;li&gt;Select the mirror you just added from the list&lt;/li&gt;
&lt;li&gt;Click "&lt;b&gt;Choose Server&lt;/b&gt;" at the bottom right.&lt;/li&gt;
&lt;li&gt;Click "&lt;b&gt;Close&lt;/b&gt;" at the bottom right.&lt;/li&gt;
&lt;li&gt;Click "&lt;b&gt;Close&lt;/b&gt;" in the information out of date dialog that pops up.&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;b&gt;Step 3: Disable all third party sources&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Open the software sources dialog&lt;br&gt;(System -&amp;gt; Administration -&amp;gt; Software Sources)&lt;/li&gt;
&lt;li&gt;Open the "&lt;b&gt;Other Software&lt;/b&gt;" tab&lt;/li&gt;
&lt;li&gt;Untick every source in the list.&lt;/li&gt;
&lt;li&gt;Click "&lt;b&gt;Close&lt;/b&gt;" at the bottom right.&lt;/li&gt;
&lt;li&gt;Click "&lt;b&gt;Close&lt;/b&gt;" in the information out of date dialog that pops up.&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;b&gt;Step 4: Do the Upgrade&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Ensure your on a network with Internet access as well as access to your mirror.&lt;/li&gt;
&lt;li&gt;Open a terminal&lt;br&gt;(Applications -&amp;gt; Accessories -&amp;gt; Terminal)&lt;/li&gt;
&lt;li&gt;Change to the root user:&lt;br&gt;&lt;pre&gt;trastle$ sudo -i&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Update your available software:&lt;br&gt;&lt;pre&gt;root# apt-get update &lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Do the upgrade&lt;br&gt;&lt;pre&gt;root# do-release-upgrade &lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;The following message will appear shortly after starting the upgrade:&lt;br&gt;&lt;pre&gt;Updating repository information
WARNING: Failed to read mirror file

No valid mirror found 

While scanning your repository information no mirror entry for the 
upgrade was found. This can happen if you run a internal mirror or if 
the mirror information is out of date. 

Do you want to rewrite your 'sources.list' file anyway? If you choose 
'Yes' here it will update all 'lucid' to 'maverick' entries. 
If you select 'No' the upgrade will cancel.&lt;/pre&gt;Your using a local mirror so choose &lt;b&gt;Yes&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;The release upgrade will take some time to complete.&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;b&gt;Step 5: Re-enable third party sources&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Open the software sources dialog&lt;br&gt;(System -&amp;gt; Administration -&amp;gt; Software Sources)&lt;/li&gt;
&lt;li&gt;Open the "&lt;b&gt;Other Software&lt;/b&gt;" tab&lt;/li&gt;
&lt;li&gt;Tick the sources you want to use.&lt;/li&gt;
&lt;li&gt;Click "&lt;b&gt;Close&lt;/b&gt;" at the bottom right.&lt;/li&gt;
&lt;li&gt;Click "&lt;b&gt;Reload&lt;/b&gt;" in the information out of date dialog that pops up.&lt;/li&gt;
&lt;/ol&gt;Enjoy your upgraded system.&lt;br /&gt;
I hope someone finds this helpful.</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/5346475255008513882/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2010/10/upgrading-from-lucid-to-maverick-using.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/5346475255008513882?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/5346475255008513882?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2010/10/upgrading-from-lucid-to-maverick-using.html" title="Upgrading from Lucid to Maverick using a local mirror" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CUQMR34yfyp7ImA9WxFaGE0.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-1216204960969648867</id><published>2010-07-22T13:51:00.002+01:00</published><updated>2010-07-22T13:56:26.097+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-22T13:56:26.097+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="QEMU" /><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><category scheme="http://www.blogger.com/atom/ns#" term="Terminal" /><category scheme="http://www.blogger.com/atom/ns#" term="Debian" /><category scheme="http://www.blogger.com/atom/ns#" term="Lucid" /><title>Building a ARM powered Debian VM with QEMU on Ubuntu Lucid</title><content type="html">I have recently spent some time trying to get an emulated ARM machine up and running on an x86 Ubuntu Lucid host. Initially I wanted Ubuntu for the client OS but I found that the only ARM installers available were for the Ubuntu Netbook Edition, which does not suit my needs at this point. So I went with Debian Lenny (the current &lt;a href="http://www.debian.org/releases/stable/"&gt;Debian stable&lt;/a&gt; release) which has a myriad of ARM installers available.&lt;br /&gt;
&lt;br /&gt;
When tracking down info about the Debian ARM port you'll quickly discover that there are two ports available &lt;a href="http://wiki.debian.org/ArmPort"&gt;ARM&lt;/a&gt; and &lt;a href="http://wiki.debian.org/ArmEabiPort"&gt;ARMEL&lt;/a&gt;. ARM is the original port (now&amp;nbsp;deprecated)&amp;nbsp;and ARMEL is name of the newer code stream which supports &lt;a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.subset.swdev.abi/index.html"&gt;ARM EABI&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
The emulation software I am using is &lt;a href="http://wiki.qemu.org/Main_Page"&gt;QEMU&lt;/a&gt;. An open-source project started by &lt;a href="http://en.wikipedia.org/wiki/Fabrice_Bellard"&gt;Fabrice Bellard&lt;/a&gt; (who also founded the &lt;a href="http://ffmpeg.org/"&gt;ffmpeg&lt;/a&gt; project!). QEMU is fairly&amp;nbsp;versatile&amp;nbsp;and will emulate a myriad of CPU architectures including ARM, Sparc, PPC and even s390 (under KVM).&lt;br /&gt;
&lt;br /&gt;
The Ubuntu Lucid&amp;nbsp;repositories do contain packages for QEMU. However after installing via apt-get I found the binary failed out with a segmentation fault almost immediately. Not to worry the QEMU build system is easy to master.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Part 1: Building and installing QEMU:&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Download the QEMU source (0.12.4, the current release, is available &lt;a href="http://download.savannah.gnu.org/releases/qemu/qemu-0.12.4.tar.gz"&gt;here&lt;/a&gt;):&lt;br /&gt;
&lt;pre&gt;trastle$ wget http://download.savannah.gnu.org/releases/qemu/qemu-0.12.4.tar.gz&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Unpack the tar ball:&lt;br /&gt;
&lt;pre&gt;trastle$ tar -xvvf qemu-0.12.4.tar.gz&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Install the required packages to build QEMU:&lt;br /&gt;
&lt;pre&gt;trastle$ sudo apt-get build-dep qemu&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Build and install QEMU:&lt;br /&gt;
&lt;pre&gt;trastle$ cd qemu-0.12.4
trastle$ ./configure
trastle$ make
trastle$ sudo make install&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;b&gt;Part 2: Install Debian Lenny in QEMU:&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Change to the directory you want to build your VM in:&lt;br /&gt;
&lt;pre&gt;trastle$ mkdir ~/arm
trastle$ cd ~/arm&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Download the current build of the Debian Lenny ARMEL kernel (vmlinuz) and installer (initrd) images from a local Debian mirror:&lt;br /&gt;
&lt;pre&gt;trastle$ wget ftp://ftp.au.debian.org/debian/dists/lenny/main/installer-armel
         /current/images/versatile/netboot/vmlinuz-2.6.26-2-versatile
trastle$ wget ftp://ftp.au.debian.org/debian/dists/lenny/main/installer-armel
         /current/images/versatile/netboot/initrd.gz&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Create a disk image for QEMU (more details on &lt;a href="http://wiki.qemu.org/download/qemu-doc.html#qemu_005fimg_005finvocation"&gt;qemu-img&lt;/a&gt;).&lt;br /&gt;
Importantly, the raw format will allow you to mount the image from Ubuntu once its populated:&lt;br /&gt;
&lt;pre&gt;trastle$ qemu-img create -f raw armdisk.img 8G&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Start the Debian install with QEMU:&lt;br /&gt;
&lt;pre&gt;trastle$ qemu-system-arm -m 256 -M versatilepb \
         -kernel ~/arm/vmlinuz-2.6.26-2-versatile \
         -initrd ~/arm/initrd.gz \
         -hda ~/arm/armdisk.img -append "root=/dev/ram"&lt;/pre&gt;QEMU will open a terminal window and within that window the Lenny installer will kick into action. Follow the installer's directions and allow the install to begin. Installation will be slower than normal. Allow 4 or 5 hours for it to complete.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;As the install completes you'll be informed no boot loader is present, don't worry QEMU takes the place of the boot loader. Once the install completes the VM will reboot kicking off the installer again, don't proceed, just kill QEMU.&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
&lt;b&gt;Part 3: Running your ARM Lenny install in QEMU:&lt;/b&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Once the installation is complete you will need to copy the initrd from the installed system. To do this you must &lt;a href=http://en.wikibooks.org/wiki/QEMU/Images#Mounting_an_image_on_the_host"&gt;mount the QEMU disk image&lt;/a&gt;.&lt;br /&gt;
&lt;pre&gt;trastle$ mkdir ~/arm/mount/
trastle$ sudo mount -o loop,offset=32256 ~/arm/armdisk.img ~/arm/mount
trastle$ cp ~/arm/mount/boot/initrd.img-2.6.26-2-versatile ~/arm/.
trastle$ sudo umount ~/arm/mount
&lt;/pre&gt;32256 is not just a random number, it's the sector where the first disk partition begins.&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Boot your Debian Lenny VM:&lt;br /&gt;
&lt;pre&gt;trastle$ qemu-system-arm -m 256 -M versatilepb \
         -kernel ~/arm/vmlinuz-2.6.26-2-versatile \
         -initrd ~/arm/initrd.img-2.6.26-2-versatile \
         -hda ~/arm/armdisk.img -append "root=/dev/sda1"&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;Now you have a running ARM VM to do with as you please.</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/1216204960969648867/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2010/07/building-arm-powered-debian-vm-with.html#comment-form" title="14 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/1216204960969648867?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/1216204960969648867?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2010/07/building-arm-powered-debian-vm-with.html" title="Building a ARM powered Debian VM with QEMU on Ubuntu Lucid" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>14</thr:total></entry><entry gd:etag="W/&quot;A0EFR384fip7ImA9WhZSGEU.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-3329206384813238271</id><published>2010-06-21T11:43:00.004+01:00</published><updated>2011-04-04T05:00:16.136+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-04T05:00:16.136+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><category scheme="http://www.blogger.com/atom/ns#" term="Terminal" /><category scheme="http://www.blogger.com/atom/ns#" term="Grub" /><category scheme="http://www.blogger.com/atom/ns#" term="Lucid" /><title>Boot to single user mode in Ubuntu 10.04 Lucid Lynx</title><content type="html">This is symptomatic of how often I break X.org but I often need to boot my Ubuntu 10.04 machine into single user mode and fix some configuration file before rebooting into the GUI. I forget how to do it every time so here is how:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Hold the &lt;b&gt;Shift&lt;/b&gt; key at boot to display the Grub boot menu.&lt;/li&gt;
&lt;li&gt;Select the top Grub entry, it will be similar to: &lt;pre&gt;Ubuntu, with Linux 2.6.32-22-generic-pae&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Hit &lt;b&gt;e&lt;/b&gt; to edit the the Grub entry.&lt;/li&gt;
&lt;li&gt;Find the line that looks like this: &lt;pre&gt;linux /boot/vmlinuz-2.6.32-22-generic-pae
root=UUID=xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx
ro vga=794 quiet splash&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Change the line to: &lt;pre&gt;linux /boot/vmlinuz-2.6.32-22-generic-pae
root=UUID=xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx
init=/bin/bash rw&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Hit &lt;b&gt;crtl&lt;/b&gt;+&lt;b&gt;x&lt;/b&gt; to boot&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
Your machine will now do a one time boot into single user mode. Once you reboot the changes you just made to Grub will be reverted.&lt;br /&gt;
&lt;br /&gt;
** /bin/sh corrected to /bin/bash thanks Hola2040.</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/3329206384813238271/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2010/06/boot-to-single-user-mode-in-ubuntu-1004.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/3329206384813238271?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/3329206384813238271?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2010/06/boot-to-single-user-mode-in-ubuntu-1004.html" title="Boot to single user mode in Ubuntu 10.04 Lucid Lynx" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>6</thr:total></entry><entry gd:etag="W/&quot;AkEEQ3w_eCp7ImA9WxFaFk8.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-6469544065177815413</id><published>2010-06-20T07:34:00.003+01:00</published><updated>2010-07-20T13:23:22.240+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-20T13:23:22.240+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="DroboApps" /><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><category scheme="http://www.blogger.com/atom/ns#" term="DroboFS" /><category scheme="http://www.blogger.com/atom/ns#" term="BusyBox" /><category scheme="http://www.blogger.com/atom/ns#" term="cron" /><title>Activate the cron daemon on a DroboFS</title><content type="html">I recently purchased a &lt;a href="http://www.drobo.com/products/drobo-fs.php"&gt;DroboFS&lt;/a&gt;&amp;nbsp;NAS from &lt;a href="http://www.drobo.com/"&gt;DataRobotics&lt;/a&gt;. The device runs a minimal Marvell&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Linux"&gt;Linux&lt;/a&gt; OS on top of a low power &lt;a href="http://en.wikipedia.org/wiki/ARM_architecture"&gt;ARM&lt;/a&gt; CPU (&lt;a href="http://www.arm.com/products/processors/classic/arm9/arm926.php"&gt;ARM926EJ-S&lt;/a&gt;).&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;The DroboFS supports third party development through the &lt;a href="http://www.drobo.com/droboapps/apps-for-drobofs.php"&gt;DroboApps&lt;/a&gt; platform. This allows end users to compile ARM applications using the GNU tool chain and run them on their DroboFS. On top of this these applications can be run as services using a small service API provided by DroboApps.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;A number of DroboApps are available to enable dormant services on the DroboFS including the SSH, HTTP and FTP servers.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;The DroboFS ships with a &lt;a href="http://en.wikipedia.org/wiki/Cron"&gt;cron&lt;/a&gt; daemon tucked away at /usr/sbin/crond however there is no DroboApp available to enable the daemon. To rectify this I have written a small DroboApp script to activate the cron daemon at boot.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;To get cron running as a service you'll need to do the following:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Enable DroboApps on your DroboFS.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Install the Dropbear SSH DroboApp.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;SSH into your DroboFS&lt;/li&gt;
&lt;li&gt;Create a directory for the cron DroboApp:&lt;br /&gt;
&lt;pre&gt;mkdir /mnt/DroboFS/Shares/DroboApps/crond&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Save the following service.sh into your cron DroboApp directory &lt;br /&gt;
&lt;pre&gt;#!/bin/sh
# ------------------------------------------------------------
# service.sh for cron DroboApp
#
# Exposes the crond binary existing on the DroboFS as a 
# DroboApps service.
# ------------------------------------------------------------

# Binaries used
AWK="/usr/bin/awk"
GREP="/bin/grep"
CROND="/usr/sbin/crond"
DATE="/bin/date +%Y:%m:%d-%H:%M:%S" # Nicely formatted date
ECHO="/bin/echo"
PS="/bin/ps"

# Load the DroboApps service functions
. /etc/service.subr

# Required DroboApps variables
prog_dir=`dirname \`realpath $0\``
name="crond"                    # service name
version="1.14.2"                # program version
pidfile=${prog_dir}/crond.pid # location of pid file
logfile=${prog_dir}/crond.log # location of log file

# Start crond
start()
{
  # Start the service
  $CROND

  # Create the pidfile
  pid=`$PS | $GREP $CROND | $GREP -v grep | $AWK '{print $1}'`
  $ECHO $pid &amp;gt; $pidfile
}

case "$1" in
  start)
    start_service
    $ECHO "`$DATE` Started cron service" &amp;gt;&amp;gt; $logfile    
    ;;
  stop)
    stop_service
    $ECHO "`$DATE` Stopped cron service" &amp;gt;&amp;gt; $logfile    
    ;;
  restart)
    stop_service
    sleep 3
    start_service
    $ECHO "`$DATE` Restarted cron service" &amp;gt;&amp;gt; $logfile    
    ;;
  status)
    status
    ;;
  *)
    $ECHO "Usage: $0 [start|stop|restart|status]"
    exit 1
    ;;
esac
&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Restart your DroboFS.&lt;/li&gt;
&lt;/ol&gt;&lt;div&gt;Now the cron daemon is running from boot on your DroboFS. To add tasks for the cron daemon to run you will need to SSH into your DroboFS and run the following: &lt;br /&gt;
&lt;pre&gt;mkdir -p /var/spool/cron/crontabs
crontab -e&lt;/pre&gt;I hope someone finds this helpful.&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
2010-06-24: Edit added "mkdir -p /var/spool/cron/crontabs" Thanks pimvanderzwet</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/6469544065177815413/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2010/06/activate-cron-daemon-on-drobofs.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/6469544065177815413?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/6469544065177815413?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2010/06/activate-cron-daemon-on-drobofs.html" title="Activate the cron daemon on a DroboFS" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>4</thr:total></entry><entry gd:etag="W/&quot;DUcDQHo_cCp7ImA9WxFbGEw.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-6277109204980305536</id><published>2010-05-09T05:07:00.006+01:00</published><updated>2010-07-11T03:57:51.448+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-11T03:57:51.448+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Atheros" /><category scheme="http://www.blogger.com/atom/ns#" term="Lucid" /><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu" /><title>Atheros AR5212 in Ubuntu 10.04 Lucid Lynx</title><content type="html">I've just finished a fresh install of &lt;a href="http://www.ubuntu.com/"&gt;Ubuntu Lucid Lynx 10.04&lt;/a&gt; on my crusty old Thinkpad T60. Everything is working great with the exception of my &lt;a href="http://www.atheros.com/pt/AR5002X.htm"&gt;Atheros AR5212&lt;/a&gt; wireless card.&lt;br /&gt;
&lt;br /&gt;
Clicking the network manager applet in the panel I see the wireless listed as "Device not ready". This is tedious. &lt;br /&gt;
&lt;br /&gt;
The solution to this issue is to remove the mainline &lt;a href="http://wireless.kernel.org/en/users/Drivers/ath5k"&gt;ATK5K&lt;/a&gt; wireless driver from your Kernel and replace it with non-mainline &lt;a href="http://sourceforge.net/projects/madwifi/"&gt;MadWifi&lt;/a&gt; driver (&lt;a href="http://en.wikipedia.org/wiki/Comparison_of_open_source_wireless_drivers"&gt;source&lt;/a&gt;). MadWifi has superior support for the AR5212 card. This shouldn't take you more than about 20 minutes to sort out.&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Open a terminal: Aplications -&gt; Accessories -&gt; Terminal&lt;/li&gt;
&lt;li&gt;To check on your wireless card and make sure you have the AR5212:&lt;br /&gt;
&lt;pre&gt;trastle$ sudo lshw -c network&lt;/pre&gt;The result will look similar to this:&lt;br /&gt;
&lt;pre&gt;*-network
    description: Wireless interface
    product: AR5212 802.11abg NIC
    vendor: Atheros Communications Inc.
    physical id: 0
    bus info: pci@0000:03:00.0
    logical name: wifi0&lt;/pre&gt;Now you know your sporting an Atheros AR5212.&lt;/li&gt;
&lt;li&gt;Install some software you'll need to build MadWifi:&lt;br /&gt;
&lt;pre&gt;trastle$ sudo apt-get install subversion linux-kernel-headers build-essential \
libssl-dev&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Now go to your desktop &lt;br /&gt;
&lt;pre&gt;trastle$ cd ~/Desktop &lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Make a directory to put the MadWifi source in:&lt;br /&gt;
&lt;pre&gt;trastle$ mkdir madwifi-src&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Get the latest MadWifi source:&lt;br /&gt;
&lt;pre&gt;trastle$ svn checkout http://madwifi-project.org/svn/madwifi/trunk madwifi-src&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Change into your new source directory:&lt;br /&gt;
&lt;pre&gt;trastle$ cd madwifi-src&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Change to the root user:&lt;br /&gt;
&lt;pre&gt;trastle$ sudo -i&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Blacklist the non working ATH5K drivers:&lt;br /&gt;
&lt;pre&gt;root$ echo "# Block ATH5K" &gt;&gt; /etc/modprobe.d/blacklist
root$ echo "blacklist ath9k" &gt;&gt; /etc/modprobe.d/blacklist
root$ echo "blacklist ath5k" &gt;&gt; /etc/modprobe.d/blacklist&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Change to the MadWifi source directory&lt;br /&gt;
&lt;pre&gt;root$ cd /home/[your user]/Desktop/madwifi-src&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Build and install the MadWifi driver:&lt;br /&gt;
&lt;pre&gt;root$ make &amp;&amp; make install -d&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Add the MadWifi driver to your Kernel&lt;br /&gt;
&lt;pre&gt;root$ echo ath_pci &gt;&gt; /etc/modules&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
Now save anything else you have been working on and reboot your laptop. After the reboot your wireless will be working nicely.&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;2010-06-20: Edit added step 10. Thanks Xi.&lt;/p&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/6277109204980305536/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2010/05/atheros-ar5212-in-ubuntu-1004-lucid.html#comment-form" title="28 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/6277109204980305536?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/6277109204980305536?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2010/05/atheros-ar5212-in-ubuntu-1004-lucid.html" title="Atheros AR5212 in Ubuntu 10.04 Lucid Lynx" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>28</thr:total></entry><entry gd:etag="W/&quot;DE8ARn07cSp7ImA9WxBaEEs.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-7273504220776423838</id><published>2010-03-20T06:27:00.006Z</published><updated>2010-03-20T06:34:07.309Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-20T06:34:07.309Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="OSX" /><category scheme="http://www.blogger.com/atom/ns#" term="Terminal" /><category scheme="http://www.blogger.com/atom/ns#" term="XML" /><title>Building XMLStarlet in Snow Leopard (OSX 10.6)</title><content type="html">&lt;a href="http://xmlstar.sourceforge.net/"&gt;XMLStarlet&lt;/a&gt; is a command line XML toolkit. Very useful if you want to parse some data from a webpage, RSS feed of similar.&amp;nbsp;XMLStarlet&amp;nbsp;does not provide a binary version for Snow Leopard. They do however provide their source under the &lt;a href="http://xmlstar.sourceforge.net/license.php"&gt;MIT licence&lt;/a&gt;. So your free to download, build and modify.&lt;br /&gt;
&lt;br /&gt;
To get XMLStarlet up and running on Snow Leopard is nice and easy.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Install Xcode with the Unix the Unix Dev Support Option (see my past post about building wget for more details on this).&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Go download yourself a copy of the &lt;a href="http://sourceforge.net/projects/xmlstar/files/"&gt;XMLStarlet source&lt;/a&gt; (I am using &lt;a href="http://sourceforge.net/projects/xmlstar/files/xmlstarlet/1.0.1/xmlstarlet-1.0.1.tar.gz/download"&gt;v 1.0.1&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;XMLStarlet requires &lt;a href="http://xmlsoft.org/"&gt;libxml2&lt;/a&gt; and &lt;a href="http://xmlsoft.org/XSLT/"&gt;libxslt&lt;/a&gt;. Snow Leopard ships with both these libraries installed, however they are not in the location expected by the XMLStarlet build script so some symlinks are required. Enter the following in a terminal:&lt;pre&gt;sudo ln -s /usr/lib/libxslt.1.dylib /usr/lib/libxslt.a
sudo ln -s /usr/lib/libexslt.dylib /usr/lib/libexslt.a
sudo ln -s /usr/lib/libxml2.dylib /usr/lib/libxml2.a

&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Unpack the XMLStarlet tarball by double clicking it in Finder.&lt;br /&gt;
Take note of the name of the newly unpacked directory (something like xmlstarlet-1.0.1).&lt;br /&gt;
&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Open a terminal and cd to where you just unpacked (by default this will be the directory below).&lt;pre&gt;cd ~/Downloads/xmlstarlet-1*

&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Run the configure script:&lt;pre&gt;./configure

&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Run the builds&lt;pre&gt;make

&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Run the installer:&lt;pre&gt;sudo make install

&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;Finally, to test that the install worked correctly enter the following in a terminal:&lt;pre&gt;TA:~ troy$ xml 
XMLStarlet Toolkit: Command line utilities for XML
... 
XMLStarlet is a command line toolkit to query/edit/check/transform XML documents 
(for more information see http://xmlstar.sourceforge.net/)

&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;Enjoy.</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/7273504220776423838/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2010/03/building-xmlstarlet-in-snow-leopard-osx.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/7273504220776423838?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/7273504220776423838?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2010/03/building-xmlstarlet-in-snow-leopard-osx.html" title="Building XMLStarlet in Snow Leopard (OSX 10.6)" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;CUYGQXY5fSp7ImA9WxBUFkw.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-2233440426180246016</id><published>2009-11-21T13:44:00.001Z</published><updated>2010-03-03T10:45:20.825Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-03T10:45:20.825Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="sudo" /><category scheme="http://www.blogger.com/atom/ns#" term="no_proxy" /><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><category scheme="http://www.blogger.com/atom/ns#" term="apt-get" /><category scheme="http://www.blogger.com/atom/ns#" term="Terminal" /><category scheme="http://www.blogger.com/atom/ns#" term="http_proxy" /><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu" /><title>Proxy environment variables and sudo in Ubuntu</title><content type="html">At work we use a proxy server to access the internet from our test network. We also have an internal Ubuntu mirror on the test network to install updates and packages, this server must be accessed by the test machines directly without the proxy.&lt;br /&gt;
&lt;br /&gt;
Setting up the proxy and the exception for the mirror can be done in a terminal using the environment variables http_proxy, https_proxy, ftp_proxy, and no_proxy.&lt;br /&gt;
&lt;br /&gt;
In Ubuntu these variables are all set in the &lt;a href="http://www.regatta.cs.msu.su/doc/usr/share/man/info/ru_RU/a_doc_lib/files/aixfiles/environment.htm"&gt;/etc/environment&lt;/a&gt; file. On my test system this file contains the following:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;trastle@trastle-test:~$ cat /etc/environment
...
http_proxy="http://webproxy:3128/"
ftp_proxy="ftp://webproxy:3128/"
https_proxy="https://webproxy:3128/"
no_proxy="office-mirror"&lt;/pre&gt;&lt;br /&gt;
Testing that these settings have been applied to the current terminal can be done by calling printenv:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;trastle@trastle-test:~$ printenv | grep proxy
http_proxy=http://webproxy:3128/
ftp_proxy=ftp://webproxy:3128/
https_proxy=https://webproxy:3128/
no_proxy=office-mirror&lt;/pre&gt;&lt;br /&gt;
This output shows that all of the required environment variables are set. However when I try to perform an update from the office mirror it fails! The http_proxy is being used to access hosts clearly specified in the no_proxy variable.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;trastle@trastle-test:~$ sudo apt-get update
Ign http://office-mirror jaunty Release.gpg
...
Err http://office-mirror jaunty/main Packages
503 Service Unavailable
...
W: Failed to fetch http://office-mirror/ubuntu/dists/jaunty/main/binary-i386/Packages
503 Service Unavailable
...
E: Some index files failed to download, they have been ignored, or old ones used instead.&lt;/pre&gt;&lt;br /&gt;
This all makes more sense when you check the environment variables that sudo is running with:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;trastle@trastle-test:~$ sudo printenv | grep proxy
http_proxy=http://webproxy:3128/&lt;/pre&gt;&lt;br /&gt;
For safety sudo runs with an minimal environment. This default list is hard coded into sudo (initial_keepenv_table in env.c if you want to &lt;a href="ftp://ftp.sudo.ws/pub/sudo/"&gt;go read the source&lt;/a&gt;). Ubuntu patches this list to include http_proxy but not no_proxy. This breaks the ability to get updates from the local mirror. Sudo can be queried to determine which environment variables it preserves by default:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;trastle@trastle-test:~$ sudo sudo -V
Sudo version 1.6.9p17
...
Sudoers path: /etc/sudoers
...
Environment variables to preserve:
http_proxy
XAUTHORIZATION
XAUTHORITY
TZ
PS2
PS1
PATH
MAIL
LS_COLORS
KRB5CCNAME
HOSTNAME
HOME
DISPLAY
COLORS
...&lt;/pre&gt;&lt;br /&gt;
The solution to this problem is to modify the list of environment variables that sudo will preserve by editing the /etc/sudoers file and providing an explicit list of which environment variables to be preserved, overwriting the default list. The configuration that must be added to /etc/sudoers is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;Defaults env_keep="no_proxy http_proxy https_proxy ftp_proxy XAUTHORIZATION \
XAUTHORITY TZ PS2 PS1 PATH MAIL LS_COLORS KRB5CCNAME HOSTNAME HOME DISPLAY COLORS"&lt;/pre&gt;&lt;br /&gt;
This will preserve all of the default environment variables as well as no_proxy, https_proxy and ftp_proxy. You can test this setting to prove that sudo is now preserving these extra environment variables by running:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;trastle@trastle-test:~$
sudo printenv | grep proxy
http_proxy=http://webproxy:3128/
ftp_proxy=ftp://webproxy:3128/
https_proxy=https://webproxy:3128/
no_proxy=office-mirror&lt;/pre&gt;&lt;br /&gt;
With these additional environment variables preserved updates and installs from the command line using your local mirror and ignoring your proxy server will work like a charm.</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/2233440426180246016/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2009/11/proxy-environment-variables-and-sudo-in.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/2233440426180246016?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/2233440426180246016?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2009/11/proxy-environment-variables-and-sudo-in.html" title="Proxy environment variables and sudo in Ubuntu" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>5</thr:total></entry><entry gd:etag="W/&quot;CUQNSXY8cSp7ImA9WxBUFkw.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-3209351293357700691</id><published>2009-10-29T10:32:00.002Z</published><updated>2010-03-03T10:49:58.879Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-03T10:49:58.879Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><title>Apache Directory Studio Fails to start on Ubuntu 9.04</title><content type="html">I needed to install Apache Directory Studio this morning and after downloading unpacking version 1.4.0 I could not get it to run. Starting ADS at the command line resulted in the following output, the splash screen and a small sad blank window.&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;$ ./ApacheDirectoryStudio
0    [main] INFO  org.apache.directory.studio.Application  - Entering Apache Directory Studio.
4003 [main] INFO  org.apache.directory.studio.Application  - Exiting Apache Directory Studio.&lt;/pre&gt;&lt;br /&gt;
&lt;a href="http://1.bp.blogspot.com/_LfiNOePYANM/S40mxMuhBXI/AAAAAAAACRU/TawdfHLPEKY/s1600-h/ADS_fail.png"&gt;&lt;img src="http://1.bp.blogspot.com/_LfiNOePYANM/S40mxMuhBXI/AAAAAAAACRU/TawdfHLPEKY/s320/ADS_fail.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Reading the logs in ~/.ApacheDirectoryStudio/.metadata/.log revealed an exception:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;!ENTRY org.eclipse.ui.workbench 4 0 2009-10-29 09:29:30.476
!MESSAGE Widget disposed too early!
!STACK 0
java.lang.RuntimeException: Widget disposed too early!
at org.eclipse.ui.internal.WorkbenchPartReference$1.widgetDisposed(WorkbenchPartReference.java:171)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:117)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1158)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1182)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1163)
...&lt;/pre&gt;&lt;br /&gt;
After a bit of a hunt through the ADS mailing lists I learned that this error is due to a problem with the Mozilla XULRunner version on my system.&lt;br /&gt;
&lt;br /&gt;
In order to get ADS to run correctly I had to specify the version XULRunner it should run with manually:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;./ApacheDirectoryStudio -vmargs -Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/xulrunner/xulrunner-1.9.1&lt;/pre&gt;&lt;br /&gt;
The original Mozilla bug is detailed &lt;a href="https://lists.ubuntu.com/archives/ubuntu-mozillateam-bugs/2008-June/044261.html"&gt;here&lt;/a&gt;, and this solution for ADS found &lt;a href="http://osdir.com/ml/dev-directory-apache/2009-09/msg00130.html"&gt;here&lt;/a&gt;.</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/3209351293357700691/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2009/10/apache-directory-studio-fails-to-start.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/3209351293357700691?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/3209351293357700691?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2009/10/apache-directory-studio-fails-to-start.html" title="Apache Directory Studio Fails to start on Ubuntu 9.04" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_LfiNOePYANM/S40mxMuhBXI/AAAAAAAACRU/TawdfHLPEKY/s72-c/ADS_fail.png" height="72" width="72" /><thr:total>0</thr:total></entry><entry gd:etag="W/&quot;CkAHQ387eCp7ImA9WxBUFkw.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-1265338265073973592</id><published>2009-10-28T23:24:00.005Z</published><updated>2010-03-03T10:05:32.100Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-03T10:05:32.100Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="OSX" /><category scheme="http://www.blogger.com/atom/ns#" term="Terminal" /><title>Building wget in Snow Leopard</title><content type="html">I like Snow Leopard, it's a nifty OS, but occasionally something will baffle me. This evening it was the exclusion of &lt;a href="http://www.gnu.org/software/wget/manual/wget.html"&gt;wget&lt;/a&gt; from the command line tools.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://4.bp.blogspot.com/_LfiNOePYANM/S40nWEkE67I/AAAAAAAACRc/8MHfLBMAUjE/s1600-h/nowget.png"&gt;&lt;img src="http://4.bp.blogspot.com/_LfiNOePYANM/S40nWEkE67I/AAAAAAAACRc/8MHfLBMAUjE/s320/nowget.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Clearly this sucks and living without wget is not an option. Thankfully wget is free software so it's easy to grab the source and build it yourself.&lt;br /&gt;
&lt;br /&gt;
Firstly you'll need to have Xcode installed with "Unix Dev Support". The Unix Dev Support option gives you gcc, make and other essential goodies. Xcode is on the Mac OS 10.6 DVD in the optional installs section (you can also &lt;a href="http://developer.apple.com/technology/xcode.html"&gt;download Xcode&lt;/a&gt; from Apple).&lt;br /&gt;
&lt;br /&gt;
Next you'll need to grab the latest wget source from: &lt;a href="ftp://ftp.gnu.org/pub/gnu/wget/"&gt;ftp://ftp.gnu.org/pub/gnu/wget/&lt;/a&gt; or click &lt;a href="ftp://ftp.gnu.org/pub/gnu/wget/wget-latest.tar.gz"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
To compile and install wget complete the following:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Unpack the wget tarball by double clicking it in Finder.&lt;br /&gt;
Take note of the name of the newly unpacked directory (something like wget-1.12). &lt;br /&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Open a terminal and cd to where you just unpacked (by default this will be the directory below).&lt;br /&gt;
&lt;pre&gt;cd ~/Downloads/wget-1.*&lt;/pre&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Run the configure script:&lt;br /&gt;
&lt;pre&gt;./configure&lt;/pre&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Run the build and installer:&lt;br /&gt;
&lt;pre&gt;sudo make install&lt;/pre&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;All done. Now you can delete the wget folder and tarball in your ~/Downloads directory.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;&lt;br /&gt;
Once your done you'll be able to run wget in your terminal.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://4.bp.blogspot.com/_LfiNOePYANM/S40ngDEsHsI/AAAAAAAACRk/CwiajVdqs54/s1600-h/wget.png"&gt;&lt;img src="http://4.bp.blogspot.com/_LfiNOePYANM/S40ngDEsHsI/AAAAAAAACRk/CwiajVdqs54/s320/wget.png" /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Much better.</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/1265338265073973592/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2009/10/building-wget-in-snow-leopard.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/1265338265073973592?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/1265338265073973592?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2009/10/building-wget-in-snow-leopard.html" title="Building wget in Snow Leopard" /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_LfiNOePYANM/S40nWEkE67I/AAAAAAAACRc/8MHfLBMAUjE/s72-c/nowget.png" height="72" width="72" /><thr:total>2</thr:total></entry><entry gd:etag="W/&quot;CkcDQHY6eyp7ImA9WxBUFkw.&quot;"><id>tag:blogger.com,1999:blog-7150563171193653239.post-5976504758796920764</id><published>2009-10-22T02:40:00.001+01:00</published><updated>2010-03-03T09:54:31.813Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-03T09:54:31.813Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Linux" /><category scheme="http://www.blogger.com/atom/ns#" term="Terminal" /><title>When you forget to start screen...</title><content type="html">&lt;a href="http://www.gnu.org/software/screen/"&gt;Screen&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Nohup"&gt;nohup&lt;/a&gt; are great tools which can be used, by someone with forethought, to keep their processes running after they disconnect from a server.&lt;br /&gt;
&lt;br /&gt;
The problem with both nohup and screen is that you need to use them before starting a process. If you forgot or didn't realize the process was going to take ages then your all out of luck.&lt;br /&gt;
&lt;br /&gt;
Recently on a man page hunt I discovered a workaround for this situation using &lt;a href="http://www.research.att.com/%7Egsf/man/man1/disown.html"&gt;disown&lt;/a&gt;. At the terminal with the long running process enter the following:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;ctrl + z  (pause the current process and background it)
bg        (resume the last backgrounded process in the background)
disown    (disassociate the last process from the current terminal) 
exit      (to close the current terminal)&lt;/pre&gt;&lt;br /&gt;
Now your disconnected, your process is still running and you can go home. If you don't want to go home and instead want to check that your process is still running, ssh back into your server and run ps aux and hunt it down in the process list.</content><link rel="replies" type="application/atom+xml" href="http://blog.troyastle.com/feeds/5976504758796920764/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.troyastle.com/2009/10/when-you-forget-to-start-screen.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/5976504758796920764?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7150563171193653239/posts/default/5976504758796920764?v=2" /><link rel="alternate" type="text/html" href="http://blog.troyastle.com/2009/10/when-you-forget-to-start-screen.html" title="When you forget to start screen..." /><author><name>Troy Astle</name><uri>https://plus.google.com/107291620783812916335</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="//lh6.googleusercontent.com/-NN8qJxy82rM/AAAAAAAAAAI/AAAAAAAARtw/gc6Tj5LJhtQ/s512-c/photo.jpg" /></author><thr:total>2</thr:total></entry></feed>
