Wednesday, June 24, 2009

How to Find Dangling Symlinks

Sometimes, you need to find all symbolic links which point to a non-existant target (aka, a dangling symlink).  Well, I found[1] an easy way to dig them up...
find -L . -type l
And the best part is, it's portable (well, it works on RHEL5, Ubuntu 6.06, and Mac OS X 10.5).  Another way[2] to do it with GNU find is...
find . -follow -lname '*'
[1] http://linux.derkeiler.com/Mailing-Lists/Debian/2006-06/msg01907.html
[2] http://mail.milwaukeelug.org/wws/arc/mlug-list/2007-03/msg00243.html

Wednesday, June 17, 2009

RHEL5 and Firewire

It took a while, but I finally figured out how to fully enable firewire in RHEL5.3.

Because firewire is still a "Technology Preview" in RHEL5.3, you must disable the blacklisting of the kernel module in /etc/modprobe.d/blacklist-firewire
# Comment out the next line to enable the firewire drivers
#blacklist firewire-ohci
But that's not all you have to do... Oh no... In order for the drive to be visible in your file manager (we use Xfce, but it also applies to Gnome), you must also mark the drive as "hotpluggable" in HAL. Why it isn't done so automatically, I don't know.

Create or update the file /etc/hal/fdi/policy/preferences.fdi with this code:
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->
<deviceinfo version="0.2">
<device>
<match key="@info.parent:@info.parent:@info.parent:info.linux.driver" string="firewire_ohci">
<match key="info.category" string="storage">
<match key="storage.drive_type" string="disk">
<merge key="storage.hotpluggable" type="bool">true</merge>
</match>
</match>
</match>
</device>
</deviceinfo>
Now, I don't know if that's the best matching, but it works.