devfs
[Top] [All Lists]

Symlinks being destroyed on boot in /dev

To: Devfs <devfs@xxxxxxxxxxx>
Subject: Symlinks being destroyed on boot in /dev
From: Robert <racsw@xxxxxxxxxxxxxxx>
Date: Wed, 23 Oct 2002 07:37:53 -0400
Sender: devfs-bounce@xxxxxxxxxxx
User-agent: KMail/1.4.3
Hello,
   I'm reposting this problem, as another maillist person (Russell Coker) made 
a valiant effort to solve this problem for me, but this has him stumped as 
well.
   Well, this all started when I installed the Linux Mandrake 8.2 Upgrade 
CDROM a month ago.   I found out quickly that I could not access my internal 
IDE 256Mb Zip drive.   So I started to read as much as I could find about 
devices and such.   I also had the advantage of my wife's computer, which is 
identical to mine, and is also running Mandrake 8.1, and her internal zip is 
working just fine.   So I went into the /dev directory, and located a symlink 
called "hdd4@" which pointed to /ide/host0/bus1/target1/lun0/part4.   My 
system, OTOH, had no "hdd4@" symlink.    So I used ln -s to create this 
missing link.  I had trouble doing this, until I noticed I had a directory 
called /dev/hdd4 with nothing in it that my wife's computer did not have.   
So I had to delete that directory before creation of the symlink would work, 
apparently because of a conflict.   Well, the symlink was created, but was 
flashing red, which indicated the target didn't exist.   So I checked the 
target dir, and the block device file "part4" was not there.  So I read the 
entire Linux Device Documentation, and not seeing anything related to a zip 
for major/minor numbers, I used the numbers 22,68 to create "part4" which I 
got from the wife's computer.   Once I did this, the symlink was the normal 
color, and had all the correct attributes as my wife's system.
   So, after many hours of fstab experimentation earlier in an effort to 
narrow down this problem, I returned the fstab line to it's original form, 
and Presto, I had a fully functioning ZIP drive and supermount once again.
I was elated to say the least.
   The next day I powered up again to check email, and I couldn't access the 
zip again.   Something had erased the symlink "hdd4@" and replaced it with 
the /dev/hdd4 directory.   So essentially, I had to do everything all over 
again, with the exception of creating the "part4" block device file.  As a 
result, it would only work while running, but on reboot, the system would 
repeat the same process again.
   So what I ended up doing, after many nights of frustrating experimentation, 
was creating the "hdd4@" symlink inside the /dev/hdd4 directory.   This 
allowed me access to the zip only if I mounted the zip manually, supermount 
and the original fstab line would not function with this configuration.
   So I was telling all this to my Linux guru friend in England, and he said 
that this seemed to be a devfs problem, and to do some research on this, 
which I have and why I ended up here.   I've stated this whole thing in an 
earlier post, and Russell Coker came to my rescue, examined my 
/etc/devfsd.conf file, plus the others that were in the /etc/devfs/con.d/ 
directory.  I've read the Linux Devfs FAQ by Richard Gooch three times now, 
and while I have a much better understanding of how devfs works, I have not 
been able to fix my problem.
   If someone could help me out here, I would greatly appreciate it, because 
otherwise, my only other option is to completely reload my whole OS, 
something I desperately don't want to do after finally getting everything 
functioning and the tools loaded that I needed for my system.  I've put in 
almost a whole month of nights and weekends trying to solve this on my own, 
but I've come up short.   I just don't know enough at the system level to fix 
this.
   The FAQ mentions two files that are usually questioned when a problem 
arises, so I have included the the entire /etc/devfs.conf file below, as well 
as a small section of my /etc/rc.d/rc.sysinit that appeared to me to be 
related to devfs.   If this is not proper to do on this list, I would 
appreciate a comment so I handle this correctly in the future.
Hopefully, someone can help me troubleshoot this.   Fingers are crossed ;-)

Thanks,
Robert


# Sample /etc/devfsd.conf configuration file.
# Richard Gooch  <rgooch@xxxxxxxxxxxxx>         17-FEB-2002
#
# Enable full compatibility mode for old device names. You may comment these
# out if you don't use the old device names. Make sure you know what you're
# doing!
REGISTER        .*              MKOLDCOMPAT
UNREGISTER      .*              RMOLDCOMPAT

# You may comment out the above and uncomment the following if you've
# configured your system to use the original "new" devfs names or the really
# new names
#REGISTER       ^vc/            MKOLDCOMPAT
#UNREGISTER     ^vc/            RMOLDCOMPAT
#REGISTER       ^pty/           MKOLDCOMPAT
#UNREGISTER     ^pty/           RMOLDCOMPAT
#REGISTER       ^misc/          MKOLDCOMPAT
#UNREGISTER     ^misc/          RMOLDCOMPAT

# You may comment these out if you don't use the original "new" names
REGISTER        .*              MKNEWCOMPAT
UNREGISTER      .*              RMNEWCOMPAT

# Enable module autoloading. You may comment this out if you don't use
# autoloading
LOOKUP          .*              MODLOAD

# Uncomment the following if you want to set the group to "tty" for the
# pseudo-tty devices. This is necessary so that mesg(1) can later be used to
# enable/disable talk requests and wall(1) messages.
REGISTER        ^pty/s.*        PERMISSIONS     -1.tty  0600
REGISTER        ^pts/.*         PERMISSIONS     -1.tty  0600

#
# Uncomment this if you want permissions to be saved and restored
# Do not do this for pseudo-terminal devices
REGISTER        ^pt[sy]         IGNORE
CREATE          ^pt[sy]         IGNORE
CHANGE          ^pt[sy]         IGNORE
DELETE          ^pt[sy]         IGNORE
REGISTER        .*              COPY    /lib/dev-state/$devname $devpath
CREATE          .*              COPY    $devpath /lib/dev-state/$devname
CHANGE          .*              COPY    $devpath /lib/dev-state/$devname
DELETE          .*              CFUNCTION GLOBAL unlink /lib/dev-state/$devname
RESTORE         /lib/dev-state

#
# Uncomment this if you want the old /dev/cdrom symlink
REGISTER        ^cdroms/cdrom0$ CFUNCTION GLOBAL mksymlink $devname cdrom
UNREGISTER      ^cdroms/cdrom0$ CFUNCTION GLOBAL unlink cdrom

REGISTER        ^v4l/video0$    CFUNCTION GLOBAL symlink v4l/video0 video
UNREGISTER      ^v4l/video0$    CFUNCTION GLOBAL unlink video

# ALSA stuff
#LOOKUP                 snd             MODLOAD ACTION snd

# Manage USB mouse
REGISTER        ^input/mouse0$  CFUNCTION GLOBAL mksymlink input/mouse0 usbmouse
UNREGISTER      ^input/mouse0$  CFUNCTION GLOBAL unlink usbmouse

# dynamic desktop and co

#REGISTER       .*/part.*       EXECUTE /etc/dynamic/scripts/part.script add 
$devpath
#UNREGISTER     .*/part.*       EXECUTE /etc/dynamic/scripts/part.script del 
$devpath

REGISTER        v4l/video.*     EXECUTE /etc/dynamic/scripts/webcam.script add 
$devpath
UNREGISTER      v4l/video.*     EXECUTE /etc/dynamic/scripts/webcam.script del 
$devpath

REGISTER        usb/scanner.*   EXECUTE /etc/dynamic/scripts/scanner.script add 
$devpath
UNREGISTER      usb/scanner.*   EXECUTE /etc/dynamic/scripts/scanner.script del 
$devpath

REGISTER        usb/rio500      EXECUTE /etc/dynamic/scripts/rio500.script add 
$devpath
UNREGISTER      usb/rio500      EXECUTE /etc/dynamic/scripts/rio500.script del 
$devpath

REGISTER        usb/tts/[13579] EXECUTE /etc/dynamic/scripts/visor.script add 
$devpath
UNREGISTER      usb/tts/[13579] EXECUTE /etc/dynamic/scripts/visor.script del 
$devpath

REGISTER        (usb/lp.*|printers/.*)  EXECUTE /etc/dynamic/scripts/lp.script 
add 
$devpath
UNREGISTER      (usb/lp.*|printers/.*)  EXECUTE /etc/dynamic/scripts/lp.script 
del 
$devpath

# Uncomment this to let PAM manage devfs
REGISTER        .*              CFUNCTION 
/lib/security/pam_console_apply_devfsd.so 
pam_console_apply_single $devpath

# Uncomment this to manage USB mouse
REGISTER        ^input/mouse0$  CFUNCTION GLOBAL mksymlink $devname usbmouse
UNREGISTER      ^input/mouse0$  CFUNCTION GLOBAL unlink usbmouse
REGISTER        ^input/mice$    CFUNCTION GLOBAL mksymlink $devname usbmouse
UNREGISTER      ^input/mice$    CFUNCTION GLOBAL unlink usbmouse

# If you have removable media and want to force media revalidation when 
looking
# up new or old compatibility names, uncomment the following lines
# SCSI NEWCOMPAT  /dev/sd/* names
LOOKUP          ^(sd/c[0-9]+b[0-9]+t[0-9]+u[0-9]+)p[0-9]+$      EXECUTE /bin/dd 
if=$mntpnt/\1 of=/dev/null count=1
# SCSI OLDCOMPAT  /dev/sd?? names
LOOKUP          ^(sd[a-z]+)[0-9]+$      EXECUTE /bin/dd if=$mntpnt/\1 
of=/dev/null count=1
# IDE NEWCOMPAT   /dev/ide/hd/* names
LOOKUP          ^(ide/hd/c[0-9]+b[0-9]+t[0-9]+u[0-9]+)p[0-9]+$  EXECUTE /bin/dd 
if=$mntpnt/\1 of=/dev/null count=1
# IDE OLDCOMPAT   /dev/hd?? names
LOOKUP          ^(hd[a-z])[0-9]+$       EXECUTE /bin/dd if=$mntpnt/\1 
of=/dev/null count=1

# Include package-generated files from /etc/devfs/conf.d
OPTIONAL_INCLUDE   /etc/devfs/conf.d/

///////////////////////////////////////////////////////////////////////////////////////////////
This next section is two snippets from the /etc/rc.d/rc.sysinit file that I 
thought pertained to devfsd.
//////////////////////////////////////////////////////////////////////////////////////////////

<snip>
# Try to get devfsd
if [ -c /dev/.devfsd ]; then
  if [ -x /sbin/devfsd ]; then
    action "Running DevFs daemon" devfsd /dev
    if [ -f /etc/sysconfig/mouse ];then
      . /etc/sysconfig/mouse
      device=`echo $device | sed -e 's/psaux/misc\/psaux/' -e 
's/ttyS\(.\)/tts\/\1/g'`
      if [ -n "$device" ]; then
        rm -f /dev/mouse
        ln -s /dev/$device /dev/mouse
      fi
    fi
  else
      if ! grep -q "nodevfsd" /proc/cmdline;then
          # devfs is used but devfsd isn't installed    
          gprintf " #### your system is currently using devfs but devfsd isn't 
availlable"
          gprintf " #### you should disable devfs (add 'devfs=nomount' to the 
paramaters"
          gprintf " #### that your bootloader gives to the kernel"
          # Let devfs being tested, but disable it on /dev
          action " Disabling devfs (was mounted on /dev)" umount /dev
    fi
  fi
fi

<snip>

 
get_devfs_name() {
    declare -i bus target
    let "bus = (36#${1#hd} - 36#a)/2"
    let "target = (36#${1#hd} - 36#a)%2"
    echo "ide/host0/bus$bus/target$target/lun0"
}
    
# directly set IDE parameter via /proc interface
# 1 = drive name
# 2 = setting name
# 3 = name setting value
set_ide_setting() {
    [ -e /proc/ide/$1/settings ] || return 1
    declare device=$1 setting=$2 value=$3

    # map hdparm parameters from harddisk*
    case $setting in
        MULTIPLE_IO ) setting=multcount ;;
        USE_DMA     ) setting=using_dma ;;
        EIDE_32BIT  ) setting=io_32bit ;;
        LOOKAHEAD | EXTRA_PARAMS ) return 1 ;;
    esac

    grep -q -- "^$setting[[:space:]]*" "/proc/ide/$1/settings" || return 1
    set -- $(grep -- "^$setting[[:space:]]*" "/proc/ide/$device/settings")
    [ "$5" = rw -o "$5" = w ] || return 1
    echo -n "$setting:$value" > "/proc/ide/$device/settings"
    [ "$5" = w ] && return 0
    set -- $(grep -- "^$setting[[:space:]]*" "/proc/ide/$device/settings")
    [ "$2" = "$value" ] && return 0
    return 1
}
<snip>






<Prev in Thread] Current Thread [Next in Thread>