<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Tom Moertel's Weblog: Category linux</title>
    <link>http://blog.moertel.com/articles/category/linux</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Quality rants on programming theory and stuff geeks like</description>
    <item>
      <title>How to hotsync the Palm Centro with a Fedora 7 Linux desktop via USB</title>
      <description>&lt;p&gt;I just got a Palm Centro smartphone, and I love it. Getting it to sync
with my Linux workstation, however, was tricky, so I&amp;#8217;m posting this
recipe in hopes that it might save you some time.&lt;/p&gt;


	&lt;p&gt;The &amp;#8220;visor&amp;#8221; kernel driver is supposed to make compatible Palm
handhelds look like serial devices when attached via a &lt;span class="caps"&gt;USB&lt;/span&gt; cable.  For
me, it didn&amp;#8217;t work.  Instead, I had to blacklist the driver and
then use libusb to talk to the Centro.  Here&amp;#8217;s the recipe:&lt;/p&gt;


	&lt;p&gt;First, blacklist the &amp;#8220;visor&amp;#8221; kernel driver:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;# echo blacklist visor &amp;gt;&amp;gt; /etc/modprobe.conf
# modprobe -qr visor
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Second, make sure libusb is installed:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;# yum install libusb
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Third, edit the system&amp;#8217;s udev rules to make sure your user account can
access the device files used to talk to the Centro.  On my Fedora 7
setup, I found the right rule in /etc/udev/rules.d/50-udev.rules:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;ACTION=="add", SUBSYSTEM=="usb_endpoint", \
ATTR{bEndpointAddress}=="?*", ATTRS{devnum}=="?*", ATTRS{busnum}=="?*", \
NAME="bus/usb/$attr{busnum}/$attr{devnum}_ep/$attr{bEndpointAddress}", \
MODE="0644", SYMLINK+="%k" 
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;I edited the last line of the rule, changing the mode to 0664 and adding
a &lt;span class="caps"&gt;GROUP&lt;/span&gt; key to assign the Centro devices to my exclusive user group:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;MODE="0664", SYMLINK+="%k", GROUP="thor" 
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;This change lets my account talk to the Centro without having to
take on root privileges. (For bonus points you could set up a more-specific rule to match just your Centro. The rule above, as is, will actually match other devices, too.)&lt;/p&gt;


	&lt;p&gt;Fourth, tell udev to reload the rules:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;# udevcontrol reload_rules
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Finally, set up a Palm-device connection via gnome-pilot.  Be sure to
select &lt;span class="caps"&gt;USB&lt;/span&gt; for the Type and &amp;#8220;usb:&amp;#8221; from the Device drop-down list.&lt;/p&gt;


	&lt;p&gt;That&amp;#8217;s it.  If you&amp;#8217;re lucky like me, you should now be ready to
hotsync your Palm Centro!&lt;/p&gt;


&lt;div class="update"&gt;

	&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Even better, &lt;a href="http://howto.pilot-link.org/bluesync/index.html"&gt;this handy &lt;span class="caps"&gt;HOWTO&lt;/span&gt;&lt;/a&gt; shows you to
sync via Bluetooth, which is more convenient than hooking up a &lt;span class="caps"&gt;USB&lt;/span&gt;
cable.  I&amp;#8217;m now using this method.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Update 2:&lt;/strong&gt; If you want to use &lt;span class="caps"&gt;USB&lt;/span&gt; to hotsync your Centro, there is a
method that&amp;#8217;s more convenient than setting up udev rules.  Just create a perms file for
pam_console_apply that tells it to give the console user permission to
access your Centro.  To do so, create a file
/etc/security/console.perms.d/60-libpisock.perms and put the following in it:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;&amp;lt;libpisock&amp;gt;=/dev/usbdev* /dev/bus/usb/[0-9]*/[0-9]*
&amp;lt;console&amp;gt; 0644 &amp;lt;libpisock&amp;gt; 0644 root
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;That&amp;#8217;s it. (You&amp;#8217;ll still need to use libusb.)&lt;/p&gt;


&lt;/div&gt;</description>
      <pubDate>Wed, 31 Oct 2007 00:35:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:32b55049-6f05-4eae-8d46-3c1c350afa4f</guid>
      <author>Tom Moertel</author>
      <link>http://blog.moertel.com/articles/2007/10/31/how-to-hotsync-the-palm-centro-with-a-fedora-7-linux-desktop-via-usb</link>
      <category>linux</category>
      <category>linux</category>
      <category>fedora</category>
      <category>palm</category>
      <category>centro</category>
      <category>hotsync</category>
      <category>usb</category>
      <trackback:ping>http://blog.moertel.com/articles/trackback/608</trackback:ping>
    </item>
    <item>
      <title>My upgrade to Fedora 7: rocky start but great finish</title>
      <description>&lt;p&gt;Tonight I upgraded my main workstation from Fedora Core 6 to Fedora 7.
The result is an impressively polished working environment.
Everything is snappy and crisp.  I love it.  Kudos to the Fedora team!&lt;/p&gt;


	&lt;p&gt;Getting Fedora 7 to boot, however, took some doing.&lt;/p&gt;


	&lt;p&gt;After the upgrade, my workstation rebooted &amp;#8211; and then hung.  The
problem was that the &lt;strong&gt;raid456&lt;/strong&gt; module wasn&amp;#8217;t getting loaded by the
kernel, and thus the kernel couldn&amp;#8217;t detect my &lt;span class="caps"&gt;RAID&lt;/span&gt;-5 root filesystem,
and thus &lt;em&gt;Halt&lt;/em&gt;.&lt;/p&gt;


	&lt;p&gt;Interestingly, the corresponding error in the kernel boot log
said that the module couldn&amp;#8217;t be loaded because it &lt;em&gt;existed&lt;/em&gt;:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;error inserting /lib/raid456.ko: file exists&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;What&amp;#8217;s the problem?  The file is &lt;em&gt;there&lt;/em&gt;, isn&amp;#8217;t it?  You just said so!&lt;/p&gt;


	&lt;p&gt;Booting into the install &lt;span class="caps"&gt;DVD&lt;/span&gt;&amp;#8217;s rescue mode (very handy), I ran
&lt;strong&gt;mkinitrd&lt;/strong&gt; by hand to rebuild the initial disk image that primes the
kernel with the modules it needs to boot the system.  (An older
version of &lt;strong&gt;mkinitrd&lt;/strong&gt; would sometimes forget to add the &lt;strong&gt;raid456&lt;/strong&gt;
module to the image, so I figured maybe that&amp;#8217;s what the cryptic error
message was hinting at.) I added the &lt;strong&gt;-v&lt;/strong&gt; flag to the
command line to see what was really going on and caught this
interesting tidbit:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;# kver=`uname -r`
# mkinitrd -v -f /boot/initrd-$kver.img $kver

...
Adding module ext3
Adding module xor
Adding module raid456
Adding module raid456   &amp;lt;&amp;lt;== FLAMIN' MONKEY EYES TIMES TWO!
Adding module scsi_mod
Adding module sd_mod
...
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;The &lt;strong&gt;raid456&lt;/strong&gt; module was, for some reason, being added to the image
twice.  That redundancy, I reasoned, is what caused the cryptic error
message in the boot log.  The module couldn&amp;#8217;t be inserted because it
&lt;em&gt;already&lt;/em&gt; existed!  That theory approximately made sense, so I ran
with it.&lt;/p&gt;


	&lt;p&gt;Thus I had to edit the code for mkinitrd to prevent it from trying
to add the module twice.  Then I used my adjusted version of the tool
to rebuild the initial disk image. Finally, I rebooted the system
and &amp;#8211; with fingers crossed for luck &amp;#8211; entered the glorious world of Fedora 7.&lt;/p&gt;


	&lt;p&gt;Almost.  Neither the &lt;strong&gt;nv&lt;/strong&gt; nor the &lt;strong&gt;nouveau&lt;/strong&gt; driver for X.Org &lt;span class="caps"&gt;X11&lt;/span&gt; detected the
true geometry of my Dell 2001FP monitor.  So I had to slink back to
the non-free nVidia driver to get my full resolution back.&lt;/p&gt;


	&lt;p&gt;Those two issues aside, the whole process was delightful.&lt;/p&gt;


	&lt;p&gt;And, now that I&amp;#8217;m using Fedora 7, it&amp;#8217;s rockin&amp;#8217;.  
Just what my workstation needed.&lt;/p&gt;</description>
      <pubDate>Thu, 07 Jun 2007 00:43:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:1540bee5-be21-4106-8502-7ccb074becad</guid>
      <author>Tom Moertel</author>
      <link>http://blog.moertel.com/articles/2007/06/07/my-upgrade-to-fedora-7-rocky-start-but-great-finish</link>
      <category>linux</category>
      <category>linux</category>
      <category>fedora7</category>
      <trackback:ping>http://blog.moertel.com/articles/trackback/472</trackback:ping>
    </item>
    <item>
      <title>New Fedora Core RPMS for CRAN packages arm, Matrix, lme4, car, coda, leaps, and mlmRev</title>
      <description>&lt;p&gt;Just a quick note for folks using the &lt;a href="http://www.r-project.org"&gt;R statistics
system&lt;/a&gt; on &lt;a href="http://fedoraproject.org/"&gt;Fedora
Linux&lt;/a&gt;.  I have packaged for Fedora a
bunch of R packages from the &lt;a href="http://cran.r-project.org/"&gt;&lt;span class="caps"&gt;CRAN&lt;/span&gt;&lt;/a&gt;.  (R
packages have to be packaged again, as &lt;span class="caps"&gt;RPM&lt;/span&gt; packages, to integrate with
Fedora Linux.)&lt;/p&gt;


	&lt;p&gt;My initial goal was to package
&lt;a href="http://cran.r-project.org/src/contrib/Descriptions/arm.html"&gt;arm&lt;/a&gt;,
which contains tools for working with various regression models.
(This package accompanies Andrew Gelman and Jennifer Hill&amp;#8217;s wonderful
book &lt;a href="http://www.amazon.com/exec/obidos/ASIN/0521867061/ref=nosim/tommoertesweb-20"&gt;Data Analysis Using Regression and Multilevel/Hierarchical Models&lt;/a&gt;.)
Packaging &amp;#8220;arm,&amp;#8221; however, quickly snowballed into packaging a bunch of
prerequisites.  Thankfully, I have now completed that task and can
share the fruits of my labor with you.&lt;/p&gt;


	&lt;p&gt;All in all, to install &amp;#8220;arm,&amp;#8221; you will need the following RPMs:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;R-arm-1.0-2&lt;/li&gt;
		&lt;li&gt;R-car-1.2-1&lt;/li&gt;
		&lt;li&gt;R-lme4-0.9975-1&lt;/li&gt;
		&lt;li&gt;R-Matrix-0.9975-1&lt;/li&gt;
		&lt;li&gt;R-R2WinBUGS-2.0-1&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;The following RPMs are optional (but you will need them if you
want to rebuild the RPMs):&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;R-coda-0.10-1&lt;/li&gt;
		&lt;li&gt;R-leaps-2.7-1&lt;/li&gt;
		&lt;li&gt;R-mlmRev-0.995-1&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;You can download the packages from the &lt;a href="http://community.moertel.com/ss/space/RPMs"&gt;RPMs
section&lt;/a&gt; of the Community
Projects site.  Better yet, you can use Yum to
download them for you.  Just add the &lt;em&gt;moertel-community&lt;/em&gt;
Yum repository to your /etc/yum.repos.d directory (see &lt;a href="http://community.moertel.com/ss/space/RPMs"&gt;RPMs&lt;/a&gt; for the recipe) and then use the
following command:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;$ sudo yum install R-arm
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Yum will automatically resolve dependencies and install the required
packages.  If you want any of the optional packages, add them after
&amp;#8220;R-arm&amp;#8221; on the command line.&lt;/p&gt;


	&lt;p&gt;I have built the packages for Fedora Core 6 on the x86_64 architecture, but the
&lt;a href="http://community.moertel.com/rpms/fedora/6/SPECS/"&gt;&lt;span class="caps"&gt;RPM&lt;/span&gt; specs are available&lt;/a&gt;
if you want to rebuild the packages for other architectures.  (See
the instructions for &lt;a href="http://community.moertel.com/ss/space/Rebuilding+RPMs"&gt;rebuilding RPMs&lt;/a&gt; for help.)&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Caveat:&lt;/strong&gt;
I&amp;#8217;m not sure that the R-R2WinBUGS package is fully functional.  It
depends on BRugs, which doesn&amp;#8217;t yet build on the Linux platform.  To
get around this problem, I made R-R2WinBUGS&amp;#8217;s dependency on BRugs
weak; the first package no longer requires the second to install.&lt;/p&gt;</description>
      <pubDate>Wed, 25 Apr 2007 14:07:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:1f62fc7e-a01e-462d-b4ca-e7d8f92f3648</guid>
      <author>Tom Moertel</author>
      <link>http://blog.moertel.com/articles/2007/04/25/new-fedora-core-rpms-for-cran-packages</link>
      <category>statistics</category>
      <category>linux</category>
      <category>fedora</category>
      <category>R</category>
      <category>statistics</category>
      <category>rpms</category>
      <trackback:ping>http://blog.moertel.com/articles/trackback/446</trackback:ping>
    </item>
    <item>
      <title>How to make sure your servers come back up after an extended power outage</title>
      <description>&lt;p&gt;If an extended power outage drains your &lt;span class="caps"&gt;UPS&lt;/span&gt;, and your servers are
forced to shut down, will they automatically start up again when the
power is eventually restored?  It&amp;#8217;s a good question, especially
if your servers are in some distant, unattended server room.
Unless you&amp;#8217;ve tested your servers, don&amp;#8217;t assume that the answer
is Yes.&lt;/p&gt;


	&lt;p&gt;Many servers offer a &lt;span class="caps"&gt;BIOS&lt;/span&gt; configuration option that forces them to
automatically power on when they receive line voltage.  If your
servers have this option, just set it and you&amp;#8217;re done.&lt;/p&gt;


	&lt;p&gt;Unfortunately, some servers, including a Dell PowerEdge 1600SC
that I&amp;#8217;m using, lack this configuration option.  When these servers
turn themselves off as the final step of a &lt;span class="caps"&gt;UPS&lt;/span&gt;-controlled
shutdown, they don&amp;#8217;t start up again when the power is restored.
Because they were shut down &lt;em&gt;before&lt;/em&gt; the power was cut off, they think
they are supposed to remain off when the power is restored.  That is,
they remember their on/off status across power outages.&lt;/p&gt;


	&lt;p&gt;Fortunately, there is a way to make sure these servers automatically
power on: shut them  down without powering them off; halt them
instead.  That way, when the &lt;span class="caps"&gt;UPS&lt;/span&gt; finally cuts off the supply voltage,
the servers will still be in their &amp;#8220;on&amp;#8221; state, and they will remember
this state across the outage. Later, when the power is restored, the servers
will automatically restore their pre-outage state and power up.&lt;/p&gt;


	&lt;p&gt;With Fedora Core Linux and &lt;a href="http://www.networkupstools.org/"&gt;Network &lt;span class="caps"&gt;UPS&lt;/span&gt;
Tools&lt;/a&gt;, it&amp;#8217;s not difficult to make
sure the servers are halted instead of powered off, but the implementation
isn&amp;#8217;t obvious.  To spare you the digging, here are the
important bits.&lt;/p&gt;


&lt;ol&gt;

&lt;li&gt;When the power fails and the &lt;span class="caps"&gt;UPS&lt;/span&gt;-monitoring software decides that
the batteries are almost depleted, it will initiate a server shutdown
using the command defined in the &lt;code&gt;/etc/ups/upsmon.conf&lt;/code&gt;
file.  The default command is this:

&lt;pre&gt;&lt;code&gt;SHUTDOWNCMD "/sbin/shutdown -h +0" 
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;The shutdown command will tell the &lt;code&gt;init&lt;/code&gt; process
to enter runlevel 0, which is the prepare-to-halt-the-system runlevel.&lt;/li&gt;

&lt;li&gt;The &lt;code&gt;init&lt;/code&gt; process will stop all of the running
services in an orderly fashion, and then, as the last step, invoke the
final script in the shutdown process:
&lt;code&gt;/etc/rc.d/rc0.d/S01halt&lt;/code&gt;.&lt;/li&gt;

&lt;li&gt;The final lines of the &lt;code&gt;S01halt&lt;/code&gt; script will
power off the server.  Unless, that is, the file &lt;code&gt;/halt&lt;/code&gt; is
present, in which case the script will halt the server instead.&lt;/li&gt;

&lt;/ol&gt;

	&lt;p&gt;Thus the trick is to make sure that the &lt;code&gt;/halt&lt;/code&gt;
file &lt;em&gt;does&lt;/em&gt; exist.  The trick turns out to be easy to pull off;
just redefine the shutdown command in &lt;code&gt;/etc/ups/upsmon.conf&lt;/code&gt;:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;SHUTDOWNCMD "/bin/touch /halt; /sbin/shutdown -h +0" 
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;And that&amp;#8217;s all there is to it!&lt;/p&gt;</description>
      <pubDate>Wed, 09 Aug 2006 00:35:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:488c24a8-dcb3-4015-8d8e-09f6267e6051</guid>
      <author>Tom Moertel</author>
      <link>http://blog.moertel.com/articles/2006/08/09/how-to-make-sure-your-servers-come-back-up-after-an-extended-power-outage</link>
      <category>linux</category>
      <category>hardware</category>
      <category>sysadmin</category>
      <category>hardware</category>
      <category>ups</category>
      <category>linux</category>
      <category>fedora</category>
      <category>nut</category>
      <category>power</category>
      <category>shutdown</category>
      <category>halt</category>
      <trackback:ping>http://blog.moertel.com/articles/trackback/151</trackback:ping>
    </item>
    <item>
      <title>Linux just works</title>
      <description>&lt;p&gt;Sam Ruby writes about his overall experience with Ubuntu Linux in contrast
with Microsoft Windows in
&lt;a href="http://www.intertwingly.net/blog/2005/11/01/It-Just-Works"&gt;It Just Works&lt;/a&gt;:&lt;/p&gt;


&lt;blockquote&gt;Convenience.  Security.  Predictability.  More options.
Less hassle. I like that.
&lt;/blockquote&gt;

	&lt;p&gt;That&amp;#8217;s exactly why I switched to Linux, too.&lt;/p&gt;


	&lt;p&gt;In April 2004, my main Win2k workstation&amp;#8217;s hard drive failed.  When the replacement hard drive arrived, I tried to reinstall Win2k from the original installation CD.  I failed. The CD, from 1999, contained an out-of-date version of Win2k that no longer could recognize my computer&amp;#8217;s hardware. But, because of Microsoft&amp;#8217;s licensing terms, I was required to reinstall from that CD (the one tied to my CD Key and Certificate of Authenticity).&lt;/p&gt;


	&lt;p&gt;I kept a &lt;a href="http://www.hulver.com/scoop/story/2004/4/12/165455/594"&gt;log of the re-installation process&lt;/a&gt;, and it&amp;#8217;s not pretty. I wasted five hours trying to re-install Win2k before giving up.&lt;/p&gt;


	&lt;p&gt;Then &lt;a href="http://www.hulver.com/scoop/story/2004/4/13/234426/378"&gt;I installed Fedora Core Linux&lt;/a&gt;. It took about thirty minutes, was painless, and mostly occurred automatically &amp;#8211; while I was walking my dog.  It just worked.&lt;/p&gt;


	&lt;p&gt;Today, I am writing this post on the very same workstation, happily running Fedora Core Linux 4. It just works.  And I love it.&lt;/p&gt;


	&lt;p&gt;I don&amp;#8217;t miss Windows. And I &lt;em&gt;certainly&lt;/em&gt; don&amp;#8217;t miss having to jump through licensing-scheme hoops. Instead, I can focus on getting my work done.&lt;/p&gt;


	&lt;p&gt;It&amp;#8217;s a great feeling, being able to do my work on my own terms.  I don&amp;#8217;t think I&amp;#8217;ll ever go back.&lt;/p&gt;</description>
      <pubDate>Wed, 02 Nov 2005 11:50:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:757e97f45df7083d863977760a464c56</guid>
      <author>Tom Moertel</author>
      <link>http://blog.moertel.com/articles/2005/11/02/linux-just-works</link>
      <category>linux</category>
      <trackback:ping>http://blog.moertel.com/articles/trackback/12</trackback:ping>
    </item>
  </channel>
</rss>
