<?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>fsync(2)</title>
	<atom:link href="http://www.shaunrowland.com/fsync/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shaunrowland.com/fsync</link>
	<description>...synchronizing my in-core state with that on disk.</description>
	<lastBuildDate>Wed, 18 Apr 2012 22:08:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Spam Through SSH Port Forwarding</title>
		<link>http://www.shaunrowland.com/fsync/2012/04/17/spam-through-ssh-port-forwarding/</link>
		<comments>http://www.shaunrowland.com/fsync/2012/04/17/spam-through-ssh-port-forwarding/#comments</comments>
		<pubDate>Wed, 18 Apr 2012 03:29:31 +0000</pubDate>
		<dc:creator>Shaun Rowland</dc:creator>
				<category><![CDATA[UNIX System Administration]]></category>

		<guid isPermaLink="false">http://www.shaunrowland.com/fsync/?p=469</guid>
		<description><![CDATA[I ran into an interesting problem at work last week. The university security group noticed spam coming from some of our Solaris login servers in their Bro logs. They provided me with a lot of details for message transfer times, but I couldn&#8217;t tie those to a specific user account on the system. Each of [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into an interesting problem at work last week. The university security group noticed spam coming from some of our Solaris login servers in their Bro logs. They provided me with a lot of details for message transfer times, but I couldn&#8217;t tie those to a specific user account on the system. Each of our login servers can have as many as 50 people at a time. I checked some possibilities, but there certainly wasn&#8217;t a script or program running otherwise. I started to think of other ways a user might relay spam through our login servers. I knew it wasn&#8217;t through sendmail, and then it hit me &#8211; SSH tunnels. I ran some commands and actually caught <code>sshd</code> connecting to port 25 on a remote system, but the <code>sshd</code> was running as a privileged user because the real user didn&#8217;t actually log in to our system. I disabled SSH port forwarding in <code>sshd_config</code> by setting:</p>
<pre class="brush: plain; title: ; notranslate">
AllowTcpForwarding no
</pre>
<p>If you disable SSH port forwarding, the logs will contain error messages when users try to use it. If it&#8217;s enabled, there will be no log entries. It&#8217;d be really great if I could have more fine grained control over what ports could be forwarded or if I could specify that port forwarding can only be done to localhost, but I&#8217;ve found no such setting so far. Maybe I can hack that in later. This did allow me to catch the user account that was doing it from the error messages:</p>
<pre class="brush: plain; title: ; notranslate">
Apr  9 12:12:16 &lt;host&gt;.cse.ohio-state.edu sshd[21527]: [ID 800047 auth.info] Accepted password for &lt;user&gt; from &lt;remote IP&gt; port 49571 ssh2

Apr  9 12:54:15 &lt;host&gt;.cse.ohio-state.edu sshd[21527]: [ID 800047 auth.info] Received request to connect to host &lt;remote MTA&gt; port 25, but the request was denied.
</pre>
<p>We checked in Splunk and found that the user in question logged in from numerous IPs in Europe. I was able to reproduce what I observed with the following SSH command:</p>
<pre class="brush: plain; title: ; notranslate">
ssh -N -L 1234:&lt;remote MTA&gt;:25 &lt;CSE login server&gt;
</pre>
<p>This forwards port 1234 to port 25 on the remote MTA though one of our login servers, all without actually logging in. This is why I couldn&#8217;t match it with a username. Luckily this only happened with one account. I disabled the account and turned SSH port forwarding back on because we actually have a couple of use cases where it&#8217;s necessary.</p>
<p>I wrote equivalent shell and Perl scripts to monitor for this situation. A shell script version that works on Linux follows:</p>
<pre class="brush: bash; title: ; notranslate">

#!/bin/bash

FROM='rowland'
RECIPIENTS='rowland'
PORTS='25 587'
EXCLUSIONS='127.0.0.1:25 127.0.0.1:587 164.107.115.49:25 164.107.115.49:587'

found=0
declare -a data
count=0

for n in $(netstat -n -p --inet |grep -v WAIT |sed '1,2d' |awk '{print $4 &quot;,&quot; $5 &quot;,&quot; $7}'); do
    s_port=$(echo $n |cut -f 1 -d ',' |cut -f 2 -d :)
    destination=$(echo $n |cut -f 2 -d ',')

    for e in $EXCLUSIONS; do
        if [ &quot;$destination&quot; = &quot;$e&quot; ]; then
            continue 2
        fi
    done

    d_port=$(echo $destination |cut -f 2 -d :)

    for p in $PORTS; do
        if [ &quot;$d_port&quot; = &quot;$p&quot; ]; then
            found=1
            data[$count]=&quot;$n&quot;
            count=$((count + 1))
        fi
    done
done

if [ $found -eq 1 ]; then
    port_list=$(echo $PORTS |sed 's/ /,/g')
    mailx -s 'SMTP Port Connection Check Results' -r $FROM $RECIPIENTS &lt;&lt;EOF
SMTP Port Connection Check Results
==================================

Host:  $(hostname)
Date:  $(date)
Ports: $PORTS

netstat
-------

Excluded Destinations:

$(for e in $EXCLUSIONS; do echo $e; done)

Data:

$(for d in ${data[@]}; do echo $d |sed 's/,/   /g'; done)

lsof
----

$(/usr/sbin/lsof -i TCP:$port_list)

who
---

$(who)

ps
--

$(ps -ef)
EOF
fi
</pre>
<p>That runs fast on a new Linux server, but the Solaris version is pretty slow on our old hardware. I wrote a Perl version as well:</p>
<pre class="brush: perl; title: ; notranslate">

#!/usr/bin/perl

use warnings;
use strict;
use Sys::Hostname;

my($from, $recipients, @ports, @exclusions, $found, $destination, $dport);
my(@data, $hostname, $date, $ex_str, $data_str, $port_list, $lsof, $who, $ps);
my($email);

$from = 'rowland';
$recipients = 'rowland';
@ports = qw(25 587);
@exclusions = qw(127.0.0.1:25 127.0.0.1:587 164.107.115.49:25 164.107.115.49:587);

open(NETSTAT, &quot;netstat -n -p --inet |grep -v WAIT |sed '1,2d' |&quot;) or die &quot;can't open netstat&quot;;
$found = 0;

while (&lt;NETSTAT&gt;) {
    $destination = (split(/\s+/))[4];
    next if (grep { $_ eq $destination } @exclusions);
    $destination =~ /\:(\d+)$/;
    $dport = $1;
    chomp($dport);

    if (grep { $_ eq $dport } @ports) {
        $found = 1;
        chomp;
        push @data, $_;
    }
}

close(NETSTAT);

if ($found == 1) {
    $hostname = hostname;
    $date = localtime;
    $data_str = join(&quot;\n&quot;, @data);
    $ex_str = join(&quot;\n&quot;, @exclusions);
    $port_list = join(',', @ports);
    $lsof = `/usr/sbin/lsof -i TCP:$port_list`;
    $who = `who`;
    $ps = `ps -ef`;
    $email = &lt;&lt;&quot;EOF&quot;;
SMTP Port Connection Check Results
==================================

Host:  $hostname
Date:  $date
Ports: @ports

netstat
-------

Excluded Destinations:

$ex_str

Data:

$data_str

lsof
----

$lsof

who
---

$who

ps
--

$ps
EOF
    open(MAILX, &quot;|mailx -s 'SMTP Port Connection Check Results' -r $from $recipients&quot;) or die &quot;can't open mailx&quot;;
    print MAILX $email;
    close(MAILX);
}
</pre>
<p>I&#8217;ve not written a Perl script in about forever, so that&#8217;s just quickly written. I write Ruby programs these days, but I needed something in Perl on Solaris. The Perl version is much faster on Solaris, but on Linux there isn&#8217;t a performance issue with either. There are only slight differences on Solaris, but I&#8217;ll leave that as an exercise for the reader.</p>
<p>Those scripts basically catch any connections to the desired ports that don&#8217;t fall into the exception cases. This would catch many things potentially, and since we need to allow SSH port forwarding, I have these running every minute in cron as root, which is important for the <code>lsof</code> command.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunrowland.com/fsync/2012/04/17/spam-through-ssh-port-forwarding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>identd Fix</title>
		<link>http://www.shaunrowland.com/fsync/2012/02/28/identd-fix/</link>
		<comments>http://www.shaunrowland.com/fsync/2012/02/28/identd-fix/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 06:58:54 +0000</pubDate>
		<dc:creator>Shaun Rowland</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.shaunrowland.com/fsync/?p=463</guid>
		<description><![CDATA[A couple of people recently pointed out that my identd program was not working. I started an IRC client and noticed the same thing. It used to work for me, but it mysteriously stopped working. Then I remembered that I recently bought an Apple AirPort Extreme. I double checked the TCP ports using lsof on [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of people recently pointed out that my identd program was not working. I started an IRC client and noticed the same thing. It used to work for me, but it mysteriously stopped working. Then I remembered that I recently bought an Apple AirPort Extreme. I double checked the TCP ports using lsof on the IRC client process and noted that identd actually worked like it was supposed to, but since I was going through NAT, the ports didn&#8217;t match up in the query from the ircd. This really isn&#8217;t unexpected going through NAT, but this wasn&#8217;t the case with my previous wireless router. I had not thought about the possibility.</p>
<p>It&#8217;s now possible to create a /usr/local/etc/identd.user file that contains a UNIX username on one line alone. I don&#8217;t really check the contents. It will use whatever you put in that file as part of the response. I figured this was simple enough to avoid checking in order to get out a fix. If that exists before reinstalling identd, it should restart and load that data for the default user if it would otherwise respond that there is no corresponding user. This file can be created, deleted, or modified at any time. To get identd to notice, you can send a SIGUSR1 signal to it using kill:</p>
<pre class="brush: plain; title: ; notranslate">
[rowland@rowland ~]$ ps -e |grep identd |grep -v grep |awk '{print $1}'
5504
[rowland@rowland ~]$ sudo kill -USR1 5504
Password:
</pre>
<p>These details are now in the manual page. The <a href="http://rc.shaunrowland.com/gitweb/?p=identd.git;a=summary">source code</a> is in my Git repositories and the install package is available <a href="http://www.shaunrowland.com/software/identd/Ident%20Daemon.pkg">here</a>. This is the same location as before.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunrowland.com/fsync/2012/02/28/identd-fix/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Killing VNC Server Processes</title>
		<link>http://www.shaunrowland.com/fsync/2012/01/16/killing-vnc-server-processes/</link>
		<comments>http://www.shaunrowland.com/fsync/2012/01/16/killing-vnc-server-processes/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 01:15:35 +0000</pubDate>
		<dc:creator>Shaun Rowland</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[UNIX System Administration]]></category>

		<guid isPermaLink="false">http://www.shaunrowland.com/fsync/?p=453</guid>
		<description><![CDATA[I support VNC at work for our students. In the past I supported it in our CONTRIB environment on Solaris, but now it&#8217;s installed as an RPM package in RHEL 6 Workstation on our new Linux login servers. I suppose it&#8217;s quasi-supported now perhaps. Our users have to access VNC servers using an SSH tunnel, [...]]]></description>
			<content:encoded><![CDATA[<p>I support VNC at work for our students. In the past I supported it in our CONTRIB environment on Solaris, but now it&#8217;s installed as an RPM package in RHEL 6 Workstation on our new Linux login servers. I suppose it&#8217;s quasi-supported now perhaps. Our users have to access VNC servers using an SSH tunnel, and I created a <a href="http://www.cse.ohio-state.edu/~rowland/csecasts/screencasts/VNC/" title="VNC screencast">screencast</a> showing how to do this from Windows. It applies to other operating systems with obvious modifications (obvious to anyone who knows SSH well anyway :-)</p>
<p>One part of the instructions that new users (perhaps all users) don&#8217;t seem to follow is not running multiple sessions and not letting them run for more than 24 hours. I had a shell script to kill old sessions in the past, but I lost it some time ago when I was cleaning my UNIX home directory. I wrote a new Ruby program to handle this instead:</p>
<pre class="brush: ruby; title: ; notranslate">
#!/usr/local/bin/ruby

require 'ffi'
require 'ffi/tools/const_generator'

# The current short hostname.
HOSTNAME = `hostname -s`.chomp

# Proc process stat line position constants on Linux.
PID = 0
NAME = 1
STARTTIME = 21

# Proc stat line position constants on Linux.
BTIME = 6

# 24 hours ago from right now as a Time object.
DAY_AGO = Time.at(Time.now.tv_sec - 60 * 60 * 24)

# FFI interface to sysconf() to figure out the number of click ticks per
# second. This is needed to figure out the process start time since boot,
# which is given in jiffies (the number of clock ticks). This also gives
# an interface to getpwuid() to figure other user details that are needed.
module Unix
  extend FFI::Library

  class Passwd &lt; FFI::Struct
    layout :pw_name,   :string,
           :pw_passwd, :string,
           :pw_uid,    :uint32,
           :pw_gid,    :uint32,
           :pw_gecos,  :string,
           :pw_dir,    :string,
           :pw_shell,  :string
  end

  ffi_lib FFI::Library::LIBC
  attach_function 'sysconf', [:int], :long
  attach_function 'getpwuid', [:uint32], :pointer
end

cg = FFI::ConstGenerator.new do |gen|
  gen.include 'unistd.h'
  gen.const('_SC_CLK_TCK')
end

CLOCK_TICKS = Unix.sysconf(cg['_SC_CLK_TCK'].to_i)

# Figure out the boot time.
btime = nil

File.open '/proc/stat' do |file|
  btime = file.each_line.find { |s| s =~ /^btime / }
  btime = btime.split[1].to_i if btime
end

unless btime
  abort &quot;Can't determine system boot time. See above line #{__LINE__}.&quot;
end

VncServer = Struct.new(:name, :pid, :start_time, :uid, :username, :home, :gid,
                       :display)
vnc_servers = []

boot_time = Time.at(btime)
header = &quot;VNC Cleanup #{Time.now}&quot;
puts header
puts '=' * header.length
puts
puts &quot;Hostname: #{HOSTNAME}&quot;
puts &quot;Boot Time: #{boot_time}&quot;
puts &quot;Clock Ticks/Second: #{CLOCK_TICKS}&quot;
puts
puts &quot;VNC Processes&quot;
puts &quot;-------------&quot;
puts
puts &quot;* = Xvnc processes over 24 hours old that will be killed.&quot;
puts
error = false

Dir.glob('/proc/[0-9]*/stat') do |ps|
  begin
    stat = IO.read(ps).split
    name = stat[NAME]

    if name == '(Xvnc)'
      pid = stat[PID].to_i
      uid = nil
      username = nil
      home = nil
      gid = nil

      # Grab the effective UID and other user details as well.
      File.open &quot;/proc/#{pid}/status&quot; do |file|
        uid = file.each_line.find { |s| s =~ /^Uid:/ }

        if uid
          uid = uid.split[2].to_i
          passwd = Unix.getpwuid(uid)
          passwd = Unix::Passwd.new(passwd)
          username = passwd[:pw_name]
          home = passwd[:pw_dir]
          gid = passwd[:pw_gid]
        end
      end

      # Grab the display number.
      display = IO.read(&quot;/proc/#{pid}/cmdline&quot;).split(&quot;\u0000&quot;)[1]
      start_time = Time.at(btime + stat[STARTTIME].to_i / CLOCK_TICKS)
      name = name[1..-2]
      name += '*' if start_time &lt; DAY_AGO
      vnc_servers &lt;&lt; VncServer.new(name, pid, start_time, uid, username, home,
                                   gid, display)
    end
  rescue
    error = true
    puts &quot;Skipped #{ps} because process appears to have exited during run.&quot;
  end
end

puts if error
printf &quot;%-10s%-10s%-10s%-30s%-10s%-10s\n&quot;, &quot;Name&quot;, &quot;Display&quot;, &quot;PID&quot;,
       &quot;Start Time&quot;, &quot;UID&quot;, &quot;Username&quot;
printf &quot;%-10s%-10s%-10s%-30s%-10s%-10s\n&quot;, &quot;----&quot;, &quot;-------&quot;, &quot;---&quot;,
       &quot;----------&quot;, &quot;---&quot;, &quot;--------&quot;

vnc_servers.sort { |a, b| a.username &lt;=&gt; b.username }.each do |vnc|
  printf &quot;%-10s%-10s%-10d%-30s%-10s%-10s\n&quot;, vnc.name, vnc.display, vnc.pid,
         vnc.start_time, vnc.uid, vnc.username
end

if Process.euid == 0
  puts
  puts &quot;Sleeping for 5 seconds. Press ^C to cancel...&quot;
  puts
  sleep 5

  vnc_servers.sort { |a, b| a.username &lt;=&gt; b.username }.each do |vnc|
    if vnc.start_time &lt; DAY_AGO
      puts &quot;Killing VNC server on display #{vnc.display} for #{vnc.username}:&quot;
      puts
      puts &quot;\tSwitching to user #{vnc.username}.&quot;
      # This is likely overkill, but it's fine. Don't forget to change GIDs
      # first while still root of course :-) The reverse in going back doesn't
      # matter.
      Process.gid = vnc.gid
      Process.egid = vnc.gid
      Process.uid = vnc.uid
      Process.euid = vnc.uid
      # This complains, but I don't know why. I do this manually to ensure
      # everything is cleaned up.
      #status = system(&quot;vncserver -kill #{vnc.display}&quot;)
      Process.kill :TERM, vnc.pid
      log_file = &quot;#{vnc.home}/.vnc/#{HOSTNAME}#{vnc.display}.log&quot;
      pid_file = &quot;#{vnc.home}/.vnc/#{HOSTNAME}#{vnc.display}.pid&quot;
      puts &quot;\tUnlinking #{log_file}.&quot;
      File.unlink log_file
      puts &quot;\tUnlinking #{pid_file}.&quot;
      File.unlink pid_file
      puts &quot;\tSwitching to user root.&quot;
      Process.gid = 0
      Process.egid = 0
      Process.uid = 0
      Process.euid = 0
      puts
    end
  end
else
  puts
  puts &quot;Run as root to kill VNC servers.&quot;
  puts
end
</pre>
<p>That uses Ruby 1.9.2p180, which is installed in /usr/local/bin on our systems. I&#8217;m sure I&#8217;ll upgrade that soon. It also uses <a href="https://github.com/ffi/ffi/wiki/Core-Concepts" title="FFI">FFI</a>. It&#8217;s pretty elaborate for a VNC cleanup program, and it is probably overkill, but I feel it&#8217;s a little clearer than using <code>ps</code> output, though that&#8217;s completely reasonable. I wanted to use FFI though, and I need to write something that looks for processes that have too much resident memory. Another issue we have is with Eclipse processes requiring huge amounts of virtual memory, but using little resident memory. We really can&#8217;t limit RSS use on Linux, and trying to limit VSS kills Eclipse. So, I&#8217;ll use Ruby/FFI and /proc to figure out what to kill periodically, or at least just monitor the systems.</p>
<p>One thing I should note about the code above is that it is necessary to switch UIDs (probably not GIDs) to let root delete some files associated with the VNC server in the user&#8217;s <code>~/.vnc</code> directory. We don&#8217;t allow root access over NFS for login servers. I probably don&#8217;t need to switch the real UID/GID though. I had problems executing the <code>vncserver</code> command as the user. It seemed to work for the most part, but it complained that &#8220;Xvnc seems to be deadlocked.&#8221; It didn&#8217;t clean up the user PID file either. I decided to deal with it manually. Again, this is pretty much overkill, but if it&#8217;s useful for someone else on Linux, there it is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunrowland.com/fsync/2012/01/16/killing-vnc-server-processes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Launchers to the Gnome Panel</title>
		<link>http://www.shaunrowland.com/fsync/2011/09/12/adding-launchers-to-the-gnome-panel/</link>
		<comments>http://www.shaunrowland.com/fsync/2011/09/12/adding-launchers-to-the-gnome-panel/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 05:50:36 +0000</pubDate>
		<dc:creator>Shaun Rowland</dc:creator>
				<category><![CDATA[UNIX System Administration]]></category>

		<guid isPermaLink="false">http://www.shaunrowland.com/fsync/?p=440</guid>
		<description><![CDATA[I&#8217;m finally finishing my Gnome customizations for work. I&#8217;ve opened our new Red Hat Workstation 6 login servers to faculty, and I plan on going live with them next quarter in about a week and a half (or something like that anyway :-) A couple of faculty members asked me to add two launchers to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m finally finishing my Gnome customizations for work. I&#8217;ve opened our new Red Hat Workstation 6 login servers to faculty, and I plan on going live with them next quarter in about a week and a half (or something like that anyway :-) A couple of faculty members asked me to add two launchers to the Gnome Panel next to the web browsing, mail, and Gnote launchers; one launcher is for the Gnome Terminal and the other is for XEmacs. Unsurprisingly, this was kind of painful, so I am documenting it here in case it&#8217;s useful to anyone else.</p>
<p>Before I get to the details, I previously figured out how to configure Thunderbird to be the default mail client for everyone. Firefox is the default web browser, but Thunderbird is not the default mail client. I&#8217;m including that detail in the solution along with some other default setting changes I&#8217;ve done. Additionally, I installed XEmacs by hand. I couldn&#8217;t find an RHN RPM, though there is one for GNU Emacs. Not to start an XEmacs/GNU Emacs war, but I don&#8217;t see why anyone would prefer GNU Emacs really. However, to be fair, I&#8217;ve not used either for a long time. We have a specific need for XEmacs as it was chosen over GNU Emacs more than a decade ago. Personally I use TextMate and MacVim (gvim when on Unix of course). I don&#8217;t know why Red Hat requires me to use the RHEL Workstation Optional channel for much of what I need either. Why make it harder for no reason? Anyway, my first task was to create a launcher for XEmacs:</p>
<pre class="brush: bash; title: ; notranslate">
#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_US]=/usr/share/icons/gnome/scalable/apps/accessories-text-editor.svg
Name[en_US]=XEmacs
Exec=xemacs
Comment[en_US]=XEmacs editor
Name=XEmacs
Comment=XEmacs editor
Icon=/usr/share/icons/gnome/scalable/apps/accessories-text-editor.svg
</pre>
<p>I created this by hand and pulled it out of my own home directory from ~/.gnome2/panel2.d/default/launchers/xemacs.desktop. I saved it in /usr/share/applications, which had the added benefit of adding it to the Applications &#8211;> Other menu automatically (and immediately no less) thus killing two birds with one stone, though I would never do that. Birds are nice. Luckily I found a nice scalable icon that fits the bill as well. I didn&#8217;t want to grab yet another file and add it to the system, and I wanted something scalable.</p>
<p>Next I had to figure out how to add this to the Gnome Panel. In case you&#8217;re interested, the Gnome Administration Guide is <a href="http://sayamindu.randomink.org/soc/deployment_guide/deployment_guide.html" title="Gnome Administration Guide">here</a>, but it appears to be a little old. There is a lot of information about how to do this as a user, but not so much on how to set this as a default for all users. I&#8217;m not really interested in trying to use Sabayon profiles. That&#8217;s overkill for me. I just want to set default GConf values to make it work. Again, I resorted to doing this by hand and looking at the difference between find output to get an idea of where to make the changes in the /etc/gconf/gconf.xml.defaults/%gconf-tree.xml file. I was able to figure out that the changes should be additional directories under /apps/panel/objects. Note that there is an /apps/panel/default_setup/objects path as well, but I didn&#8217;t need to touch that. I added two new directories and set the same attributes under each when compared to what I did for my own user account. I logged out and in again, but it didn&#8217;t work. I messed with this forever, and I messed up some of the paths by accident when trying the default_setup path instead, so I needed to clean things up before trying what I thought might actually work. It&#8217;s always best to start with a clean slate. I used the &#8211;recursive-unset gconftool-2 option, but that left the directories. I edited the %gconf-tree.xml by hand to get it back into a pristine state and then tried the solution that worked. I did this on a virtual machine, which I suggest for any changes like this. Gnome is &#8220;touchy&#8221; IMO, and I don&#8217;t want to mess up production login servers. I should also note that settings changed in the %gconf-tree.xml file using the gconftool-2 command might not immediately be reflected in gconf-editor, probably because gconfd-2 is running from the Gnome Display Manager (or something like that is my theory).</p>
<p>When I started making default GConf changes at the beginning of this Linux migration, I tried editing the %gconf-tree.xml file manually. I quickly found that adding new packages and running updates messed up my changes. I don&#8217;t know if that&#8217;s normal, and I have some personal issues with RHN updates at times (though the benefits of a package manager outweigh these issues &#8211; that&#8217;s what I keep telling myself), so I started using gconftool-2 to make these changes directly to the %gconf-tree.xml file. My solution to this problem was to create a /usr/local/sbin/gconf-defaults script to set the proper default values:</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type list --list-type=string --set /apps/panel/applets/clock/prefs/cities '[&lt;location name=&quot;&quot; city=&quot;Columbus&quot; timezone=&quot;America/New_York&quot; latitude=&quot;39.994999&quot; longitude=&quot;-82.876389&quot; code=&quot;KCMH&quot; current=&quot;true&quot;/&gt;]'

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /desktop/gnome/url-handlers/mailto/command 'thunderbird %s'

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /desktop/gnome/url-handlers/mailto/enabled true

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /desktop/gnome/url-handlers/mailto/needs_terminal false

gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/gnome-screensaver/idle_activation_enabled false

# Terminal launcher.
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/terminal_launcher/menu_path 'applications:/'
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/terminal_launcher/launcher_location '/usr/share/applications/gnome-terminal.desktop'
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/terminal_launcher/bonobo_iid ''
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/terminal_launcher/custom_icon ''
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/panel/objects/terminal_launcher/locked false
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/panel/objects/terminal_launcher/panel_right_stick false
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/terminal_launcher/object_type 'launcher-object'
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/panel/objects/terminal_launcher/use_custom_icon false
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/terminal_launcher/tooltip ''
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/terminal_launcher/toplevel_id 'top_panel'
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/terminal_launcher/action_type 'lock'
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/panel/objects/terminal_launcher/use_menu_path false
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type int --set /apps/panel/objects/terminal_launcher/position 3
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/terminal_launcher/attached_toplevel_id ''

# XEmacs launcher
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/xemacs_launcher/menu_path 'applications:/'
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/xemacs_launcher/launcher_location '/usr/share/applications/xemacs.desktop'
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/xemacs_launcher/bonobo_iid ''
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/xemacs_launcher/custom_icon ''
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/panel/objects/xemacs_launcher/locked false
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/panel/objects/xemacs_launcher/panel_right_stick false
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/xemacs_launcher/object_type 'launcher-object'
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/panel/objects/xemacs_launcher/use_custom_icon false
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/xemacs_launcher/tooltip ''
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/xemacs_launcher/toplevel_id 'top_panel'
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/xemacs_launcher/action_type 'lock'
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type bool --set /apps/panel/objects/xemacs_launcher/use_menu_path false
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type int --set /apps/panel/objects/xemacs_launcher/position 4
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type string --set /apps/panel/objects/xemacs_launcher/attached_toplevel_id ''

# Add both to the list of objects.
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --type list --list-type=string --set /apps/panel/general/object_id_list '[menu_bar,web_launcher,email_launcher,terminal_launcher,xemacs_launcher]'
</pre>
<p>You can see the settings I used to add the two launchers. The key types and values came from doing the same thing by hand. I won&#8217;t detail all of those. This is simply about how to accomplish adding the launchers in the first place. I will note the position values of 3 and 4 though. Those were much higher values than the launchers that existed when doing this by hand, but it was clear they could be incremented as integers. I picked those values to make sure they appeared next to the other launchers in the order I desired. The terminal launcher is for an existing launcher, but the XEmacs launcher is for my own xemacs.desktop launcher file. The settings I used will place the two launchers (terminal first, XEmacs second) on the left hand side next to the web browser, mail, and Gnote launchers (technically, Gnote seems to be an applet BTW). Each new launcher gets is own directory under /apps/panel/objects, with attributes within that directory, and the final key to getting it to work was adding those object directory names to the /apps/panel/general/object_id_list list in the last gconftool-2 command. The gconf-defaults command is run in /etc/rc.local every time the machine is rebooted.</p>
<p>There are some additional bonuses in that script as well. I changed the cities for the clock applet to Columbus, Ohio. It defaulted to Boston. I also set the mail handler to Thunderbird so that clicking on the mail launcher would start what we support as a mail client. Lastly, I disabled the screensaver. Our users connect from PCs running X-Win32, and they already have a screensaver. The default was something like 1 minute too. There&#8217;s no reason to annoy our users with silly screensavers when they already have one enforced through Group Policy on their PCs.</p>
<p>I had created a /usr/local/sbin/gconf-defaults-show command to see what the settings where for what I had set at any time as well. I added additional gconftool-2 commands to show the launcher related settings:</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash

echo
echo &quot;/apps/panel/applets/clock/prefs/cities --&gt; Columbus, etc..&quot;
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --get /apps/panel/applets/clock/prefs/cities
echo

echo &quot;/desktop/gnome/url-handlers/mailto/command --&gt; thunderbird %s&quot;
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --get /desktop/gnome/url-handlers/mailto/command
echo

echo &quot;/desktop/gnome/url-handlers/mailto/enabled --&gt; true&quot;
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --get /desktop/gnome/url-handlers/mailto/enabled
echo

echo &quot;/desktop/gnome/url-handlers/mailto/needs_terminal --&gt; false&quot;
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --get /desktop/gnome/url-handlers/mailto/needs_terminal
echo

echo &quot;/apps/gnome-screensaver/idle_activation_enabled --&gt; false&quot;
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --get /apps/gnome-screensaver/idle_activation_enabled
echo

echo &quot;/apps/panel/objects/terminal_launcher --&gt; Terminal launcher settings...&quot;
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults -a /apps/panel/objects/terminal_launcher
echo

echo &quot;/apps/panel/objects/xemacs_launcher --&gt; XEmacs launcher settings...&quot;
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults -a /apps/panel/objects/xemacs_launcher
echo

echo &quot;/apps/panel/general/object_id_list --&gt; [menu_bar,web_launcher,email_launcher,terminal_launcher,xemacs_launcher]&quot;
gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --get /apps/panel/general/object_id_list
echo
</pre>
<p>The values I set for the new launchers can be seen easily with that command:</p>
<pre class="brush: plain; title: ; notranslate">
[rowland@beta ~]$ sudo gconf-defaults-show

/apps/panel/applets/clock/prefs/cities --&gt; Columbus, etc..
[&lt;location name=&quot;&quot; city=&quot;Columbus&quot; timezone=&quot;America/New_York&quot; latitude=&quot;39.994999&quot; longitude=&quot;-82.876389&quot; code=&quot;KCMH&quot; current=&quot;true&quot;/&gt;]

/desktop/gnome/url-handlers/mailto/command --&gt; thunderbird %s
thunderbird %s

/desktop/gnome/url-handlers/mailto/enabled --&gt; true
true

/desktop/gnome/url-handlers/mailto/needs_terminal --&gt; false
false

/apps/gnome-screensaver/idle_activation_enabled --&gt; false
false

/apps/panel/objects/terminal_launcher --&gt; Terminal launcher settings...
 attached_toplevel_id =
 position = 3
 use_menu_path = false
 action_type = lock
 toplevel_id = top_panel
 tooltip =
 use_custom_icon = false
 object_type = launcher-object
 panel_right_stick = false
 locked = false
 custom_icon =
 bonobo_iid =
 launcher_location = /usr/share/applications/gnome-terminal.desktop
 menu_path = applications:/

/apps/panel/objects/xemacs_launcher --&gt; XEmacs launcher settings...
 attached_toplevel_id =
 position = 4
 use_menu_path = false
 action_type = lock
 toplevel_id = top_panel
 tooltip =
 use_custom_icon = false
 object_type = launcher-object
 panel_right_stick = false
 locked = false
 custom_icon =
 bonobo_iid =
 launcher_location = /usr/share/applications/xemacs.desktop
 menu_path = applications:/

/apps/panel/general/object_id_list --&gt; [menu_bar,web_launcher,email_launcher,terminal_launcher,xemacs_launcher]
[menu_bar,web_launcher,email_launcher,terminal_launcher,xemacs_launcher]
</pre>
<p>Note that I used xml:readwrite:/etc/gconf/gconf.xml.defaults for the config source in the gconf-defaults-show command, even though I only need to read. Changing that to read or readonly doesn&#8217;t remove the warning that it&#8217;s impossible to write or save changes, even though I am just getting values, so I ran it with sudo.</p>
<p>This seems overly difficult to me. It kind of demonstrates the difficulty in using Linux as a desktop to some degree, at least from the perspective of customizing the desktop for end users. Don&#8217;t get me wrong, I&#8217;ve been a Linux fan since the beginning, but I use Mac OS X as my desktop. It should be a little easier to set GConf defaults IMO. You can use the gconf-editor, but I seem to have problems with settings getting blown away. Figuring out what to set with gconftool-2 basically requires using the gconf-editor program though. Rolling Sabayon profiles is not the solution to this specific problem either. I think that&#8217;s obvious, and it would be serious overkill. I&#8217;m not an expert on customizing Gnome, and this is the first time I&#8217;ve had to do this seriously. That being the case, this is a viable solution to the problems of setting GConf defaults and also adding launchers to the Gnome Panel.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunrowland.com/fsync/2011/09/12/adding-launchers-to-the-gnome-panel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New MacBook Air</title>
		<link>http://www.shaunrowland.com/fsync/2011/08/08/new-macbook-air/</link>
		<comments>http://www.shaunrowland.com/fsync/2011/08/08/new-macbook-air/#comments</comments>
		<pubDate>Tue, 09 Aug 2011 04:51:38 +0000</pubDate>
		<dc:creator>Shaun Rowland</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://www.shaunrowland.com/fsync/?p=436</guid>
		<description><![CDATA[I purchased a new 13&#8243; MacBook Air last week. It arrived today, though FedEx has this habit of delivering my personal Apple hardware purchases to ECE instead of CSE. I was watching the tracking like a hawk, so I picked it up from them within 30 minutes of delivery. I bought the Core i7 1.8GHz [...]]]></description>
			<content:encoded><![CDATA[<p>I purchased a new 13&#8243; MacBook Air last week. It arrived today, though FedEx has this habit of delivering my personal Apple hardware purchases to ECE instead of CSE. I was watching the tracking like a hawk, so I picked it up from them within 30 minutes of delivery. I bought the Core i7 1.8GHz processor, 4GB of RAM, and the 256GB SSD drive. It&#8217;s working very well so far. I&#8217;ve migrated everything over, and I&#8217;m almost finished with my first Time Machine backup. A quick Bonnie test shows the SSD is much faster than my other non-SSD machines:</p>
<pre class="brush: plain; title: ; notranslate">
[rowland@rowland-mba Bonnie-64]$ ./Bonnie -s 8192
File './Bonnie.399', size: 8589934592
Writing with putc()...done
Rewriting...done
Writing intelligently...done
Reading with getc()...done
Reading intelligently...done
Seeker 1...Seeker 2...Seeker 3...start 'em...done...done...done...
              -------Sequential Output-------- ---Sequential Input-- --Random--
              -Per Char- --Block--- -Rewrite-- -Per Char- --Block--- --Seeks---
Machine    GB M/sec %CPU M/sec %CPU M/sec %CPU M/sec %CPU M/sec %CPU  /sec %CPU
            8  80.4 86.5 198.8 18.8  98.2 11.6  92.2 82.8 225.2 12.4  7028 31.2
</pre>
<p>Everything seems fast. I decided that I would keep my non-SSD 27&#8243; iMac (it&#8217;s awesome otherwise) and treat this as a &#8220;real&#8221; laptop. My early-2008 MacBook Pro works fine, but it&#8217;s very bulky. It was a great desktop replacement, but I decided about a year ago to get an iMac. I was tired of carrying around the MacBook Pro, and this machine is actually faster all around.</p>
<p>I&#8217;ve dealt well with the lack of a DVD drive. I don&#8217;t think I really need one, and as far as other peripherals, I am sure the Thunderbolt connector will come in handy at some point. I don&#8217;t know about this whole 1440&#215;900 resolution though, but it is a 13&#8243; LCD, so I can mostly live with it. The LCD is not quite as good as my old MacBook Pro, but it&#8217;s still very good. I&#8217;m happy so far. That&#8217;s saying something. I&#8217;m picky about computing equipment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunrowland.com/fsync/2011/08/08/new-macbook-air/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>undefined method `init&#8217; for Mysql:Class</title>
		<link>http://www.shaunrowland.com/fsync/2011/08/01/undefined-method-init-for-mysqlclass/</link>
		<comments>http://www.shaunrowland.com/fsync/2011/08/01/undefined-method-init-for-mysqlclass/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 06:26:38 +0000</pubDate>
		<dc:creator>Shaun Rowland</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.shaunrowland.com/fsync/?p=430</guid>
		<description><![CDATA[As I mentioned in my last post, I upgraded to Mac OS X Lion as soon as it came out. I decided to upgrade MySQL from 5.1.57 to the latest 5.5.15 as well. I figured it was about time to do this on my development systems. I&#8217;m using Rails 3.1-rc4 and the mysql gem. I [...]]]></description>
			<content:encoded><![CDATA[<p>As I mentioned in my last post, I upgraded to Mac OS X Lion as soon as it came out. I decided to upgrade MySQL from 5.1.57 to the latest 5.5.15 as well. I figured it was about time to do this on my development systems. I&#8217;m using Rails 3.1-rc4 and the mysql gem. I rebuilt the mysql gem because of the new MySQL client library, but when I started my latest Rails project, I received the following error message:</p>
<pre class="brush: plain; title: ; notranslate">
NoMethodError

undefined method `init' for Mysql:Class
</pre>
<p>I saw this when I was considering moving all of this to Mac OS X Lion Server too, but since I went with Rackspace instead for now, I didn&#8217;t bother solving it immediately. But now I have to solve it in order to use the latest MySQL. I did some searching, and on Unix you can use LD_LIBRARY_PATH to solve this. On Mac OS X the equivalent is DYLD_LIBRARY_PATH, and setting that to /usr/local/mysql/lib does solve the problem. I don&#8217;t like that solution though. You can do some real magic with Mach-O binary files on Mac OS X, so I decided to wield some.</p>
<p>The problem turns out to be how the mysql_api.bundle file is linked. This is shown with the otool command:</p>
<pre class="brush: plain; title: ; notranslate">
otool -L ~/.rvm/gems/ruby-1.9.2-p180/gems/mysql-2.8.1/lib/mysql_api.bundle
/Users/rowland/.rvm/gems/ruby-1.9.2-p180/gems/mysql-2.8.1/lib/mysql_api.bundle:
	/Users/rowland/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.1.9.1.dylib (compatibility version 1.9.1, current version 1.9.1)
	libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.0.0)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
</pre>
<p>The libmysqlclient.18.dylib file was linked, but there is no path to it. I tried adding an rpath using the install_name_tool command like this:</p>
<pre class="brush: plain; title: ; notranslate">
install_name_tool -add_rpath /usr/local/mysql/lib ~/.rvm/gems/ruby-1.9.2-p180/gems/mysql-2.8.1/lib/mysql_api.bundle
</pre>
<p>and that does add an LC_RPATH command to the end:</p>
<pre class="brush: plain; title: ; notranslate">
otool -l ~/.rvm/gems/ruby-1.9.2-p180/gems/mysql-2.8.1/lib/mysql_api.bundle
&lt;snip&gt;
Load command 13
          cmd LC_RPATH
      cmdsize 40
         path /usr/local/mysql/lib (offset 12)
</pre>
<p>But that does not solve the problem. My theory is because it comes after the library itself in the file &#8220;instructions&#8221; shown with otool. I solved this another way using install_name_tool to change the actual library linking directly:</p>
<pre class="brush: plain; title: ; notranslate">
install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib ~/.rvm/gems/ruby-1.9.2-p180/gems/mysql-2.8.1/lib/mysql_api.bundle
</pre>
<p>Now otool shows the full path to the libmysqlclient.18.dylib library and everything works fine:</p>
<pre class="brush: plain; title: ; notranslate">
otool -L ~/.rvm/gems/ruby-1.9.2-p180/gems/mysql-2.8.1/lib/mysql_api.bundle/Users/rowland/.rvm/gems/ruby-1.9.2-p180/gems/mysql-2.8.1/lib/mysql_api.bundle:
	/Users/rowland/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.1.9.1.dylib (compatibility version 1.9.1, current version 1.9.1)
	/usr/local/mysql/lib/libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.0.0)
	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
</pre>
<p>Note that the path to the mysql_api.bundle file for the system Ruby on Mac OS X Lion is /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle. I love that you can do stuff like this in Mac OS X. I&#8217;ve done it before in Xcode with my BroMonitor project in setting @executable_path.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunrowland.com/fsync/2011/08/01/undefined-method-init-for-mysqlclass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Move to Rackspace</title>
		<link>http://www.shaunrowland.com/fsync/2011/08/01/the-move-to-rackspace/</link>
		<comments>http://www.shaunrowland.com/fsync/2011/08/01/the-move-to-rackspace/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 06:06:36 +0000</pubDate>
		<dc:creator>Shaun Rowland</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.shaunrowland.com/fsync/?p=426</guid>
		<description><![CDATA[I&#8217;ve been a Slicehost customer for a long time. I&#8217;ve enjoyed their service, and I&#8217;ve had a great experience. I received an email a while ago about the need to migrate Slicehost users to Rackspace since Slicehost was &#8220;going away&#8221; essentially (and they&#8217;ve been owned by Rackspace for a while now). I decided I should [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a Slicehost customer for a long time. I&#8217;ve enjoyed their service, and I&#8217;ve had a great experience. I received an email a while ago about the need to migrate Slicehost users to Rackspace since Slicehost was &#8220;going away&#8221; essentially (and they&#8217;ve been owned by Rackspace for a while now). I decided I should do something about this now because I just like to mess up my life :-) Actually, I upgraded to Mac OS X Lion immediately after it came out, and I was toying around with the idea of buying one of the new Mac Mini servers and doing colocation with <a href="http://macminicolo.net/" title="macminicolo.net">macmimicolo.net</a>. That&#8217;s really what got me started on this path. They have a great service, and I was really leaning toward them. I have an application I&#8217;m working on, and the horsepower I could get with one of the new Mac Mini servers is incredible for the price compared to Rackspace or Amazon EC2. There are serious advantages with Rackspace and Amazon EC2 when it comes to hardware issues, handling extreme load changes through scaling (we all hope for that problem :-), and storage options for large data sets. The list goes on. For now I went with Rackspace because it&#8217;s much easier to figure out the price, and they do have a great service. My personal site is cheap, so I can&#8217;t go wrong. I might reconsider this all later when I finish my application.</p>
<p>I found that my Rackspace Cloud Server performed much better with disk I/O than my Slicehost VPS though they were otherwise identical. A simple Bonnie test shows this, though there are better tests. The first is my Slicehost VPS:</p>
<pre class="brush: plain; title: ; notranslate">
[root@test:~/Bonnie-64]# ./Bonnie -s 2048
File './Bonnie.11378', size: 2147483648
Writing with putc()...done
Rewriting...done
Writing intelligently...done
Reading with getc()...done
Reading intelligently...done
Seeker 1...Seeker 2...Seeker 3...start 'em...done...done...done...
              -------Sequential Output-------- ---Sequential Input-- --Random--
              -Per Char- --Block--- -Rewrite-- -Per Char- --Block--- --Seeks---
Machine    GB M/sec %CPU M/sec %CPU M/sec %CPU M/sec %CPU M/sec %CPU  /sec %CPU
            2  39.5 96.3 100.2 29.9  37.8 10.1  33.6 64.1  70.7  9.7   289  1.7
</pre>
<p>The second is my Rackspace Cloud Server:</p>
<pre class="brush: plain; title: ; notranslate">
root@web:~/Bonnie-64# ./Bonnie -s 2048
File './Bonnie.10400', size: 2147483648
Writing with putc()...done
Rewriting...done
Writing intelligently...done
Reading with getc()...done
Reading intelligently...done
Seeker 1...Seeker 2...Seeker 3...start 'em...done...done...done...
              -------Sequential Output-------- ---Sequential Input-- --Random--
              -Per Char- --Block--- -Rewrite-- -Per Char- --Block--- --Seeks---
Machine    GB M/sec %CPU M/sec %CPU M/sec %CPU M/sec %CPU M/sec %CPU  /sec %CPU
            2  60.0 100.0 284.2 71.5  86.5 17.4  64.4 89.9 249.8 24.6   208  0.9
</pre>
<p>I&#8217;m very happy with the move so far.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunrowland.com/fsync/2011/08/01/the-move-to-rackspace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Standing Desk</title>
		<link>http://www.shaunrowland.com/fsync/2011/07/16/standing-desk/</link>
		<comments>http://www.shaunrowland.com/fsync/2011/07/16/standing-desk/#comments</comments>
		<pubDate>Sat, 16 Jul 2011 23:58:05 +0000</pubDate>
		<dc:creator>Shaun Rowland</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.shaunrowland.com/fsync/?p=417</guid>
		<description><![CDATA[I got on a standing desk kick today. I&#8217;ve been thinking that I sit way too much, and that&#8217;s probably accurate because I sit pretty much all the time aside from exercising. I&#8217;ve been way too busy to exercise lately though. Anyway, I started looking online thinking that I might get lucky with Staples or [...]]]></description>
			<content:encoded><![CDATA[<p>I got on a standing desk kick today. I&#8217;ve been thinking that I sit way too much, and that&#8217;s probably accurate because I sit pretty much all the time aside from exercising. I&#8217;ve been way too busy to exercise lately though. Anyway, I started looking online thinking that I might get lucky with Staples or something. I did find one interesting <a href="http://www.staples.com/Safco-Stand-up-35-49-Adjustable-Height-Workstation-Gray/product_636099">stand-up desk</a>, but, as I soon discovered, just about everywhere I found one (which was not often), it was delivery only. It&#8217;s like there is an anti-standing desk conspiracy :-) What I really want is a standing desk with a <a href="http://store.steelcase.com/products/walkstation/?utm_source=steelcase.com&#038;utm_medium=website&#038;utm_campaign=products">treadmill</a>, but I don&#8217;t want to pay $4,399 for one. I then remembered that I have my computer on a drawing desk (or whatever the technical term is) that is highly adjustable. I bought this back when I had decided to play around with &#8220;art&#8221;. I&#8217;m back to my computing roots now though. Apparently you can adjust the heck out of this thing, so now I have my new standing desk:</p>
<p><a href="http://www.shaunrowland.com/fsync/wp-content/uploads/2011/07/Standing-Desk.jpg"><img src="http://www.shaunrowland.com/fsync/wp-content/uploads/2011/07/Standing-Desk.jpg" alt="My Improvised Standing Desk" title="Standing Desk" width="574" height="768" class="aligncenter size-full wp-image-418" /></a></p>
<p>Note the improvised support for the heavy 27&#8243; iMac and the Tachikoma (eveyrone should have a Tachikoma). This should be interesting. My feet hurt already, but I can be dedicated to an idea. Now, if I only had a solution for work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunrowland.com/fsync/2011/07/16/standing-desk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slow Mac Mobile User Log In</title>
		<link>http://www.shaunrowland.com/fsync/2011/07/05/slow-mac-mobile-user-log-in/</link>
		<comments>http://www.shaunrowland.com/fsync/2011/07/05/slow-mac-mobile-user-log-in/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 22:33:06 +0000</pubDate>
		<dc:creator>Shaun Rowland</dc:creator>
				<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">http://www.shaunrowland.com/fsync/?p=411</guid>
		<description><![CDATA[I was asked about a problem with slow mobile user log ins for Mac OS X Snow Leopard. We configure our AD users to use mobile accounts in Snow Leopard because this allows us to enable FileVault. You can&#8217;t do that with a regular network user account, even if you force their home directory to [...]]]></description>
			<content:encoded><![CDATA[<p>I was asked about a problem with slow mobile user log ins for Mac OS X Snow Leopard. We configure our AD users to use mobile accounts in Snow Leopard because this allows us to enable FileVault. You can&#8217;t do that with a regular network user account, even if you force their home directory to be local. My theory is that this works because credentials are cached, but that&#8217;s just an off the wall theory to explain something that seems like it should work whenever the account has a local home directory but does not. It works if the account is mobile however, which automatically forces a local home directory. We also enable &#8220;Use UNC path from Active Directory to derive home location&#8221; option with the &#8220;Network protocol to be used&#8221; set as &#8220;smb&#8221;. This automatically adds a Dock icon to the network home directory, and it will appear on your desktop if you&#8217;ve changed your Finder preferences to show &#8220;Connected servers&#8221;. For this particular slowness issue, the test case user also synchronized certain folders in their Mobile Account Preferences. This all works fine if you are on your production network, but as soon as you are off network the amount of time it takes to log in is almost unbearable (for certain definitions of unbearable perhaps &#8211; it&#8217;s slow, let&#8217;s leave it at that). The user can still log in however because their credentials are cached. That&#8217;s one of the benefits of mobile accounts.</p>
<p>When logging in there is an initial delay of around 15 to 20 seconds due to the fact that the system cannot really talk to the Active Directory servers. This is tolerable though. The prompt to synchronize the home directory does appear if you have the Mobile Account Preferences configured that way, but you can cancel it. After that it took even longer for the Dock and desktop to appear, and this was the biggest problem. I solved this by making a copy of the ActiveDirectory.plist file:</p>
<pre class="brush: plain; title: ; notranslate">
sudo cp /Library/Preferences/DirectoryService/ActiveDirectory.plist /Library/Preferences/DirectoryService/ActiveDirectory.plist.orig
</pre>
<p>and then changing the value of the &#8220;AD Mount Home As Share Point&#8221; key to false (this is around line 31 or so):</p>
<pre class="brush: xml; title: ; notranslate">
&lt;key&gt;AD Mount Home As Share Point&lt;/key&gt;
&lt;false/&gt;
</pre>
<p>A number of those settings near the top come from the GUI configuration. This setting does not, and it does not change the values for the UNC home directory path or SMB protocol I mentioned previously, but this does keep the system from mounting the home directory as a share on the Dock and desktop. This avoids the biggest part of the log in delay. Once that&#8217;s edited, you can restart the DirectoryService process by simply killing it:</p>
<pre class="brush: plain; title: ; notranslate">
sudo killall DirectoryService
</pre>
<p>The launchd process will happily restart it. It is still possible to connect to a home directory share in finder and possibly put something on the Dock for that connection, but this keeps the system from trying to mount a share it cannot when off network. It would be nice if the system had the ability to define network locations in such a way as to not attempt Active Directory authentication or home drive mapping when off of the production network, but I&#8217;ve not found that kind of setting yet. I&#8217;m still looking though. We&#8217;ll see how Mac OS X Lion deals with this. At least FileVault should be nicer there since it will do full disk encryption, but I have some questions about how that will work of course.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunrowland.com/fsync/2011/07/05/slow-mac-mobile-user-log-in/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Slow X11 Queries to Gnome Desktop in RHEL 6</title>
		<link>http://www.shaunrowland.com/fsync/2011/06/07/slow-x11-queries-to-gnome-desktop-in-rhel-6/</link>
		<comments>http://www.shaunrowland.com/fsync/2011/06/07/slow-x11-queries-to-gnome-desktop-in-rhel-6/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 00:02:03 +0000</pubDate>
		<dc:creator>Shaun Rowland</dc:creator>
				<category><![CDATA[UNIX System Administration]]></category>

		<guid isPermaLink="false">http://www.shaunrowland.com/fsync/?p=401</guid>
		<description><![CDATA[All of our Linux users do remote X11 queries to get a fully graphical user interface. We never seemed to have an issue with that until Red Enterprise Linux 5. I vaguely recalled some issue with slowness logging out of the Gnome desktop with RHEL 5. It only happened when logging out, and it caused [...]]]></description>
			<content:encoded><![CDATA[<p>All of our Linux users do remote X11 queries to get a fully graphical user interface. We never seemed to have an issue with that until Red Enterprise Linux 5. I vaguely recalled some issue with slowness logging out of the Gnome desktop with RHEL 5. It only happened when logging out, and it caused a significant delay &#8211; more than a couple of minutes if I recall correctly. My first solution for RHEL 5 was to use a firewall rule on the Linux server itself to block traffic as I describe below, but I really didn&#8217;t need a firewall rule. I seem to have went through the same exact process with RHEL 6 in troubleshooting this problem. I ended up skipping RHEL 5 in favor of RHEL 6 for our Linux migration. Our Linux migration has been that slow due to my heavy workload.</p>
<p>One of our staff members was testing my RHEL 6 build and noticed that moving the mouse on menu items was very slow. It took way too long for the menus to drop down in Firefox for example. Switching between virtual desktops was agony as well. I had not noticed this when doing a remote X11 query from my Mac, though that has its own problems that I will touch on later. I confirmed that this also happened on my Windows PC, though for some reason I had not noticed it before. This might have been the result of a software update, but it&#8217;s likely I just had not noticed since I work from my Mac most of the time. Since I had recalled the previous issue, I had a theory that the Linux server was trying to send something over TCP to the Windows PC. I fired up tcpdump and captured some packets, but I then also recalled how hard it was to dig this specific situation out of all of the traffic X11 generates. I moved my Windows PC into a special Active Directory OU that has the Windows firewall disabled in Group Policy. This made it very clear what traffic was being rejected:</p>
<pre class="brush: plain; title: ; notranslate">
No.     Time        Source                Destination           Protocol Info
    251 2.314295    164.107.112.68        164.107.120.111       TCP      59337 &gt; 4713 [SYN] Seq=0 Win=5840 Len=0 MSS=1460 SACK_PERM=1 TSV=1031870027 TSER=0

...

No.     Time        Source                Destination           Protocol Info
    252 2.314412    164.107.120.111       164.107.112.68        TCP      4713 &gt; 59337 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
</pre>
<p>Getting that reset when trying to connect to port 4713 on the Windows PC is what makes things work &#8220;normally&#8221; (not slow in other words). The Windows firewall only drops packets as far as I know, and that&#8217;s what makes it slow. This only affected logging out in RHEL 5, but in RHEL 6 it affects much more apparently. My first solution was to add the following iptables firewall rule on the Linux server to cause the same effect as a Windows PC with no firewall:</p>
<pre class="brush: plain; title: ; notranslate">
# This keeps PulseAudio from contacting the remote client. With the our PC
# client firewalls, the attempt is dropped instead of rejected, so it ends
# up slowing everything down in the UI. This will immediately reject with
# a TCP reset and make things &quot;normal&quot; again.
-A OUTPUT -p tcp --dport 4713 -j REJECT --reject-with tcp-reset
</pre>
<p>As you can see from the comment, this is because of PulseAudio. I ripped most of PulseAudio out, but I couldn&#8217;t remove the libraries due to RPM dependencies. I like this more than the Windows firewall being open on that port because it keeps the traffic from going out on the network in the first place. I then remembered how I ended up solving this problem on RHEL 5 without using a firewall rule by adding the following to /etc/X11/xinit/xinitrc-common:</p>
<pre class="brush: plain; title: ; notranslate">
# Direct Enlightenment Sound Daemon traffic to the bit bucket (port 9) of
# the localhost. Nothing is listening there, so this will cause ESD traffic
# to immediately fail. The firewall can also be used, but this seems to
# introduce a 3 second delay (even when tcp-reset is used). We picked port
# 9 because that was not used and it is reserved, so no regular users would
# end up listening there. This fixes the logout hang from XDMCP sessions.
#
#                                               --rowland
export ESPEAKER=&quot;127.0.0.1:9&quot;
</pre>
<p>I did not have the delay I mentioned in the comments on RHEL 6, but doing something like the above is preferable to the firewall rule in my opinion. It turns out you can do the same thing with PulseAudio by setting the PULSE_SERVER environment variable or adding the following to /etc/pulse/client.conf:</p>
<pre class="brush: plain; title: ; notranslate">
default-server = 127.0.0.0:9
</pre>
<p>That&#8217;s the solution I went with instead of the firewall rule, almost like last time with RHEL 5. If you have slow X11 queries to your RHEL 6 server, this might be the problem.</p>
<p>As far as X11 queries from a Mac goes, I had major issues logging in through GDM. I could type my username, but when I went to type my password the keyboard mappings were totally messed up from that point forward. Nothing I did made a difference. Apparently this has to do with the X Keyboard Extension. There is a -kb command line option to disable that, but it causes the X server to crash on a Mac. I had no luck in getting this to work with the newer version of XQuartz either. The only way I could do an X11 query was to use the nested X server like so:</p>
<pre class="brush: plain; title: ; notranslate">
Xnest -kb -fp tcp/&lt;hostname&gt;:7100 -query &lt;hostname&gt;
</pre>
<p>The &#8220;&lt;hostname&gt;&#8221; value should be replaced with the actual hostname of course. That actually works with the -kb option, and it only crashes every once in a while :-) So, it&#8217;s not perfect, but there are few Mac users in our environment, and they already have Unix with a much better user interface anyway. X11 &#8211; fun times indeed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaunrowland.com/fsync/2011/06/07/slow-x11-queries-to-gnome-desktop-in-rhel-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

