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

Re: [HTCondor-users] Problems detecting mouse/keyboard with Fedora



I'm running Red Hat Enteprise Linux 6 here, and had a similar issue with our workstations. I had tried running the kbdd as root, but since home directories are on a root-squashed NFS filesystem, it wasn't able to read the cookies for the users, and thus was unable to connect to the display to monitor activity. I'm not sure if it'll be exactly what you need, but hopefully it'll at least get you closer.

The trick in our case is that the condor_kbdd, in order to detect GNOME console activity, has to be attached with the user's session, and owned by the user. This is discussed in section 3.12.5 in the 8.2.9 manual, but it is a bit short of explicit guidance due to the variety of different platforms involved.

For the RHEL6 GNOME, you need to add an "htcondor-kbdd.sh" script to /etc/X11/xinit/xinitrc.d to start it up on login, and update /etc/gdm/PostSession/Default to shut it down on logout.

The gist of the htcondor-kbdd.sh file is:

if [ -x /usr/sbin/condor_kbdd ] ; then
        if [ -d $HOME/.kbdd.log ] ; then
                /bin/mv -f $HOME/.kbdd.log/KbdLog $HOME/.kbdd.log/KbdLog.old
        else
                if [ -e $HOME/.kbdd.log ] ; then
                        /bin/rm -f $HOME/.kbdd.log
                fi
        fi
        /usr/sbin/condor_kbdd -l $HOME/.kbdd.log -pidfile $HOME/.kbdd.pid
fi

This does some basic sanity checking as you can see, by rotating the log file from a previous session and removing any non-directory that might block the daemon's creation of the directory. The condor_kbdd drops into the background by itself, so doesn't need an &.

The PostSession/Default script runs as root, and for obvious security reasons condor_kbdd doesn't want to run as root, so you have to switch to the session owner to run condor_kbdd -k to kill the daemon. So we have:

if [ -f "$HOME/.kbdd.pid" ] ; then
        /bin/su $USER -c \
                "/usr/sbin/condor_kbdd -k $HOME/.kbdd.pid ; /bin/rm -f $HOME/.kbdd.pid"
fi

This approach is preferable to an OS kill because it allows the kbdd to take itself down 100% gracefully, doing whatever updates it needs to do before exiting.

After setting this up, the ConsoleIdle and KeyboardIdle attributes showed the expected responses to keyboard and mouse activity.

More information on these /etc/gdm scripts are here: https://help.gnome.org/admin/gdm/stable/configuration.html.en

It's probably possible to do everything under the /etc/gdm scripots, but the fact that they run as root led me to use the xinitrc.d options instead for startup, in alignment with the general recommendations in the manual. Feel free to share anything you discover that might simplify things.

        -Michael Pelletier.