[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

PCMCIA probles solved: must mount /tmp dev



I'd had problems dealing with PCMCIA support on my TuxTops 20U laptop,
reported here January 30.

Characteristics were that running 'cardmgr' would produce the following
/var/syslog output:

    May 21 00:18:58 ego cardmgr[15743]: starting, version is 3.1.22
    May 21 00:18:58 ego cardmgr[15743]: open_sock(socket 0) failed:
    Permission denied
    May 21 00:18:58 ego cardmgr[15743]: no sockets found!
    May 21 00:18:58 ego cardmgr[15743]: exiting

...which had me stymied.

So, I read the manpage *carefully* and note:

       At  startup,  cardmgr  requires  that  /tmp  reside  on  a
       filesystem that permits special device files (i.e., a real
       linux filesystem, that is not mounted "nodev").

...well, guess what yours truly had had for /tmp -- it's a modest
security precaution.

Just checked -- it *is* possible to mount /tmp 'nodev' *after* cardmgr
is started, so all that's really required is to make sure the partition
(if any) is mounted 'dev' while cardmgr is launched.

I've added the following functions to my /etc/init.d/pcmcia script
(following the "cleanup" function):

    # KMSelf -- some functions to check mounting of /tmp and deal with it if
    # it's mounted 'nodev'
    tmpdevck()
    {
        if grep -q ' /tmp .*nodev' /proc/mounts; then
            echo -e "Hmmm... /tmp is mounted nodev, saving opts... \c"
            tmpopts=$( awk '/ \/tmp / { print $4 }' /proc/mounts ) 
            echo "$tmpopts"
        fi
    }
    tmpmntdev()
    {
        if [ ! -z "$tmpopts" ]; then 
            echo -e "Remounting /tmp dev... \c"
            if mount -o remount,dev /tmp; then 
                echo "successful"
                else echo -e"\aFAILED!"
            fi 
        fi
    }
    tmpmntrestore()
    {
        if [ ! -z "$tmpopts" ]; then
            echo -e "Remounting /tmp as $tmpopts... \c"
            if mount -o remount,$tmpopts /tmp; then
                echo "successful"
                else echo -e"\aFAILED!"
            fi
        fi
    }

...and invoke them before and after running cardmger in the script:

            echo " cardmgr."
            tmpdevck
            tmpmntdev
            /sbin/cardmgr $CARDMGR_OPTS
            tmpmntrestore

...which does the trick.

Modify to suite if you don't have /tmp mounted as its own partition.

-- 
Karsten M. Self <kmself@ix.netcom.com>    http://kmself.home.netcom.com/
 What part of "Gestalt" don't you understand?       There is no K5 cabal
  http://gestalt-system.sourceforge.net/         http://www.kuro5hin.org

Attachment: pgp5PpHay3lSZ.pgp
Description: PGP signature


Reply to: