<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>alan.lamielle.net &#187; Ubuntu</title>
	<atom:link href="http://alan.lamielle.net/tags/ubuntu/feed" rel="self" type="application/rss+xml" />
	<link>http://alan.lamielle.net</link>
	<description>Alan LaMielle</description>
	<lastBuildDate>Fri, 16 Sep 2011 16:50:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Nexus One USB in Ubuntu 9.10</title>
		<link>http://alan.lamielle.net/2010/01/22/nexus-one-usb-in-ubuntu-9-10</link>
		<comments>http://alan.lamielle.net/2010/01/22/nexus-one-usb-in-ubuntu-9-10#comments</comments>
		<pubDate>Sat, 23 Jan 2010 04:55:14 +0000</pubDate>
		<dc:creator>Alan LaMielle</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[adb]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[droid]]></category>
		<category><![CDATA[droid eris]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[eris]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[N1]]></category>
		<category><![CDATA[nexus one]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[t-mobile]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[vendor id]]></category>
		<category><![CDATA[verizon]]></category>

		<guid isPermaLink="false">http://alan.lamielle.net/?p=623</guid>
		<description><![CDATA[My shiny new Google Nexus One wasn&#8217;t connecting properly over USB to my Ubuntu 9.10 (Karmic) notebook using the Android SDK.  Here&#8217;s how I fixed it. After a few days of debating whether or not to buy a Nexus One, I finally gave in a bought one.  Rachael ended up getting a Droid Eris (Verizon) [...]]]></description>
			<content:encoded><![CDATA[<p>My shiny new Google Nexus One wasn&#8217;t connecting properly over USB to my Ubuntu 9.10 (Karmic) notebook using the Android SDK.  Here&#8217;s how I fixed it.<br />
<span id="more-623"></span></p>
<p>After a few days of debating whether or not to buy a Nexus One, I finally gave in a bought one.  Rachael ended up getting a Droid Eris (Verizon) for Christmas, so in the course of a few weeks I gained access to two fantastic Android-powered phones.  I had been compiling a list of mobile application ideas and the fact that I now have the hardware to test on motivated me to start looking into Android development.</p>
<p>After getting the Android SDK setup I needed to connect my N1 and push an application to it for testing on real hardware.  I found some <a href="http://developer.android.com/guide/developing/device.html">Android documentation</a> that discussed connecting up an Android device over USB.  However, after following the steps on this page, I was still seeing strange output when running <code>adb devices</code>:<br />
<code>List of devices attached<br />
????????????    no permissions</code><br />
This led to some searching which turned up a <a href="http://dansyrstad.com/2010/01/09/getting-nexus-one-working-with-usb-on-ubuntu/">blog post</a>.  Basically, the Google Android team hasn&#8217;t added the Vendor ID for the Nexus One.  Apparently HTC&#8217;s USB Vendor ID isn&#8217;t correct.  So, I followed these steps to fix it:</p>
<ol>
<li>Create/edit a udev rules file:<br />
<code>sudo vim /etc/udev/rules.d/51-android.rules</code></li>
<li>Add the following line to this file:<br />
<code>SUBSYSTEM=="usb", SYSFS{idVendor}=="18D1", MODE="0666"</code><br />
(Note the vendor ID of 18D1.  This was changed from the HTC vendor code of 0BB4.)</li>
<li>Restart udev using either<br />
<code>sudo reload udev</code><br />
or<br />
<code> sudo service udev reload</code></li>
<li>Connect your Nexus One.</li>
<li>Run<br />
<code>adb devices</code><br />
and you should see something like<br />
<code>List of devices attached<br />
############    device</code></li>
</ol>
<p>Hopefully Google updates the documentation to include the Vendor ID 18D1 rather than making us hunt for this number ourselves.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://alan.lamielle.net/2010/01/22/nexus-one-usb-in-ubuntu-9-10/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Thinkpad Trackpoint Scrolling in Ubuntu Karmic Koala</title>
		<link>http://alan.lamielle.net/2009/10/07/thinkpad-trackpoint-scrolling-in-ubuntu-karmic-koala</link>
		<comments>http://alan.lamielle.net/2009/10/07/thinkpad-trackpoint-scrolling-in-ubuntu-karmic-koala#comments</comments>
		<pubDate>Wed, 07 Oct 2009 12:52:56 +0000</pubDate>
		<dc:creator>Alan LaMielle</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[9.10]]></category>
		<category><![CDATA[fdi]]></category>
		<category><![CDATA[gdm]]></category>
		<category><![CDATA[hal]]></category>
		<category><![CDATA[karmic]]></category>
		<category><![CDATA[karmic koala]]></category>
		<category><![CDATA[mouse]]></category>
		<category><![CDATA[policy]]></category>
		<category><![CDATA[scroll]]></category>
		<category><![CDATA[scrolling]]></category>
		<category><![CDATA[thinkpad]]></category>
		<category><![CDATA[trackpoint]]></category>

		<guid isPermaLink="false">http://alan.lamielle.net/?p=529</guid>
		<description><![CDATA[Scrolling using the Thinkpad Trackpoint (middle click/hold + mouse nub) is still not fixed by default in Ubuntu 9.10 (Karmic Koala).  Here&#8217;s how I fixed it. Following the instructions on this site, I created a new file (/etc/hal/fdi/policy/mouse-wheel.fdi) as root that contains: &#60;match key="info.product" string="TPPS/2 IBM TrackPoint"&#62; &#60;merge key="input.x11_options.EmulateWheel" type="string"&#62;true&#60;/merge&#62; &#60;merge key="input.x11_options.EmulateWheelButton" type="string"&#62;2&#60;/merge&#62; &#60;merge key="input.x11_options.XAxisMapping" [...]]]></description>
			<content:encoded><![CDATA[<p>Scrolling using the Thinkpad Trackpoint (middle click/hold + mouse nub) is still not fixed by default in Ubuntu 9.10 (Karmic Koala).  Here&#8217;s how I fixed it.</p>
<p><span id="more-529"></span>Following the instructions on <a href="http://psung.blogspot.com/2008/09/scrolling-with-thinkpads-trackpoint-in.html">this</a> site, I created a new file (<code>/etc/hal/fdi/policy/mouse-wheel.fdi</code>) as root that contains:</p>
<p><code>&lt;match key="info.product" string="TPPS/2 IBM TrackPoint"&gt;<br />
&lt;merge key="input.x11_options.EmulateWheel" type="string"&gt;true&lt;/merge&gt;<br />
&lt;merge key="input.x11_options.EmulateWheelButton" type="string"&gt;2&lt;/merge&gt;<br />
&lt;merge key="input.x11_options.XAxisMapping" type="string"&gt;6 7&lt;/merge&gt;<br />
&lt;merge key="input.x11_options.YAxisMapping" type="string"&gt;4 5&lt;/merge&gt;<br />
&lt;merge key="input.x11_options.ZAxisMapping" type="string"&gt;4 5&lt;/merge&gt;<br />
&lt;merge key="input.x11_options.Emulate3Buttons" type="string"&gt;true&lt;/merge&gt;<br />
&lt;/match&gt;</code></p>
<p>If you don&#8217;t want to restart, you can log out and restart the gdm and hal services.  However, I simply restarted and scrolling worked upon logging in!</p>
<p>The document <a href="http://mvogt.wordpress.com/2008/08/15/xorg-evdev-and-emulatewheel/">here</a> is apparently the original source of this information.  I&#8217;m mostly posting this for myself for future reference (and in case either of the afore mentioned pages go down).</p>
]]></content:encoded>
			<wfw:commentRss>http://alan.lamielle.net/2009/10/07/thinkpad-trackpoint-scrolling-in-ubuntu-karmic-koala/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Google Gears in Firefox 3.5 in Linux x64_64</title>
		<link>http://alan.lamielle.net/2009/07/19/google-gears-in-firefox-3-5-in-linux-x64_64</link>
		<comments>http://alan.lamielle.net/2009/07/19/google-gears-in-firefox-3-5-in-linux-x64_64#comments</comments>
		<pubDate>Sun, 19 Jul 2009 17:59:45 +0000</pubDate>
		<dc:creator>Alan LaMielle</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[3.5]]></category>
		<category><![CDATA[3.5.1]]></category>
		<category><![CDATA[64-bit]]></category>
		<category><![CDATA[9.04]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[firefox 3.5]]></category>
		<category><![CDATA[gears]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google gears]]></category>
		<category><![CDATA[jaunty]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu jaunty]]></category>
		<category><![CDATA[x86_64]]></category>

		<guid isPermaLink="false">http://alan.lamielle.net/?p=347</guid>
		<description><![CDATA[I recently posted about getting Firefox working in Ubuntu Jaunty 9.04 x86_64.  Updates to Firefox 3.5.1 were recently pushed to the repositories, and after updating, Gears stopped working again.  Use the Gears build here for Firefox 3.5.1 Linux x86_46, linked to from this Google Groups post. It really would be nice if 64-bit Linux was [...]]]></description>
			<content:encoded><![CDATA[<p>I recently <a href="http://alan.lamielle.net/2009/07/13/firefox-3-5-in-ubuntu-jaunty-9-04">posted</a> about getting Firefox working in Ubuntu Jaunty 9.04 x86_64.  Updates to Firefox 3.5.1 were recently pushed to the repositories, and after updating, Gears stopped working again.  Use the Gears build <a href="http://gkovacs.xvm.mit.edu/google-gears/gears-linux-x86_64-0.5.25.0.xpi">here</a> for Firefox 3.5.1 Linux x86_46, linked to from <a href="http://groups.google.com/group/gears-users/msg/70f164020c0f8f4e">this</a> Google Groups post.</p>
<p>It really would be nice if 64-bit Linux was supported by Google rather than having to find these work-around builds.  Clearly it works for us, what is the holdup?</p>
]]></content:encoded>
			<wfw:commentRss>http://alan.lamielle.net/2009/07/19/google-gears-in-firefox-3-5-in-linux-x64_64/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox 3.5 in Ubuntu Jaunty 9.04</title>
		<link>http://alan.lamielle.net/2009/07/13/firefox-3-5-in-ubuntu-jaunty-9-04</link>
		<comments>http://alan.lamielle.net/2009/07/13/firefox-3-5-in-ubuntu-jaunty-9-04#comments</comments>
		<pubDate>Mon, 13 Jul 2009 17:07:39 +0000</pubDate>
		<dc:creator>Alan LaMielle</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[3.5]]></category>
		<category><![CDATA[9.04]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[gears]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google gears]]></category>
		<category><![CDATA[jaunty]]></category>
		<category><![CDATA[ogg]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[ppa]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[tab mix plus]]></category>
		<category><![CDATA[tmp]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://alan.lamielle.net/?p=327</guid>
		<description><![CDATA[I&#8217;ve finally moved permanently to Firefox 3.5 in Ubuntu Jaunty (9.04).  Initially I installed it by following the instructions found here and here.  However, I didn&#8217;t put the time in to update my extensions, so I ended up reverting back to the 3.0.* series.  I installed by adding the Security Team&#8217;s PPA to my package [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally moved permanently to Firefox 3.5 in Ubuntu Jaunty (9.04).  Initially I installed it by following the instructions found <a href="http://tombuntu.com/index.php/2009/07/03/install-firefox-35-in-ubuntu-904/">here</a> and <a href="http://www.ubuntusolutions.org/2009/07/installing-firefox-3-5-the-right-way-on-ubuntu-jaunty.html">here</a>.  However, I didn&#8217;t put the time in to update my extensions, so I ended up reverting back to the 3.0.* series.  I installed by adding the Security Team&#8217;s PPA to my package sources list, but that is apparently no longer necessary.</p>
<p>The two extensions I couldn&#8217;t live without were Tab Mix Plus and Google Gears.  After some digging, I found a TMP <a href="http://tmp.garyr.net/forum/viewtopic.php?t=9864">thread</a> with a <a href="http://tmp.garyr.net/tab_mix_plus-dev-build.xpi">link</a> (xpi) to a development build that works with Firefox 3.5.  Also, I found a Google groups <a href="http://groups.google.com/group/gears-users/browse_thread/thread/1c11eb7bca12ee3e/70f164020c0f8f4e">thread</a> and a <a href="http://techie-buzz.com/firefox/google-gears-firefox-35.html">blog post</a> with a <a href="http://rotuka.com/files/google_gears_firefox_3.5/gears-linux-x86_64-opt-0.5.25.0.xpi">few</a> <a href="http://gkovacs.xvm.mit.edu/google-gears/gears-linux-x86_64-0.5.25.0.xpi">links</a> to Linux x86_64 builds of Gears.</p>
<p>Once I upgraded these two extensions I was happy enough to continue using 3.5 permanently rather than just playing with it for an hour or so.</p>
<p>Note: The builtin support for OGG video is amazing.  The problem is it&#8217;s only in Firefox right now, so I don&#8217;t really expect to see widespread adoption of it.  However, it is one great step towards getting rid of plugin-based video based on flash.</p>
]]></content:encoded>
			<wfw:commentRss>http://alan.lamielle.net/2009/07/13/firefox-3-5-in-ubuntu-jaunty-9-04/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installing nVidia driver 185.18.14 with real time linux kernel 2.6.28-3-rt</title>
		<link>http://alan.lamielle.net/2009/07/10/installing-nvidia-driver-185-18-14-with-real-time-linux-kernel-2-6-28-3-rt</link>
		<comments>http://alan.lamielle.net/2009/07/10/installing-nvidia-driver-185-18-14-with-real-time-linux-kernel-2-6-28-3-rt#comments</comments>
		<pubDate>Sat, 11 Jul 2009 00:50:28 +0000</pubDate>
		<dc:creator>Adam Labadorf</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[amd]]></category>
		<category><![CDATA[amd64]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[jaunty]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[kubuntu]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[nvidia]]></category>

		<guid isPermaLink="false">http://alan.lamielle.net/?p=302</guid>
		<description><![CDATA[This article discusses how to get the NVidia Linux graphics driver working with the real time linux kernel version 2.6.28-rt under Ubuntu (Kubuntu) 9.04 on AMD 64. DISCLAIMER:I have no idea if what I have here is a good idea beyond the fact that my video card is working properly under linux-rt.  My computer froze [...]]]></description>
			<content:encoded><![CDATA[<p>This article discusses how to get the NVidia Linux graphics driver working with the real time linux kernel version 2.6.28-rt under Ubuntu (Kubuntu) 9.04 on AMD 64.</p>
<p><span id="more-302"></span><strong>DISCLAIMER:</strong>I have no idea if what I have here is a good idea beyond the fact that my video card is working properly under linux-rt.  My computer froze a couple times with the following setup but I&#8217;m not sure if it&#8217;s the fix or the fact that linux-rt apparently doesn&#8217;t play well with multiple core machines.  Or the computer freezy gnomes.  Whatever.  Use at your own risk.</p>
<p>I&#8217;m running Kubuntu 9.04 on AMD64.</p>
<p>While setting up my linux audio recording setup on Kubuntu 9.04 I installed the linux-rt meta-package (which right now points to linux-2.6.28-3-rt) for real time process scheduling.  I was dismayed and not at all surprised that the proprietary nVidia driver for my GeForce 7950  GT did not work immediately when I booted up out of GRUB with the new kernel.  So, I downloaded the latest nVidia driver from <a title="http://www.nvidia.com/object/linux_display_amd64_185.18.14.html" href="http://www.nvidia.com/object/linux_display_amd64_185.18.14.html" target="aaaaaa">http://www.nvidia.com/object/linux_display_amd64_185.18.14.html</a> and tried to install as I have to do every time there is a new linux kernel update by running this with the downloaded script:</p>
<p><code>$&gt; sudo sh NVIDIA-Linux-x86_64-185.18.14-pkg2.run</code></p>
<p>The script informs you that it needs to compile the kernel module as usual, but dies saying compilation was unsuccessful.  Following the advice of some forum posts I found, I extracted the script into its source tree with:</p>
<p><code>$&gt; sudo sh NVIDIA-Linux-x86_64-185.18.14-pkg2.run -x</code></p>
<p>which creates a directory with a script <code>nvidia-installer.sh</code> and the source tree.  I ran the installer manually with:<br />
<code><br />
$&gt; cd  NVIDIA-Linux-x86_64-185.18.14-pkg2<br />
$&gt; sudo ./nvidia-installer<br />
</code></p>
<p>Compilation fails again at the same step.  Inspecting <code>/var/log/nvidia-installer.log</code> tells us:</p>
<p><code>/home/labadorf/video_drivers/NVIDIA-Linux-x86_64-185.18.14-pkg2/usr/src/nv/os-interface.c:130: error: incompatible types in assignment</code></p>
<p>After poking around some forums there were some suggestions about replacing some SEMAPHORE code in certain driver source files, but they were for the wrong driver version (177) and didn&#8217;t work. Alright, well I have the source for both the kernel and driver, I thought, so let&#8217;s see what this incompatible type assignment is.  At the end of the day, I traced the error to a couple lines of code earlier in <code>usr/src/nv/os-interface.c</code>.  Apparently, the driver is trying to pass some <code>raw_spinlock_t</code> kernel struct to a function that can only accept <code>spinlock_t</code> structs when it detects you&#8217;re using a real time kernel.  So, I thought a little commenting might do the trick&#8230;</p>
<p>Original <code>os-interface.c</code> source:</p>
<p><code><br />
86 typedef struct os_sema_s<br />
87 {<br />
88     nv_stack_t        *sp;<br />
89     struct completion  completion;<br />
90 #if defined(CONFIG_PREEMPT_RT)<br />
91     raw_spinlock_t     lock;<br />
92 #else<br />
93     spinlock_t         lock;<br />
94 #endif<br />
95     S032               count;<br />
96 } os_sema_t;<br />
97<br />
</code></p>
<p>Modified code:<br />
<code><br />
86 typedef struct os_sema_s<br />
87 {<br />
88     nv_stack_t        *sp;<br />
89     struct completion  completion;<br />
90 //#if defined(CONFIG_PREEMPT_RT)<br />
91 //    raw_spinlock_t     lock;<br />
92 //#else<br />
93     spinlock_t         lock;<br />
94 //#endif<br />
95     S032               count;<br />
96 } os_sema_t;<br />
97<br />
</code></p>
<p>Lo and behold, on recompiling the driver everything works fine.  Now, I suppose there may have been a good reason to use the raw version of the struct, but I got all of my audio stuff running with much lower latency AND using both monitors on high resolution (which is really handy since some of these audio apps take up a lot of screen real estate).  There are a couple bugs open on this issue so I didn&#8217;t feel the need to post anything (though none of the comments there helped with my problem), hopefully someone will figure out what the problem is and fix it soon.</p>
<p><strong>Note:</strong> By default the installer replaces whatever driver you have with the new one.  You <em>have</em> to unpack the driver source and use the installer manually if you want to use different kernels and not recompile the driver every time.  Look at <a href="http://meandubuntu.wordpress.com/2008/07/17/install-nvidia-17713-drivers-on-realtime-kernel/" target="aaaaa">this post</a> and specifically Switcher&#8217;s comment 12 for instructions on how to do that.</p>
<p>Like I said, the commenting out I&#8217;ve done may be a terrible, terrible idea, but as I know nothing about graphics drivers and even less about kernel building I&#8217;m playing the ignorant fool.  Good luck.</p>
]]></content:encoded>
			<wfw:commentRss>http://alan.lamielle.net/2009/07/10/installing-nvidia-driver-185-18-14-with-real-time-linux-kernel-2-6-28-3-rt/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Ubuntu Jaunty Update Notifications</title>
		<link>http://alan.lamielle.net/2009/04/28/ubuntu-jaunty-update-notifications</link>
		<comments>http://alan.lamielle.net/2009/04/28/ubuntu-jaunty-update-notifications#comments</comments>
		<pubDate>Tue, 28 Apr 2009 12:24:00 +0000</pubDate>
		<dc:creator>Alan LaMielle</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[intrepid]]></category>
		<category><![CDATA[jaunty]]></category>
		<category><![CDATA[systray]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[updates]]></category>

		<guid isPermaLink="false">http://alan.lamielle.net/?p=71</guid>
		<description><![CDATA[I just noticed that Jaunty changed the way that it notifies the user about updates. Rather than a notification in the systray, it displays the update-manager window automatically. To revert to the systray notification, you need to change a Gnome settings value using either gconftool on the command line or gconf-editor. Change the value /apps/update-notifier/auto_launch [...]]]></description>
			<content:encoded><![CDATA[<p>I just noticed that Jaunty changed the way that it notifies the user about updates.  Rather than a notification in the systray, it displays the update-manager window automatically.  To revert to the systray notification, you need to change a Gnome settings value using either gconftool on the command line or gconf-editor.  Change the value <code>/apps/update-notifier/auto_launch</code> to false using one of these tools:</p>
<p><code>gconftool -s --type bool /apps/update-notifier/auto_launch false</code></p>
]]></content:encoded>
			<wfw:commentRss>http://alan.lamielle.net/2009/04/28/ubuntu-jaunty-update-notifications/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Environment Variables and GNU Screen</title>
		<link>http://alan.lamielle.net/2009/03/09/environment-variables-and-gnu-screen</link>
		<comments>http://alan.lamielle.net/2009/03/09/environment-variables-and-gnu-screen#comments</comments>
		<pubDate>Mon, 09 Mar 2009 19:32:00 +0000</pubDate>
		<dc:creator>Alan LaMielle</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[X]]></category>
		<category><![CDATA[Xorg]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://alan.lamielle.net/?p=80</guid>
		<description><![CDATA[I am an avid user of GNU screen.  However, one problem I’ve run into lately in Ubuntu involves the interaction of persistent screen sessions and less-than-persistent X sessions.  I’ve found that after starting a new X session, new environment variables are set (such as DISPLAY, SSH_AGENT_PID, and SSH_AUTH_SOCK).  This causes an incosistency between my X [...]]]></description>
			<content:encoded><![CDATA[<p>I am an avid user of <span class="caps">GNU</span> screen.  However, one problem I’ve run into lately in Ubuntu involves the interaction of persistent screen sessions and less-than-persistent X sessions.  I’ve found that after starting a new X session, new environment variables are set (such as <span class="caps">DISPLAY</span>, SSH_AGENT_PID, and <span class="caps">SSH</span>_AUTH_SOCK).  This causes an incosistency between my X session’s variables and those that exist in my persistent screen session.  This post discusses my solution to this issue.</p>
<p>I’m currently running the currently unreleased Ubuntu Jaunty on virtually all of my machines.  At times, such as when resuming my notebook, I find that my X session has died.  This is not that much of an inconvenience for me—I do most of my work within a screen session that exists as long as the machine stays running, regardless of what X decides to do.  However, services such as ssh-agent must be restarted when creating a new X session and along with this restart comes a new set values for <span class="caps">SSH</span>_AGENT_PID and <span class="caps">SSH</span>_AUTH_SOCK.  In addition, it is possible that <span class="caps">DISPLAY</span> may change as well.</p>
<p>While these variables have changed, the screen sessions values have not been updated.  So when I re-attach to the running screen session and attempt to use ssh, I find that rather than using the running ssh-agent process to cache my passphrase, I am prompted in my terminal to enter the passphrase.  If I were able to use the updated environment variables I could use the ssh-agent process and all would be fine.</p>
<p>As I normally do, I googled for this issue and ran across <a href="http://samrowe.com/wordpress/ssh-agent-and-gnu-screen/">this solution</a> to the problem.  Rather than reiterate the details presented in this post, I simply show the two zsh functions I’ve written, as they differ sightly from the afore mentioned post:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">grabvars<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #007800;">VARS</span>=<span style="color: #ff0000;">&quot;SSH_AGENT_PID SSH_AUTH_SOCK DISPLAY&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#For each variable in $VARS</span>
<span style="color: #000000; font-weight: bold;">for</span> x <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$VARS</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$x</span>=\$<span style="color: #007800;">$x</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span>  <span style="color: #ff0000;">'s/=/=&quot;/
s/$/&quot;/
s/^/export /'</span>
<span style="color: #000000; font-weight: bold;">done</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #007800;">$VARSLOC</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
sourcevars<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$VARSLOC</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">source</span> <span style="color: #007800;">$VARSLOC</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Note that <span class="caps">VARSLOC</span> names the file that the export statements should be written to.</p>
<p>How do I use these two functions?  sourcevars is called every time a new shell is created (I’ve simply added a call to this function in ~/.zshrc).  grabvars is only called when I create or attach to a screen session, so I’ve aliased ‘screen’ to be ‘grabvars; screen’.  So now when I first login and create a new terminal, this terminal has the updated environment vars.  I do a ‘screen -DR session_name’ to attach, which then calls grabvars, the correct values are written to <span class="caps">VARSLOC</span>, and my screen session is attached.  If I create a new window in my screen session, the correct variables are now set.  If I want the updated variables in an exsiting window, I simply call ‘sourcevars’.</p>
]]></content:encoded>
			<wfw:commentRss>http://alan.lamielle.net/2009/03/09/environment-variables-and-gnu-screen/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

