Saturday, May 17, 2008

Automounting Kubuntu NFS Shares in OS X Leopard

I discovered this feature in OS X Leopard by accident. I thought I was sshed into my Kubuntu home server. I was having some problems with my NFS sharing setup across my MacBook Pro and Kubuntu boxes. I resolved the problem very easily by editing the nfs defaults file and making sure stats and idmap2 were enabled.

I was still having problems with a Seagate external USB drive. I had previously dealt with the problem of the drive going to sleep forever by using sdparm to change the sleep timeout to a day and had a cron script tap the drive twice a day. But the drive had been getting noticibly louder from constantly spinning. A little research turned up an elegant fix using udev to set the drive can be restarted /sys filesystem attribute to true on creating the device node for the drive.

Here's the trick for reference:

$ cat /etc/udev/rules.d/local.rules
# Seagate FreeAgent allow_restart fix (i/o errors)
SUBSYSTEMS=="scsi",DRIVERS=="sd",ATTRS{vendor}=="Seagate*", ATTRS{model}=="FreeAgent*",RUN+="/bin/sh -c 'echo 1 > /sys/class/scsi_disk/%k/allow_restart'"

Now back to problem of the drive not mounting on boot. I decided to install the autofsd and automount tools. So that whether or not the drive showed up at at a different SCSI device address it would mount at the same place. I also wanted any access to the Seagate external drive to kick off a mount if the Seagate external USB wasn't already mounted and for the filesystem to be umounted when idle.

Using automount/autofs would kill two problems I was having. The first problem was that the drive wasn't unmounting before it went to sleep. Leaving the filesystem locked and mounted to the ghost device. The second problem was that I couldn't count on the drive being at the same device name. I'm using the drive as the location of my MythTV recording directory and for my shared network file storage.

Enabled auto.misc in /etc/auto.master and added these lines to /etc/auto.misc:

mythtv -fstype=reiserfs :LABEL=500gusb
ubuntu -fstype=iso9660,loop,ro :/mythtv/downloads/ubuntu-8.04-desktop-i386.iso

I tried to get them to mount off the root filesystem but that is apparently a no no for automounting. At least it didn't work for me. A little filesystem linking covered that up. Notice the fine LABEL= device syntax. :) I added the Ubuntu ISO automounting and sharing so my other Kubuntu boxes could upgrade using the CD over NFS. I left the autofs loop in there since it is pretty light weight. It only mounts the image on access and unmounts it while idle. It inspired me to fiddle with the /etc/auto.master on all the Kubuntu boxes and enable Allowing me to access the shared automounted filesystems with a simple reference to /net/<hostname>/<sharename>.

The /etc/exports (I decided to export each automount individually because NFS complained in the logs about exporting /misc even though it worked with the crossmount option.):

/misc/mythtv *.local(rw,async,nohide,no_root_squash,no_subtree_check,insecure)
/misc/ubuntu *.local(rw,async,nohide,no_root_squash,no_subtree_check,insecure)

Which brings me back to my original point of accidentily finding that Mac OS X Leopard is using the proper script and that it is enabled by default. Meaning ls /net/<hostname>/<sharename> automounts NFS shares - no configuration needed. Allowing me to get rid of my netinfo custom automounts located under /mounts in the local netinfo directory. I then turned my /mythtv directory into a link using sudo -s and then ln -s /net/<hostname>/misc/mythtv /mythtv (I don't give my everyday account blanket sudo permissions ergo sudo -s first in order to execute a command without explicit sudo rights being granted).

One final note. Don't let the Finder make your links for you. The aliases Finder creates are not soft links and are invisible to the POSIX subsystem and even some Cocoa apps. Found that out the hard way. Even scared me for a bit after all that fine setup work. Nearly wiped the smug look off my face.

Saturday, May 3, 2008

Ubuntu or Kubuntu on a IBM Thinkpad T21 or T22 Video Driver Fix

I recently upgraded to Ubuntu 8.04 Hardy Heron and experienced problems with Xorg and my savage video card.  Traced it back to the AGPSize and AGPMode options for the savage driver.  Now have working 3D acceleration aka DRI and AIGLX.  I've been missing that since the upgrade to version 7.xx.  Turns out AGPSize defaults to a 16MB window which causes a lockup or failure on my IBM Thinkpad T21 and T22 with acceleration turned on.  The Thinkpads have only 8MB video ram.

FYI I actually use Kubuntu but I upgraded all my Kubuntu systems just fine using the Ubuntu CD.

The working, 3D accelerated xorg.conf from my IBM Thinkpad T22:

# xorg.conf (X.Org X Window System server configuration file)
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#   sudo dpkg-reconfigure -phigh xserver-xorg

Section "InputDevice"
    Identifier    "Generic Keyboard"
    Driver        "kbd"
    Option        "XkbRules"    "xorg"
    Option        "XkbModel"    "pc101"
    Option        "XkbLayout"    "us"
    Option        "XkbOptions"    "lv3:ralt_switch"

Section "InputDevice"
    Identifier    "Configured Mouse"
    Driver        "mouse"
    Option        "CorePointer"
    Option        "EmulateWheel"        "true"
    Option        "EmulateWheelButton"    "2"
    Option        "ZAxisMapping"        "4 5 8 9"

Section "InputDevice"
    Identifier    "Synaptics Touchpad"
    Driver        "synaptics"
    Option        "SendCoreEvents"    "true"
    Option        "Device"        "/dev/psaux"
    Option        "Protocol"        "auto-dev"
    Option        "HorizEdgeScroll"    "0"

Section "Device"
    Identifier    "Configured Video Device"
    Option        "AGPMode"        "2"
    Option        "AGPSize"        "8"
    #Option        "ShadowStatus"        "true"
    #Option        "ShadowFB"        "true"
    #Option        "NoAccel"        "true"

Section "Monitor"
    Identifier    "Configured Monitor"

Section "Screen"
    Identifier    "Default Screen"
    Monitor        "Configured Monitor"
    Device        "Configured Video Device"
    DefaultDepth    16

Section "ServerLayout"
    Identifier    "Default Layout"
    Screen        "Default Screen"
    #InputDevice    "Synaptics Touchpad"

Blogged with the Flock Browser