<?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: Tag linux</title>
    <link>http://blog.moertel.com/articles/tag/linux?tag=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>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>
  </channel>
</rss>
