<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=ZZamboni</id>
	<title>ThinkWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=ZZamboni"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/wiki/Special:Contributions/ZZamboni"/>
	<updated>2026-04-19T20:55:09Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_enable_integrated_fingerprint_reader_with_BioAPI&amp;diff=44375</id>
		<title>How to enable integrated fingerprint reader with BioAPI</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_enable_integrated_fingerprint_reader_with_BioAPI&amp;diff=44375"/>
		<updated>2009-09-14T11:39:43Z</updated>

		<summary type="html">&lt;p&gt;ZZamboni: /* Make xscreensaver use the scanner */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page describes the process of getting the [[Integrated Fingerprint Reader|integrated fingerprint reader]] to work under Linux, using bioapi and binary-only drivers. It is based on experiences in {{Ubuntu}} on a T43. The same works on {{Fedora}} 4 and 5, RHEL4, SuSE 9.3, SuSE 10, and {{Gentoo}}. Note that experimental open-source driver is available, see [[How to enable the fingerprint reader with ThinkFinger|the apropriate page]] for details.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Basic installation==&lt;br /&gt;
===Installing the bioapi framework===&lt;br /&gt;
====Automated installation script====&lt;br /&gt;
The [[Script for enabling the fingerprint reader]] automates the installation of most components (bioapi framework, driver, pam_bioapi, pam setup, device permissions, pamtester and enrolling), for some Linux distributions.&lt;br /&gt;
&lt;br /&gt;
====Binary packages====&lt;br /&gt;
&lt;br /&gt;
Note that these packages only take care of this one section. If you can use one, you should do so and then proceed to the section entitled, Installing and Configuring the Driver.&lt;br /&gt;
&lt;br /&gt;
=====Debian/ Ubuntu Dapper=====&lt;br /&gt;
*If you're using {{Debian}} Sid (the unstable branch) or {{Ubuntu}} Dapper Drake 6.06 LTS you can try the packages from Michael R. Crusoe's site, either [http://www.qrivy.net/~michael/temp/ version 1.2.3] (recommended) or [http://www.qrivy.net/~michael/debs/unstable/ older versions] which might not work with the steps in this howto.&lt;br /&gt;
&lt;br /&gt;
{{HINT|Ignore the warning about not finding ''/usr/lib/libqtpwbsp.so'', it's not fatal.}}&lt;br /&gt;
&lt;br /&gt;
=====Gentoo=====&lt;br /&gt;
Gentoo now includes needed ebuilds. Just run&lt;br /&gt;
&lt;br /&gt;
''ACCEPT_KEYWORDS=~x86 emerge pam_bioapi''&lt;br /&gt;
&lt;br /&gt;
You can also grab the [http://www.qrivy.net/~michael/blua/bioapi/bioapi-1.2.2.ebuild.tar.bz2 ebuild], or use the source-install procedure below.&lt;br /&gt;
&lt;br /&gt;
Also see [http://toe.ch/~tsa/ibm-fingerprint/ http://toe.ch/~tsa/ibm-fingerprint/] for alternative documentation on installing on Gentoo including ebuilds for all the packages used.&lt;br /&gt;
&lt;br /&gt;
=====Fedora Core=====&lt;br /&gt;
RPM packages for Fedora Core and installation instructions are available [[Installing Fedora Core 5 on a ThinkPad X41 Tablet#Fingerprint_Reader|here]]&lt;br /&gt;
&lt;br /&gt;
====Installing from source====&lt;br /&gt;
{{HINT|&lt;br /&gt;
For Ubuntu you'll need at least these packages, or building will fail:&lt;br /&gt;
* build-essential&lt;br /&gt;
* automake&lt;br /&gt;
* libqt3-headers&lt;br /&gt;
}}&lt;br /&gt;
* Get the bioapi source:&lt;br /&gt;
:{{cmduser|wget http://bioapi-linux.googlecode.com/files/bioapi_1.2.3.tar.gz}}&lt;br /&gt;
* Edit the configure file to patch a bug.  At line 25975, change&lt;br /&gt;
:&amp;lt;code&amp;gt;bnv_qt_LIBS=&amp;quot;-l$bnv_qt_lib_dir $LIBS&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
:to&lt;br /&gt;
:&amp;lt;code&amp;gt;bnv_qt_LIBS=&amp;quot;-L$bnv_qt_lib_dir $LIBS&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
* Compile bioapi:&lt;br /&gt;
:{{cmduser|tar xzf bioapi_1.2.3.tar.gz}}&lt;br /&gt;
:{{cmduser|cd bioapi-1.2.3}}&lt;br /&gt;
:{{cmduser|1=./configure}}&lt;br /&gt;
:{{cmduser|make}}&lt;br /&gt;
:and then as root&lt;br /&gt;
:{{cmdroot|make install}}&lt;br /&gt;
* If configure fails when checking the Qt installation, you may need to manually specify the Qt lib directory and Qt lib name.  For example:&lt;br /&gt;
:{{cmduser|1=./configure --with-Qt-lib-dir=/usr/lib/qt3 --with-Qt-lib=qt-mt}}&lt;br /&gt;
:or you can compile without the graphical Qt tools:&lt;br /&gt;
:{{cmduser|1=./configure --with-Qt-dir=no}}&lt;br /&gt;
* If make install fails, be sure you're root and then:&lt;br /&gt;
:{{cmdroot|1=export LD_LIBRARY_PATH=/usr/local/lib}}&lt;br /&gt;
:{{cmdroot|make install}}&lt;br /&gt;
:and if you want to compile [http://code.google.com/p/pam-bioapi/ pam_bioapi] for auth later&lt;br /&gt;
:{{cmdroot|cp include/bioapi_util.h include/installdefs.h imports/cdsa/v2_0/inc/cssmtype.h /usr/include}}&lt;br /&gt;
:Be aware that checkinstall will not work!&lt;br /&gt;
* By default, bioapi will install several files in {{path|/usr/local/bin}}, including files with &amp;quot;self-explanatory&amp;quot; names such as {{path|/usr/local/bin/Sample}}. To prevent this pollution:&lt;br /&gt;
:Create a dedicated directory, for example {{path|/opt/bioapi}} .&lt;br /&gt;
:Append &amp;lt;tt&amp;gt;--prefix=/opt/bioapi&amp;lt;/tt&amp;gt; to the above &amp;lt;tt&amp;gt;./configure&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
:Append {{path|/opt/bioapi/bin}} to &amp;lt;tt&amp;gt;$PATH&amp;lt;/tt&amp;gt; and {{path|/opt/bioapi/lib}} to &amp;lt;tt&amp;gt;$LD_LIBRARY_PATH&amp;lt;/tt&amp;gt;.&lt;br /&gt;
:When installing the driver (below), tell it the new install path: {{cmdroot|sh install.sh /opt/bioapi/lib}}&lt;br /&gt;
&lt;br /&gt;
====Adjusting ldconfigs library search path====&lt;br /&gt;
At least on {{Fedora}} or {{Aurox}} 11, you may need to add {{path|/usr/local/lib}} to the library path so that the libraries referenced from &amp;lt;tt&amp;gt;pam_bioapi.so&amp;lt;/tt&amp;gt; get picked up properly. The usual way to do this is adding it to the ldconfig configuration:&lt;br /&gt;
:{{cmdroot|echo '/usr/local/lib' &amp;gt; /etc/ld.so.conf.d/bioapi.conf}}&lt;br /&gt;
:{{cmdroot|ldconfig}}&lt;br /&gt;
Alternatively you can add it to the LD_LIBRARY variable.&lt;br /&gt;
&lt;br /&gt;
If you see bioapi libs in the output of &lt;br /&gt;
:{{cmdroot|ldconfig -p | grep bioapi}}&lt;br /&gt;
then it should work.&lt;br /&gt;
&lt;br /&gt;
===Installing and configuring the driver===&lt;br /&gt;
====Installing the driver====&lt;br /&gt;
*Download {{path|TFMESS_BSP_LIN_1.0.zip}} from the [http://www.upek.com/support/dl_linux_bsp.asp UPEK support site] and unzip it into a seperate folder, as it will not create one.&lt;br /&gt;
*Change to that folder and do as root:&lt;br /&gt;
:{{cmdroot|sh install.sh}}&lt;br /&gt;
:If you're running Gentoo, Debian or Ubuntu Dapper, use&lt;br /&gt;
:{{cmdroot|sh install.sh /usr/lib}}&lt;br /&gt;
{{HINT|&lt;br /&gt;
For me it didn't work this way, but following did:&lt;br /&gt;
:sh install.sh /usr/local/lib&lt;br /&gt;
greetings, tec}}&lt;br /&gt;
{{HINT|On my debian install I had to &amp;quot;cp libtfmessbsp.so /usr/lib&amp;quot; to avoid a errormessage during &amp;quot;sh install.sh /usr/lib&amp;quot;: &amp;quot;Could not find file:/usr/lib/libtfmessbsp.so&amp;quot;}}&lt;br /&gt;
:If that fails, it may be that make install failed up above -- try setting LD_LIBRARY_PATH, do the make install again, and come back here and try this again.  You also need {{cmd|mod_install|}} from bioapi in your PATH.&lt;br /&gt;
:May there still occures and error, which means mod_install: command not found.&lt;br /&gt;
:Then login as root - not su!&lt;br /&gt;
:Do this:&lt;br /&gt;
:{{cmdroot|sh install.sh}}&lt;br /&gt;
:again. It should work. SU to root does not work since then the /usr/local/bin directory is not used per default.&lt;br /&gt;
&lt;br /&gt;
====Configuring permissions for non-root use====&lt;br /&gt;
If you want to use PAM-aware applications like xscreensaver that are NOT running with root permissions (as opposed to login, gdm or other authentication mechanisms), you may need to do all or at least some of the things in this section.  More details on what is necessary on which distributions would be greately appreciated.&lt;br /&gt;
*Create two groups, one for access to BioAPI files and the other for access to the usb files.  (This is done for full generality; i.e., you may have other USB devices which you want accessable to other users, without exposing your BioAPI configuration to them).  Add your normal user (the one you wish to use PAM-aware applications with) to both of these groups.&lt;br /&gt;
On {{Debian}} this is done with&lt;br /&gt;
:{{cmdroot|addgroup --system bioapi}}&lt;br /&gt;
:{{cmdroot|addgroup --system usbfs}}&lt;br /&gt;
:{{cmdroot|adduser yournormaluser bioapi}}&lt;br /&gt;
:{{cmdroot|adduser yournormaluser usbfs}}&lt;br /&gt;
On {{SUSE}} this is done with&lt;br /&gt;
:{{cmdroot|groupadd --system bioapi}}&lt;br /&gt;
:{{cmdroot|groupadd --system usbfs}}&lt;br /&gt;
:{{cmdroot|groupmod -A yournormaluser bioapi}}&lt;br /&gt;
:{{cmdroot|groupmod -A yournormaluser usbfs}}&lt;br /&gt;
On {{Mandriva}} this is done with&lt;br /&gt;
:{{cmdroot|groupadd -r bioapi}}&lt;br /&gt;
:{{cmdroot|groupadd -r usbfs}}&lt;br /&gt;
:{{cmdroot|usermod -G bioapi,usbfs yournormaluser}}&lt;br /&gt;
On {{Fedora}} this is done with&lt;br /&gt;
:{{cmdroot|groupadd bioapi}}&lt;br /&gt;
:{{cmdroot|groupadd usbfs}}&lt;br /&gt;
:{{cmdroot|usermod -G bioapi,usbfs yournormaluser}}&lt;br /&gt;
&lt;br /&gt;
:(where {{cmd|yournormaluser|}} is your normal user name).  You will need to log out and log back in for this to take effect.&lt;br /&gt;
*Set permissions on the BioAPI config/registry directory:&lt;br /&gt;
:{{cmdroot|chown -R root:bioapi /usr/local/var/bioapi/}}&lt;br /&gt;
:{{cmdroot|chmod -R 770 /usr/local/var/bioapi/}}&lt;br /&gt;
:(change this path if you used an alternate BioAPI install directory above)&lt;br /&gt;
*Set permissions on the files in {{path|/proc/bus/usb}}:&lt;br /&gt;
:{{cmdroot|chown -R root:usbfs /proc/bus/usb}}&lt;br /&gt;
:{{cmdroot|chmod -R g+X /proc/bus/usb}}&lt;br /&gt;
:{{cmdroot|chown root:usbfs /proc/bus/usb/`lsusb &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; sed -ne &amp;quot;/0483:2016/s/Bus\ \(.*\)\ Device\ \(.*\):\ .*/\1\/\2/p&amp;quot;`}}&lt;br /&gt;
:{{cmdroot|chmod 660 /proc/bus/usb/`lsusb &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; sed -ne &amp;quot;/0483:2016/s/Bus\ \(.*\)\ Device\ \(.*\):\ .*/\1\/\2/p&amp;quot;`}}&lt;br /&gt;
:You may need to replace {{cmd|lsusb|}} with its full path, which is something like {{cmd|/sbin/lsusb|}} or {{cmd|/usr/bin/lsusb|}} depending on your distro.  It might be necessary to put these lines into a script which is run at startup and resume from suspend/hibernate.&lt;br /&gt;
In {{Fedora}} {{cmd|lsusb|}} is not installed by default. To intall it just type: &lt;br /&gt;
:{{cmdroot|yum install usbutils}}&lt;br /&gt;
&lt;br /&gt;
*As an alternative to the {{cmd|chown|}}/{{cmd|chmod|}} commands above, you can set mount options for usbfs with a line in {{path|/etc/fstab|}}; an example would be&lt;br /&gt;
 none /proc/bus/usb usbfs defaults,devgid=108,devmode=0660,busgid=108,busmode=0770,listgid=108,listmode=0660 0 0&lt;br /&gt;
:where 108 is replaced with the numerical group ID of the usbfs group (you can determine this with something like {{cmd|cat /etc/group &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; grep usbfs &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; cut -d':' -f 3|}}).  Make sure you only have one {{path|/proc/bus/usb}} entry in {{path|/etc/fstab}}.  See the {{cmd|mount(8)|}} manpage for more information on these options.  This is &amp;quot;cleaner&amp;quot; but seems to have a few weird issues -- see the talk page for details.&lt;br /&gt;
*You may also have files in {{path|/dev/bus/usb}}, which the driver will try before {{path|/proc/bus/usb}}.  If this is another usbfs mount point ({{cmd|mount|}} shows a line containing {{cmdresult|/dev/bus/usb type usbfs}}), then simply follow the above instructions with {{path|/dev/bus/usb}} rather than {{path|/proc/bus/usb}}.  Otherwise, you may be running a new kernel (i.e. 2.6.15) that makes usbfs-like files available through {{path|/dev/bus/usb}}.&lt;br /&gt;
*On systems running udev these files are dynamically created; you can configure their permissions by editing a udev config file.  On Debian this is done by changing the &amp;lt;tt&amp;gt;usb_device&amp;lt;/tt&amp;gt; line of {{path|/etc/udev/permissions.rules}} to read&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb_device&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;usbfs&amp;quot;&lt;br /&gt;
*For the beta versions only, there is a logfile, which needs to exist with the proper permissions:&lt;br /&gt;
:{{cmdroot|touch /var/log/BSP.log &amp;amp;&amp;amp; chown root:bioapi /var/log/BSP.log &amp;amp;&amp;amp; chmod 660 /var/log/BSP.log}}&lt;br /&gt;
&lt;br /&gt;
====Miscellaneous configuration====&lt;br /&gt;
* To increase the security level (minimize false accept rate), set this in {{path|/etc/tfmessbsp.cfg}}:&lt;br /&gt;
 security-level=&amp;quot;5&amp;quot;&lt;br /&gt;
{{WARN|Please see discussion section Security Level!}}&lt;br /&gt;
&lt;br /&gt;
===Testing the driver and enrolling a fingerprint===&lt;br /&gt;
To test the driver and generate the file containing your fingerprint information, you need a sample program included with the driver.  The compilation steps below were discovered by trial and error; if they don't work for you, try the binary {{cmd|Sample|}} utility that came with the beta versions of the driver (i.e., {{path|TFMESS_BSP_LIN_1.0beta2.zip}} as mentioned above).&lt;br /&gt;
Go to the folder where you extracted {{path|TFMESS_BSP_LIN_1.0.zip}} and do:&lt;br /&gt;
:{{cmdroot|cd NonGUI_Sample}}&lt;br /&gt;
:Edit {{path|main.c|}} and remove (or comment out) the line&lt;br /&gt;
 #include &amp;quot;port/bioapi_port.h&amp;quot;&lt;br /&gt;
:then add the line&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
:{{cmdroot|gcc -o Sample main.c -L/usr/local/lib -lbioapi100 -DUNIX -DLITTLE_ENDIAN}}&lt;br /&gt;
:{{cmdroot|./Sample}}&lt;br /&gt;
:Note that Sample may only run as root, unless you've already configured the usbfs file permissions.&lt;br /&gt;
:You can try to &amp;quot;e&amp;quot;nroll (to record a fingerprint for an account) and then &amp;quot;v&amp;quot;erify (to test a fingerprint against the one it expects for an account).&lt;br /&gt;
:You'll save a step later if you use your own login username as the username to enroll here.&lt;br /&gt;
:If running {{cmd |./Sample|}} produces the error message 'BioAPI_ModuleLoad failed, BioAPI Error Code: 6477 (0x194d)'&lt;br /&gt;
:then uncommenting the line&lt;br /&gt;
://BioAPI_SetGUICallbacks(gModuleHandle, NULL, NULL,TextGuiCallback, NULL);&lt;br /&gt;
:in {{path|main.c|}} can help.&lt;br /&gt;
&lt;br /&gt;
==Login via pam_bioapi==&lt;br /&gt;
&lt;br /&gt;
The following explains how to add fingerprint authentiation to programs that use the PAM (Pluggable Authentication Modules) framework, such as  Gnome's GDM and KDE's KDM and screensaver.&lt;br /&gt;
&lt;br /&gt;
===Getting required libs &amp;amp; tools===&lt;br /&gt;
====Installing pam_bioapi====&lt;br /&gt;
*Prerequisites&lt;br /&gt;
:On SuSE 10, I needed to install the pam-devel RPM&lt;br /&gt;
:In general, you will need pam itself (standard for most distros) as well as the pam development files (probably an optional package for your distro).&lt;br /&gt;
*Get and compile the pam_bioapi module.&lt;br /&gt;
{{HINT|A new version, pam_bioapi 0.3.0, with multi-finger and identification support can be found [http://www.nax.cz/pub/bioapi/pam_bioapi/pam-bioapi_0.3.0.tar.gz here].&lt;br /&gt;
There's work in progress. pam_bioapi and biometrics-manager can be downloaded [http://download.savannah.gnu.org/releases/pam-bioapi/ here].}}&lt;br /&gt;
:{{cmduser|wget http://www.qrivy.net/~michael/blua/pam_bioapi/pam_bioapi-latest.tar.bz2}}&lt;br /&gt;
:{{cmduser|tar xjf pam_bioapi-latest.tar.bz2}}&lt;br /&gt;
:{{cmduser|cd pam_bioapi-0.2.1}}&lt;br /&gt;
:{{cmduser|wget http://badcode.de/downloads/fingerprint.patch}}&lt;br /&gt;
:{{cmduser|patch -p0 &amp;lt; fingerprint.patch}}&lt;br /&gt;
:If you want to, review the patch. In general you should review all code you download and compile, if possible.&lt;br /&gt;
:{{cmduser|&amp;lt;nowiki&amp;gt;./configure --libdir=/lib &amp;amp;&amp;amp; make &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
:and as root&lt;br /&gt;
:{{cmdroot| make install}}&lt;br /&gt;
{{NOTE|If you get a 'rpl_malloc' error in /var/log/auth.log when trying to use the fingerprint reader, redo these steps and remove the related term from Makefile after running ./configure. (FC3, Debian etch)}}&lt;br /&gt;
*If you get 'configure: error: cannot find required header: security/_pam_macros.h' and are on a Debian-like system, do &amp;quot;apt-get install libpam0g-dev&amp;quot; and try again. If you are using a Mandriva distribution, do &amp;quot;urpmi libpam0-devel&amp;quot; instead.&lt;br /&gt;
*If you get 'configure: error: cannot find required header: security/pam_modules.h' and are on a Debian-like system, do &amp;quot;apt-get install libpam0g-dev&amp;quot; and try again.&lt;br /&gt;
*If you get 'configure: error: cannot find required header: sqlite3.h' and are on a Debian-like system, do &amp;quot;apt-get install libsqlite3-dev&amp;quot; and try again.&lt;br /&gt;
*If you get 'make: msgfmt: command not found' and are on a Debian-like system, do &amp;quot;apt-get install gettext&amp;quot; and try again.&lt;br /&gt;
*If you get 'PAM [dlerror: /lib/security/pam_bioapi.so: undefined symbol: BioAPIMemoryFuncs]' error in your syslog, replace 'LIBS = ' line in {{path|libpam_bioapi/makefile}} with the following (of course, replace {{path|/opt/bioapi/}} with the path where you installed bioapi):&lt;br /&gt;
 LIBS = -L/opt/bioapi/lib -lbioapi100 -lbioapi_mds300 -lmds_util&lt;br /&gt;
*Use the sample tool from the fingerprint reader to create {{path|&amp;lt;username&amp;gt;.bir}} (&amp;lt;tt&amp;gt;&amp;lt;username&amp;gt;&amp;lt;/tt&amp;gt; '''must''' be the username you want to login with. gdm will probably break for any login name that has no .bir file).&lt;br /&gt;
*As root do:&lt;br /&gt;
:{{cmdroot|SERIAL&amp;lt;nowiki&amp;gt;=`BioAPITest | sed -ne &amp;quot;/Fingerprint/{n;n;s/^.*: \(.\{9\}\)\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)\(.*\)/\1-\2-\3-\4-\5/gp}&amp;quot;` &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
:{{cmdroot|echo $SERIAL}} should print something like {{cmdresult|&amp;lt;nowiki&amp;gt;{5550454b-2054-464d-2f45-535320425350}&amp;lt;/nowiki&amp;gt;}} now.&lt;br /&gt;
:If it does, do:&lt;br /&gt;
:{{cmdroot|mkdir -p /etc/bioapi/pam/$SERIAL}}&lt;br /&gt;
:{{cmdroot|cp &amp;lt;username&amp;gt;.bir /etc/bioapi/pam/$SERIAL}}&lt;br /&gt;
:If not, you might just try&lt;br /&gt;
:{{cmdroot|SERIAL&amp;lt;nowiki&amp;gt;={5550454b-2054-464d-2f45-535320425350}&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
:as this value is hardcoded into the UPEK docs.&lt;br /&gt;
&lt;br /&gt;
===Configuring pam===&lt;br /&gt;
The following part is distribution specific. On {{Ubuntu}} or {{SUSE}} you can modify {{path|/etc/pam.d/common-auth}} (on {{Gentoo}} and {{Fedora}} it is {{path|/etc/pam.d/system-auth}}) to look like this:&lt;br /&gt;
&lt;br /&gt;
 #&lt;br /&gt;
 # /etc/pam.d/common-auth - authentication settings common to all services&lt;br /&gt;
 #&lt;br /&gt;
 # This file is included from other service-specific PAM config files,&lt;br /&gt;
 # and should contain a list of the authentication modules that define&lt;br /&gt;
 # the central authentication scheme for use on the system&lt;br /&gt;
 # (e.g., /etc/shadow, LDAP, Kerberos, etc.).  The default is to use the&lt;br /&gt;
 # traditional Unix authentication mechanisms.&lt;br /&gt;
 #&lt;br /&gt;
 auth       sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 password   sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 auth       required     pam_unix.so nullok_secure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
For '''Gentoo'''-Users - this allows you to attempt a password first. If you simply press enter, it then prompts for a fingerprints. Create a file named {{path|/etc/pam.d/bioapi}}. This also means that remote services, such as SSH keep working:&lt;br /&gt;
&lt;br /&gt;
 auth       required     pam_env.so&lt;br /&gt;
 auth       sufficient   pam_unix.so likeauth nullok&lt;br /&gt;
 auth       sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 auth       required     pam_deny.so&lt;br /&gt;
 &lt;br /&gt;
 account    required     pam_unix.so&lt;br /&gt;
 &lt;br /&gt;
 session    required     pam_limits.so&lt;br /&gt;
 session    required     pam_unix.so&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Now, simply replace &amp;quot;auth include system-auth&amp;quot; in all services that you wish to use fingerprint for with &amp;quot;auth include bioapi&amp;quot;. For example, {{path|/etc/pam.d/kde}} by default contains&lt;br /&gt;
&lt;br /&gt;
  auth       include      system-auth&lt;br /&gt;
  auth       required     pam_nologin.so&lt;br /&gt;
  &lt;br /&gt;
  account    include      system-auth&lt;br /&gt;
  &lt;br /&gt;
  password   include      system-auth&lt;br /&gt;
  &lt;br /&gt;
  session    include      system-auth&lt;br /&gt;
&lt;br /&gt;
Simply replace the first &amp;quot;system-auth&amp;quot; with bioapi and you can also get rid of KDE desktop lock with a fingerprint. If you do not wish to allow for &amp;quot;password fallback&amp;quot; then remove &lt;br /&gt;
&lt;br /&gt;
 auth       sufficient   pam_unix.so likeauth nullok&lt;br /&gt;
&lt;br /&gt;
from {{path|/etc/pam.d/bioapi}}.&lt;br /&gt;
&lt;br /&gt;
{{WARN|If su/sudo expects to receive the root password (SuSE 10), you need to have fingerprint settings for root (that is, copy in a root.bir as well as a your-username.bir).  Otherwise, they get a segmentation fault.  Which is a little unfortunate, given that you need to su or sudo to change your settings... }}&lt;br /&gt;
{{WARN|Not only SuSE 10 requires root.bir to be available for su to work. Just make sure you have root.bir when su is not working with your fingerprint reader but other applications are...}}&lt;br /&gt;
Note that sshd may pick up the fingerprint settings from {{path|/etc/pam.d/common-auth}}.  I didn't want that, so I removed the &amp;quot;auth include common-auth&amp;quot; line from {{path|/etc/pam.d/sshd}} and replaced it with the lines that were originally in my {{path|/etc/pam.d/common-auth}}.  That way most local services use the fingerprint reader, but sshd does not.&lt;br /&gt;
&lt;br /&gt;
{{NOTE|su/sudo will call for your fingerprint even if you are remote via ssh.  Pressing *CTLR-c* (or closing graphic window) will allow you the desired password option.}}&lt;br /&gt;
&lt;br /&gt;
Another way to do this is to create a file ({{path|/etc/pam.d/bioapi|}} for example) which contains the {{cmd|pam_bioapi.so|}} lines, and explicitly {{cmd|@include|}} this '''before''' {{path|/etc/pam.d/common-auth|}} in the files for services which should use the fingerprint reader.  In this case you should leave {{path|/etc/pam.d/common-auth|}} alone.&lt;br /&gt;
&lt;br /&gt;
{{NOTE|This was discovered through trial and success, if it is plain wrong, wikorrect it, please.}}&lt;br /&gt;
&lt;br /&gt;
In {{Fedora}} the original 'session' terms in {{path|/etc/pam.d/system-auth}} need to be kept.&lt;br /&gt;
&lt;br /&gt;
{{HINT|The setup described above will/could affect remote ssh logins to also use biometric logins, which is a bit silly (who wants to remote ssh to the laptop, and then have to walk over to it and swipe your finger)&amp;lt;br /&amp;gt;To avoid that you can copy the default &amp;lt;tt&amp;gt;/etc/pam.d/system-auth&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/etc/pam.d/sshd&amp;lt;/tt&amp;gt; which will allow the sshd service to use the standard authentication procedure.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To enable normal password authorization to work with remote SSH in {{SUSE}} 10.3, edit the &amp;lt;tt&amp;gt;/etc/pam.d/sshd&amp;lt;/tt&amp;gt; file. Remove all entries and replace them with:&lt;br /&gt;
&lt;br /&gt;
 auth    required        pam_env.so&lt;br /&gt;
 auth    required        pam_unix2.so&lt;br /&gt;
 auth    required        pam_nologin.so&lt;br /&gt;
 account required        pam_unix2.so&lt;br /&gt;
 password required       pam_pwcheck.so  nullok&lt;br /&gt;
 password required       pam_unix2.so    nullok use_first_pass use_authtok&lt;br /&gt;
 session required        pam_limits.so&lt;br /&gt;
 session required        pam_unix2.so&lt;br /&gt;
&lt;br /&gt;
{{NOTE|These entries are what common-auth normally does. Since we've changed common-auth around for bioapi, these need to be specified manually. -Ransak}}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
You can do some useful testing with [http://pamtester.sourceforge.net/ {{cmd|pamtester|}}], which calls the pam modules as if it were a program of your choice.  Examples:&lt;br /&gt;
:{{cmdroot|pamtester xdm yourusername authenticate}}&lt;br /&gt;
:{{cmduser|pamtester xscreensaver yourusername authenticate}}&lt;br /&gt;
where {{cmd|yourusername|}} is your username.  Note that {{cmd|pamtester|}} should run as root if and only if the program in question does.&lt;br /&gt;
&lt;br /&gt;
===Application support===&lt;br /&gt;
The implementation of fingerprint scanning support in the relevant applications varies.&lt;br /&gt;
&lt;br /&gt;
Here is the behaviour of the most common ones:&lt;br /&gt;
* In gdm enter your username and there should pop up an (ugly) image to swipe your finger and... magic - you can login without a password.&lt;br /&gt;
* kdm doesn't give any visual indication, other than that the cursor stops blinking. Just swipe your finger and hope it lets you log in.&lt;br /&gt;
* In xdm, enter your username and a blank password, then swipe (there is no popup as well). Identification support for xdm can be achieved with [http://www.nax.cz/pub/bioapi/2005/xdm/xdm_bio.patch this patch].&lt;br /&gt;
* The KDE screen saver in SUSE 10 requires you to enter an empty password (or select the correct user and then enter an empty password) in order to get the fingerprint prompt.&lt;br /&gt;
* For Fedora users, the redhat-config tools will crash if no root.bir presents. Also, there won't be any visual idication unless X server is properly configured for root to access. Just swipe your finger when the HDD stopped blinking or issue the following command in advance:&lt;br /&gt;
:{{cmduser|xhost +local:}}&lt;br /&gt;
* For RHEL4 users gdm, console (virtual terminal) logins and the xscreensaver all work&lt;br /&gt;
&lt;br /&gt;
===kdm support===&lt;br /&gt;
To add graphical popup to kdm, you need following:&lt;br /&gt;
* Patch for pam_bioapi. This patch adds third parameter to {{path|pam_bioapi.so}} module, which is a name of file with additional environment variables that will be supplied to the UPEK driver.&lt;br /&gt;
:{{cmdroot|wget http://upir.cz/linux/patches/pam_bioapi-0.2.1-alter-environ.patch}}&lt;br /&gt;
:{{cmdroot|patch -p1 &amp;lt; pam_bioapi-0.2.1-alter-environ.patch}}&lt;br /&gt;
* Edit your {{path|Xsetup}} file (on SUSE 10 it's {{path|/etc/X11/xdm/Xsetup}}) and add these lines:&lt;br /&gt;
 echo &amp;quot;XAUTHORITY=$XAUTHORITY&amp;quot; &amp;gt; /var/lib/xdm/kdm_env&lt;br /&gt;
 echo &amp;quot;DISPLAY=$DISPLAY&amp;quot; &amp;gt;&amp;gt; /var/lib/xdm/kdm_env&lt;br /&gt;
* In {{path|/etc/pam.d/xdm}} file, add {{path|/var/lib/xdm/kdm_env}} as a third parameter for {{path|pam_bioapi.so}} module:&lt;br /&gt;
 auth sufficient pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/ /var/lib/xdm/kdm_env&lt;br /&gt;
* On Ubuntu simply do: &lt;br /&gt;
 echo &amp;quot;DISPLAY=$DISPLAY&amp;quot; &amp;gt;&amp;gt; /var/lib/kdm/kdm_env&lt;br /&gt;
* If you have created /etc/pam.d/bioapi then modify:&lt;br /&gt;
 auth sufficient pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/ /var/lib/kdm/kdm_env&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please note, that this won't work if you have more than one Xserver.&lt;br /&gt;
&lt;br /&gt;
==Make xscreensaver use the scanner==&lt;br /&gt;
If you are using Gentoo, you can get a portage overlay with the necessary patches here: http://dl.getdropbox.com/u/869/xscreensaver-fingerprint-overlay.tar.gz&lt;br /&gt;
*Get the needed xscreensaver sources:&lt;br /&gt;
:{{cmduser|wget http://www.jwz.org/xscreensaver/xscreensaver-4.23.tar.gz}}&lt;br /&gt;
:{{cmduser|tar xzf xscreensaver-4.23.tar.gz}}&lt;br /&gt;
:{{cmduser|cd xscreensaver-4.23}}&lt;br /&gt;
:{{cmduser|wget http://www.nax.cz/pub/bioapi/2005/xscreensaver/xscreensaver-4.22_alternativeAuth.diff&amp;lt;br/&amp;gt; mirror: http://zepan.org/files/xscreensaver-4.22_alternativeAuth.diff&amp;lt;br/&amp;gt;For xscreensaver 5.00, you can get a patch here: http://dl.getdropbox.com/u/869/xscreensaver-5.00-alternativeauth.patch}}&lt;br /&gt;
*After reviewing the patch (it's small and straightforward), do&lt;br /&gt;
:{{cmduser|patch -p1 &amp;lt; xscreensaver-4.22_alternativeAuth.diff}}&amp;lt;br /&amp;gt;The patch prevents xscreensaver from opening an authentification window and dispatches the authentification request to another program, in our case &amp;lt;tt&amp;gt;pam&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;pam_bioapi&amp;lt;/tt&amp;gt;. It should apply with some offset, don't mind that. If it says something about rejected though, then there's a problem.&lt;br /&gt;
*Compile with&lt;br /&gt;
:{{cmduser|./configure --with-pam &amp;amp;&amp;amp; make}}&amp;lt;br /&amp;gt;&lt;br /&gt;
*If you receive an error like &amp;quot;Couldn't find X11 headers/libs&amp;quot; and are running a Debian-like system, try &amp;quot;apt-get install xlibs-dev&amp;quot;&lt;br /&gt;
*If you receive an error like &amp;quot;undefined reference to `XmuPrintDefaultErrorMessage'&amp;quot; then install the libxmu-dev package and run the previous line again and then install as root with&lt;br /&gt;
:{{cmduser|su -c make install}} .&lt;br /&gt;
*Make sure that the newly compiled xscreensaver is used:&lt;br /&gt;
:{{cmduser|which xscreensaver}} should return&lt;br /&gt;
:{{cmdresult|/usr/local/bin/xscreensaver}} .&lt;br /&gt;
*In case it doesn't, try adjusting your PATH.&lt;br /&gt;
&lt;br /&gt;
==Common problems==&lt;br /&gt;
===Bioapi error #3===&lt;br /&gt;
This is sometimes caused by improper permissions. The full error message is &amp;quot;BioAPI Error Code: 3 (0x3)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
However, at least on Gentoo, recent upgrades to glibc and gcc 4.1.1 caused Bioapi to break down due to some sort of incompatibility with bioapi registry. Reinstalling does '''not''' repair the issue automatically. However, you can still fix the issue manually, by removing /var/bioapi. You need to reinstall tfm-fingerprint driver after reinstalling bioapi so that the driver is properly re-registered. As root, type&lt;br /&gt;
&lt;br /&gt;
:{{cmdroot|emerge -C bioapi}}&lt;br /&gt;
:{{cmdroot|rm -rf /var/bioapi}}&lt;br /&gt;
:{{cmdroot|emerge -av1 bioapi tfm-fingerprint}}&lt;/div&gt;</summary>
		<author><name>ZZamboni</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_enable_integrated_fingerprint_reader_with_BioAPI&amp;diff=44374</id>
		<title>How to enable integrated fingerprint reader with BioAPI</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_enable_integrated_fingerprint_reader_with_BioAPI&amp;diff=44374"/>
		<updated>2009-09-14T11:38:05Z</updated>

		<summary type="html">&lt;p&gt;ZZamboni: Changed URL of xscreensaver-fingerprint-overlay.tar.gz (current copy will disappear soon)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page describes the process of getting the [[Integrated Fingerprint Reader|integrated fingerprint reader]] to work under Linux, using bioapi and binary-only drivers. It is based on experiences in {{Ubuntu}} on a T43. The same works on {{Fedora}} 4 and 5, RHEL4, SuSE 9.3, SuSE 10, and {{Gentoo}}. Note that experimental open-source driver is available, see [[How to enable the fingerprint reader with ThinkFinger|the apropriate page]] for details.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Basic installation==&lt;br /&gt;
===Installing the bioapi framework===&lt;br /&gt;
====Automated installation script====&lt;br /&gt;
The [[Script for enabling the fingerprint reader]] automates the installation of most components (bioapi framework, driver, pam_bioapi, pam setup, device permissions, pamtester and enrolling), for some Linux distributions.&lt;br /&gt;
&lt;br /&gt;
====Binary packages====&lt;br /&gt;
&lt;br /&gt;
Note that these packages only take care of this one section. If you can use one, you should do so and then proceed to the section entitled, Installing and Configuring the Driver.&lt;br /&gt;
&lt;br /&gt;
=====Debian/ Ubuntu Dapper=====&lt;br /&gt;
*If you're using {{Debian}} Sid (the unstable branch) or {{Ubuntu}} Dapper Drake 6.06 LTS you can try the packages from Michael R. Crusoe's site, either [http://www.qrivy.net/~michael/temp/ version 1.2.3] (recommended) or [http://www.qrivy.net/~michael/debs/unstable/ older versions] which might not work with the steps in this howto.&lt;br /&gt;
&lt;br /&gt;
{{HINT|Ignore the warning about not finding ''/usr/lib/libqtpwbsp.so'', it's not fatal.}}&lt;br /&gt;
&lt;br /&gt;
=====Gentoo=====&lt;br /&gt;
Gentoo now includes needed ebuilds. Just run&lt;br /&gt;
&lt;br /&gt;
''ACCEPT_KEYWORDS=~x86 emerge pam_bioapi''&lt;br /&gt;
&lt;br /&gt;
You can also grab the [http://www.qrivy.net/~michael/blua/bioapi/bioapi-1.2.2.ebuild.tar.bz2 ebuild], or use the source-install procedure below.&lt;br /&gt;
&lt;br /&gt;
Also see [http://toe.ch/~tsa/ibm-fingerprint/ http://toe.ch/~tsa/ibm-fingerprint/] for alternative documentation on installing on Gentoo including ebuilds for all the packages used.&lt;br /&gt;
&lt;br /&gt;
=====Fedora Core=====&lt;br /&gt;
RPM packages for Fedora Core and installation instructions are available [[Installing Fedora Core 5 on a ThinkPad X41 Tablet#Fingerprint_Reader|here]]&lt;br /&gt;
&lt;br /&gt;
====Installing from source====&lt;br /&gt;
{{HINT|&lt;br /&gt;
For Ubuntu you'll need at least these packages, or building will fail:&lt;br /&gt;
* build-essential&lt;br /&gt;
* automake&lt;br /&gt;
* libqt3-headers&lt;br /&gt;
}}&lt;br /&gt;
* Get the bioapi source:&lt;br /&gt;
:{{cmduser|wget http://bioapi-linux.googlecode.com/files/bioapi_1.2.3.tar.gz}}&lt;br /&gt;
* Edit the configure file to patch a bug.  At line 25975, change&lt;br /&gt;
:&amp;lt;code&amp;gt;bnv_qt_LIBS=&amp;quot;-l$bnv_qt_lib_dir $LIBS&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
:to&lt;br /&gt;
:&amp;lt;code&amp;gt;bnv_qt_LIBS=&amp;quot;-L$bnv_qt_lib_dir $LIBS&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
* Compile bioapi:&lt;br /&gt;
:{{cmduser|tar xzf bioapi_1.2.3.tar.gz}}&lt;br /&gt;
:{{cmduser|cd bioapi-1.2.3}}&lt;br /&gt;
:{{cmduser|1=./configure}}&lt;br /&gt;
:{{cmduser|make}}&lt;br /&gt;
:and then as root&lt;br /&gt;
:{{cmdroot|make install}}&lt;br /&gt;
* If configure fails when checking the Qt installation, you may need to manually specify the Qt lib directory and Qt lib name.  For example:&lt;br /&gt;
:{{cmduser|1=./configure --with-Qt-lib-dir=/usr/lib/qt3 --with-Qt-lib=qt-mt}}&lt;br /&gt;
:or you can compile without the graphical Qt tools:&lt;br /&gt;
:{{cmduser|1=./configure --with-Qt-dir=no}}&lt;br /&gt;
* If make install fails, be sure you're root and then:&lt;br /&gt;
:{{cmdroot|1=export LD_LIBRARY_PATH=/usr/local/lib}}&lt;br /&gt;
:{{cmdroot|make install}}&lt;br /&gt;
:and if you want to compile [http://code.google.com/p/pam-bioapi/ pam_bioapi] for auth later&lt;br /&gt;
:{{cmdroot|cp include/bioapi_util.h include/installdefs.h imports/cdsa/v2_0/inc/cssmtype.h /usr/include}}&lt;br /&gt;
:Be aware that checkinstall will not work!&lt;br /&gt;
* By default, bioapi will install several files in {{path|/usr/local/bin}}, including files with &amp;quot;self-explanatory&amp;quot; names such as {{path|/usr/local/bin/Sample}}. To prevent this pollution:&lt;br /&gt;
:Create a dedicated directory, for example {{path|/opt/bioapi}} .&lt;br /&gt;
:Append &amp;lt;tt&amp;gt;--prefix=/opt/bioapi&amp;lt;/tt&amp;gt; to the above &amp;lt;tt&amp;gt;./configure&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
:Append {{path|/opt/bioapi/bin}} to &amp;lt;tt&amp;gt;$PATH&amp;lt;/tt&amp;gt; and {{path|/opt/bioapi/lib}} to &amp;lt;tt&amp;gt;$LD_LIBRARY_PATH&amp;lt;/tt&amp;gt;.&lt;br /&gt;
:When installing the driver (below), tell it the new install path: {{cmdroot|sh install.sh /opt/bioapi/lib}}&lt;br /&gt;
&lt;br /&gt;
====Adjusting ldconfigs library search path====&lt;br /&gt;
At least on {{Fedora}} or {{Aurox}} 11, you may need to add {{path|/usr/local/lib}} to the library path so that the libraries referenced from &amp;lt;tt&amp;gt;pam_bioapi.so&amp;lt;/tt&amp;gt; get picked up properly. The usual way to do this is adding it to the ldconfig configuration:&lt;br /&gt;
:{{cmdroot|echo '/usr/local/lib' &amp;gt; /etc/ld.so.conf.d/bioapi.conf}}&lt;br /&gt;
:{{cmdroot|ldconfig}}&lt;br /&gt;
Alternatively you can add it to the LD_LIBRARY variable.&lt;br /&gt;
&lt;br /&gt;
If you see bioapi libs in the output of &lt;br /&gt;
:{{cmdroot|ldconfig -p | grep bioapi}}&lt;br /&gt;
then it should work.&lt;br /&gt;
&lt;br /&gt;
===Installing and configuring the driver===&lt;br /&gt;
====Installing the driver====&lt;br /&gt;
*Download {{path|TFMESS_BSP_LIN_1.0.zip}} from the [http://www.upek.com/support/dl_linux_bsp.asp UPEK support site] and unzip it into a seperate folder, as it will not create one.&lt;br /&gt;
*Change to that folder and do as root:&lt;br /&gt;
:{{cmdroot|sh install.sh}}&lt;br /&gt;
:If you're running Gentoo, Debian or Ubuntu Dapper, use&lt;br /&gt;
:{{cmdroot|sh install.sh /usr/lib}}&lt;br /&gt;
{{HINT|&lt;br /&gt;
For me it didn't work this way, but following did:&lt;br /&gt;
:sh install.sh /usr/local/lib&lt;br /&gt;
greetings, tec}}&lt;br /&gt;
{{HINT|On my debian install I had to &amp;quot;cp libtfmessbsp.so /usr/lib&amp;quot; to avoid a errormessage during &amp;quot;sh install.sh /usr/lib&amp;quot;: &amp;quot;Could not find file:/usr/lib/libtfmessbsp.so&amp;quot;}}&lt;br /&gt;
:If that fails, it may be that make install failed up above -- try setting LD_LIBRARY_PATH, do the make install again, and come back here and try this again.  You also need {{cmd|mod_install|}} from bioapi in your PATH.&lt;br /&gt;
:May there still occures and error, which means mod_install: command not found.&lt;br /&gt;
:Then login as root - not su!&lt;br /&gt;
:Do this:&lt;br /&gt;
:{{cmdroot|sh install.sh}}&lt;br /&gt;
:again. It should work. SU to root does not work since then the /usr/local/bin directory is not used per default.&lt;br /&gt;
&lt;br /&gt;
====Configuring permissions for non-root use====&lt;br /&gt;
If you want to use PAM-aware applications like xscreensaver that are NOT running with root permissions (as opposed to login, gdm or other authentication mechanisms), you may need to do all or at least some of the things in this section.  More details on what is necessary on which distributions would be greately appreciated.&lt;br /&gt;
*Create two groups, one for access to BioAPI files and the other for access to the usb files.  (This is done for full generality; i.e., you may have other USB devices which you want accessable to other users, without exposing your BioAPI configuration to them).  Add your normal user (the one you wish to use PAM-aware applications with) to both of these groups.&lt;br /&gt;
On {{Debian}} this is done with&lt;br /&gt;
:{{cmdroot|addgroup --system bioapi}}&lt;br /&gt;
:{{cmdroot|addgroup --system usbfs}}&lt;br /&gt;
:{{cmdroot|adduser yournormaluser bioapi}}&lt;br /&gt;
:{{cmdroot|adduser yournormaluser usbfs}}&lt;br /&gt;
On {{SUSE}} this is done with&lt;br /&gt;
:{{cmdroot|groupadd --system bioapi}}&lt;br /&gt;
:{{cmdroot|groupadd --system usbfs}}&lt;br /&gt;
:{{cmdroot|groupmod -A yournormaluser bioapi}}&lt;br /&gt;
:{{cmdroot|groupmod -A yournormaluser usbfs}}&lt;br /&gt;
On {{Mandriva}} this is done with&lt;br /&gt;
:{{cmdroot|groupadd -r bioapi}}&lt;br /&gt;
:{{cmdroot|groupadd -r usbfs}}&lt;br /&gt;
:{{cmdroot|usermod -G bioapi,usbfs yournormaluser}}&lt;br /&gt;
On {{Fedora}} this is done with&lt;br /&gt;
:{{cmdroot|groupadd bioapi}}&lt;br /&gt;
:{{cmdroot|groupadd usbfs}}&lt;br /&gt;
:{{cmdroot|usermod -G bioapi,usbfs yournormaluser}}&lt;br /&gt;
&lt;br /&gt;
:(where {{cmd|yournormaluser|}} is your normal user name).  You will need to log out and log back in for this to take effect.&lt;br /&gt;
*Set permissions on the BioAPI config/registry directory:&lt;br /&gt;
:{{cmdroot|chown -R root:bioapi /usr/local/var/bioapi/}}&lt;br /&gt;
:{{cmdroot|chmod -R 770 /usr/local/var/bioapi/}}&lt;br /&gt;
:(change this path if you used an alternate BioAPI install directory above)&lt;br /&gt;
*Set permissions on the files in {{path|/proc/bus/usb}}:&lt;br /&gt;
:{{cmdroot|chown -R root:usbfs /proc/bus/usb}}&lt;br /&gt;
:{{cmdroot|chmod -R g+X /proc/bus/usb}}&lt;br /&gt;
:{{cmdroot|chown root:usbfs /proc/bus/usb/`lsusb &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; sed -ne &amp;quot;/0483:2016/s/Bus\ \(.*\)\ Device\ \(.*\):\ .*/\1\/\2/p&amp;quot;`}}&lt;br /&gt;
:{{cmdroot|chmod 660 /proc/bus/usb/`lsusb &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; sed -ne &amp;quot;/0483:2016/s/Bus\ \(.*\)\ Device\ \(.*\):\ .*/\1\/\2/p&amp;quot;`}}&lt;br /&gt;
:You may need to replace {{cmd|lsusb|}} with its full path, which is something like {{cmd|/sbin/lsusb|}} or {{cmd|/usr/bin/lsusb|}} depending on your distro.  It might be necessary to put these lines into a script which is run at startup and resume from suspend/hibernate.&lt;br /&gt;
In {{Fedora}} {{cmd|lsusb|}} is not installed by default. To intall it just type: &lt;br /&gt;
:{{cmdroot|yum install usbutils}}&lt;br /&gt;
&lt;br /&gt;
*As an alternative to the {{cmd|chown|}}/{{cmd|chmod|}} commands above, you can set mount options for usbfs with a line in {{path|/etc/fstab|}}; an example would be&lt;br /&gt;
 none /proc/bus/usb usbfs defaults,devgid=108,devmode=0660,busgid=108,busmode=0770,listgid=108,listmode=0660 0 0&lt;br /&gt;
:where 108 is replaced with the numerical group ID of the usbfs group (you can determine this with something like {{cmd|cat /etc/group &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; grep usbfs &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; cut -d':' -f 3|}}).  Make sure you only have one {{path|/proc/bus/usb}} entry in {{path|/etc/fstab}}.  See the {{cmd|mount(8)|}} manpage for more information on these options.  This is &amp;quot;cleaner&amp;quot; but seems to have a few weird issues -- see the talk page for details.&lt;br /&gt;
*You may also have files in {{path|/dev/bus/usb}}, which the driver will try before {{path|/proc/bus/usb}}.  If this is another usbfs mount point ({{cmd|mount|}} shows a line containing {{cmdresult|/dev/bus/usb type usbfs}}), then simply follow the above instructions with {{path|/dev/bus/usb}} rather than {{path|/proc/bus/usb}}.  Otherwise, you may be running a new kernel (i.e. 2.6.15) that makes usbfs-like files available through {{path|/dev/bus/usb}}.&lt;br /&gt;
*On systems running udev these files are dynamically created; you can configure their permissions by editing a udev config file.  On Debian this is done by changing the &amp;lt;tt&amp;gt;usb_device&amp;lt;/tt&amp;gt; line of {{path|/etc/udev/permissions.rules}} to read&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb_device&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;usbfs&amp;quot;&lt;br /&gt;
*For the beta versions only, there is a logfile, which needs to exist with the proper permissions:&lt;br /&gt;
:{{cmdroot|touch /var/log/BSP.log &amp;amp;&amp;amp; chown root:bioapi /var/log/BSP.log &amp;amp;&amp;amp; chmod 660 /var/log/BSP.log}}&lt;br /&gt;
&lt;br /&gt;
====Miscellaneous configuration====&lt;br /&gt;
* To increase the security level (minimize false accept rate), set this in {{path|/etc/tfmessbsp.cfg}}:&lt;br /&gt;
 security-level=&amp;quot;5&amp;quot;&lt;br /&gt;
{{WARN|Please see discussion section Security Level!}}&lt;br /&gt;
&lt;br /&gt;
===Testing the driver and enrolling a fingerprint===&lt;br /&gt;
To test the driver and generate the file containing your fingerprint information, you need a sample program included with the driver.  The compilation steps below were discovered by trial and error; if they don't work for you, try the binary {{cmd|Sample|}} utility that came with the beta versions of the driver (i.e., {{path|TFMESS_BSP_LIN_1.0beta2.zip}} as mentioned above).&lt;br /&gt;
Go to the folder where you extracted {{path|TFMESS_BSP_LIN_1.0.zip}} and do:&lt;br /&gt;
:{{cmdroot|cd NonGUI_Sample}}&lt;br /&gt;
:Edit {{path|main.c|}} and remove (or comment out) the line&lt;br /&gt;
 #include &amp;quot;port/bioapi_port.h&amp;quot;&lt;br /&gt;
:then add the line&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
:{{cmdroot|gcc -o Sample main.c -L/usr/local/lib -lbioapi100 -DUNIX -DLITTLE_ENDIAN}}&lt;br /&gt;
:{{cmdroot|./Sample}}&lt;br /&gt;
:Note that Sample may only run as root, unless you've already configured the usbfs file permissions.&lt;br /&gt;
:You can try to &amp;quot;e&amp;quot;nroll (to record a fingerprint for an account) and then &amp;quot;v&amp;quot;erify (to test a fingerprint against the one it expects for an account).&lt;br /&gt;
:You'll save a step later if you use your own login username as the username to enroll here.&lt;br /&gt;
:If running {{cmd |./Sample|}} produces the error message 'BioAPI_ModuleLoad failed, BioAPI Error Code: 6477 (0x194d)'&lt;br /&gt;
:then uncommenting the line&lt;br /&gt;
://BioAPI_SetGUICallbacks(gModuleHandle, NULL, NULL,TextGuiCallback, NULL);&lt;br /&gt;
:in {{path|main.c|}} can help.&lt;br /&gt;
&lt;br /&gt;
==Login via pam_bioapi==&lt;br /&gt;
&lt;br /&gt;
The following explains how to add fingerprint authentiation to programs that use the PAM (Pluggable Authentication Modules) framework, such as  Gnome's GDM and KDE's KDM and screensaver.&lt;br /&gt;
&lt;br /&gt;
===Getting required libs &amp;amp; tools===&lt;br /&gt;
====Installing pam_bioapi====&lt;br /&gt;
*Prerequisites&lt;br /&gt;
:On SuSE 10, I needed to install the pam-devel RPM&lt;br /&gt;
:In general, you will need pam itself (standard for most distros) as well as the pam development files (probably an optional package for your distro).&lt;br /&gt;
*Get and compile the pam_bioapi module.&lt;br /&gt;
{{HINT|A new version, pam_bioapi 0.3.0, with multi-finger and identification support can be found [http://www.nax.cz/pub/bioapi/pam_bioapi/pam-bioapi_0.3.0.tar.gz here].&lt;br /&gt;
There's work in progress. pam_bioapi and biometrics-manager can be downloaded [http://download.savannah.gnu.org/releases/pam-bioapi/ here].}}&lt;br /&gt;
:{{cmduser|wget http://www.qrivy.net/~michael/blua/pam_bioapi/pam_bioapi-latest.tar.bz2}}&lt;br /&gt;
:{{cmduser|tar xjf pam_bioapi-latest.tar.bz2}}&lt;br /&gt;
:{{cmduser|cd pam_bioapi-0.2.1}}&lt;br /&gt;
:{{cmduser|wget http://badcode.de/downloads/fingerprint.patch}}&lt;br /&gt;
:{{cmduser|patch -p0 &amp;lt; fingerprint.patch}}&lt;br /&gt;
:If you want to, review the patch. In general you should review all code you download and compile, if possible.&lt;br /&gt;
:{{cmduser|&amp;lt;nowiki&amp;gt;./configure --libdir=/lib &amp;amp;&amp;amp; make &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
:and as root&lt;br /&gt;
:{{cmdroot| make install}}&lt;br /&gt;
{{NOTE|If you get a 'rpl_malloc' error in /var/log/auth.log when trying to use the fingerprint reader, redo these steps and remove the related term from Makefile after running ./configure. (FC3, Debian etch)}}&lt;br /&gt;
*If you get 'configure: error: cannot find required header: security/_pam_macros.h' and are on a Debian-like system, do &amp;quot;apt-get install libpam0g-dev&amp;quot; and try again. If you are using a Mandriva distribution, do &amp;quot;urpmi libpam0-devel&amp;quot; instead.&lt;br /&gt;
*If you get 'configure: error: cannot find required header: security/pam_modules.h' and are on a Debian-like system, do &amp;quot;apt-get install libpam0g-dev&amp;quot; and try again.&lt;br /&gt;
*If you get 'configure: error: cannot find required header: sqlite3.h' and are on a Debian-like system, do &amp;quot;apt-get install libsqlite3-dev&amp;quot; and try again.&lt;br /&gt;
*If you get 'make: msgfmt: command not found' and are on a Debian-like system, do &amp;quot;apt-get install gettext&amp;quot; and try again.&lt;br /&gt;
*If you get 'PAM [dlerror: /lib/security/pam_bioapi.so: undefined symbol: BioAPIMemoryFuncs]' error in your syslog, replace 'LIBS = ' line in {{path|libpam_bioapi/makefile}} with the following (of course, replace {{path|/opt/bioapi/}} with the path where you installed bioapi):&lt;br /&gt;
 LIBS = -L/opt/bioapi/lib -lbioapi100 -lbioapi_mds300 -lmds_util&lt;br /&gt;
*Use the sample tool from the fingerprint reader to create {{path|&amp;lt;username&amp;gt;.bir}} (&amp;lt;tt&amp;gt;&amp;lt;username&amp;gt;&amp;lt;/tt&amp;gt; '''must''' be the username you want to login with. gdm will probably break for any login name that has no .bir file).&lt;br /&gt;
*As root do:&lt;br /&gt;
:{{cmdroot|SERIAL&amp;lt;nowiki&amp;gt;=`BioAPITest | sed -ne &amp;quot;/Fingerprint/{n;n;s/^.*: \(.\{9\}\)\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)\(.*\)/\1-\2-\3-\4-\5/gp}&amp;quot;` &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
:{{cmdroot|echo $SERIAL}} should print something like {{cmdresult|&amp;lt;nowiki&amp;gt;{5550454b-2054-464d-2f45-535320425350}&amp;lt;/nowiki&amp;gt;}} now.&lt;br /&gt;
:If it does, do:&lt;br /&gt;
:{{cmdroot|mkdir -p /etc/bioapi/pam/$SERIAL}}&lt;br /&gt;
:{{cmdroot|cp &amp;lt;username&amp;gt;.bir /etc/bioapi/pam/$SERIAL}}&lt;br /&gt;
:If not, you might just try&lt;br /&gt;
:{{cmdroot|SERIAL&amp;lt;nowiki&amp;gt;={5550454b-2054-464d-2f45-535320425350}&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
:as this value is hardcoded into the UPEK docs.&lt;br /&gt;
&lt;br /&gt;
===Configuring pam===&lt;br /&gt;
The following part is distribution specific. On {{Ubuntu}} or {{SUSE}} you can modify {{path|/etc/pam.d/common-auth}} (on {{Gentoo}} and {{Fedora}} it is {{path|/etc/pam.d/system-auth}}) to look like this:&lt;br /&gt;
&lt;br /&gt;
 #&lt;br /&gt;
 # /etc/pam.d/common-auth - authentication settings common to all services&lt;br /&gt;
 #&lt;br /&gt;
 # This file is included from other service-specific PAM config files,&lt;br /&gt;
 # and should contain a list of the authentication modules that define&lt;br /&gt;
 # the central authentication scheme for use on the system&lt;br /&gt;
 # (e.g., /etc/shadow, LDAP, Kerberos, etc.).  The default is to use the&lt;br /&gt;
 # traditional Unix authentication mechanisms.&lt;br /&gt;
 #&lt;br /&gt;
 auth       sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 password   sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 auth       required     pam_unix.so nullok_secure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
For '''Gentoo'''-Users - this allows you to attempt a password first. If you simply press enter, it then prompts for a fingerprints. Create a file named {{path|/etc/pam.d/bioapi}}. This also means that remote services, such as SSH keep working:&lt;br /&gt;
&lt;br /&gt;
 auth       required     pam_env.so&lt;br /&gt;
 auth       sufficient   pam_unix.so likeauth nullok&lt;br /&gt;
 auth       sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 auth       required     pam_deny.so&lt;br /&gt;
 &lt;br /&gt;
 account    required     pam_unix.so&lt;br /&gt;
 &lt;br /&gt;
 session    required     pam_limits.so&lt;br /&gt;
 session    required     pam_unix.so&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Now, simply replace &amp;quot;auth include system-auth&amp;quot; in all services that you wish to use fingerprint for with &amp;quot;auth include bioapi&amp;quot;. For example, {{path|/etc/pam.d/kde}} by default contains&lt;br /&gt;
&lt;br /&gt;
  auth       include      system-auth&lt;br /&gt;
  auth       required     pam_nologin.so&lt;br /&gt;
  &lt;br /&gt;
  account    include      system-auth&lt;br /&gt;
  &lt;br /&gt;
  password   include      system-auth&lt;br /&gt;
  &lt;br /&gt;
  session    include      system-auth&lt;br /&gt;
&lt;br /&gt;
Simply replace the first &amp;quot;system-auth&amp;quot; with bioapi and you can also get rid of KDE desktop lock with a fingerprint. If you do not wish to allow for &amp;quot;password fallback&amp;quot; then remove &lt;br /&gt;
&lt;br /&gt;
 auth       sufficient   pam_unix.so likeauth nullok&lt;br /&gt;
&lt;br /&gt;
from {{path|/etc/pam.d/bioapi}}.&lt;br /&gt;
&lt;br /&gt;
{{WARN|If su/sudo expects to receive the root password (SuSE 10), you need to have fingerprint settings for root (that is, copy in a root.bir as well as a your-username.bir).  Otherwise, they get a segmentation fault.  Which is a little unfortunate, given that you need to su or sudo to change your settings... }}&lt;br /&gt;
{{WARN|Not only SuSE 10 requires root.bir to be available for su to work. Just make sure you have root.bir when su is not working with your fingerprint reader but other applications are...}}&lt;br /&gt;
Note that sshd may pick up the fingerprint settings from {{path|/etc/pam.d/common-auth}}.  I didn't want that, so I removed the &amp;quot;auth include common-auth&amp;quot; line from {{path|/etc/pam.d/sshd}} and replaced it with the lines that were originally in my {{path|/etc/pam.d/common-auth}}.  That way most local services use the fingerprint reader, but sshd does not.&lt;br /&gt;
&lt;br /&gt;
{{NOTE|su/sudo will call for your fingerprint even if you are remote via ssh.  Pressing *CTLR-c* (or closing graphic window) will allow you the desired password option.}}&lt;br /&gt;
&lt;br /&gt;
Another way to do this is to create a file ({{path|/etc/pam.d/bioapi|}} for example) which contains the {{cmd|pam_bioapi.so|}} lines, and explicitly {{cmd|@include|}} this '''before''' {{path|/etc/pam.d/common-auth|}} in the files for services which should use the fingerprint reader.  In this case you should leave {{path|/etc/pam.d/common-auth|}} alone.&lt;br /&gt;
&lt;br /&gt;
{{NOTE|This was discovered through trial and success, if it is plain wrong, wikorrect it, please.}}&lt;br /&gt;
&lt;br /&gt;
In {{Fedora}} the original 'session' terms in {{path|/etc/pam.d/system-auth}} need to be kept.&lt;br /&gt;
&lt;br /&gt;
{{HINT|The setup described above will/could affect remote ssh logins to also use biometric logins, which is a bit silly (who wants to remote ssh to the laptop, and then have to walk over to it and swipe your finger)&amp;lt;br /&amp;gt;To avoid that you can copy the default &amp;lt;tt&amp;gt;/etc/pam.d/system-auth&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/etc/pam.d/sshd&amp;lt;/tt&amp;gt; which will allow the sshd service to use the standard authentication procedure.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
To enable normal password authorization to work with remote SSH in {{SUSE}} 10.3, edit the &amp;lt;tt&amp;gt;/etc/pam.d/sshd&amp;lt;/tt&amp;gt; file. Remove all entries and replace them with:&lt;br /&gt;
&lt;br /&gt;
 auth    required        pam_env.so&lt;br /&gt;
 auth    required        pam_unix2.so&lt;br /&gt;
 auth    required        pam_nologin.so&lt;br /&gt;
 account required        pam_unix2.so&lt;br /&gt;
 password required       pam_pwcheck.so  nullok&lt;br /&gt;
 password required       pam_unix2.so    nullok use_first_pass use_authtok&lt;br /&gt;
 session required        pam_limits.so&lt;br /&gt;
 session required        pam_unix2.so&lt;br /&gt;
&lt;br /&gt;
{{NOTE|These entries are what common-auth normally does. Since we've changed common-auth around for bioapi, these need to be specified manually. -Ransak}}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
You can do some useful testing with [http://pamtester.sourceforge.net/ {{cmd|pamtester|}}], which calls the pam modules as if it were a program of your choice.  Examples:&lt;br /&gt;
:{{cmdroot|pamtester xdm yourusername authenticate}}&lt;br /&gt;
:{{cmduser|pamtester xscreensaver yourusername authenticate}}&lt;br /&gt;
where {{cmd|yourusername|}} is your username.  Note that {{cmd|pamtester|}} should run as root if and only if the program in question does.&lt;br /&gt;
&lt;br /&gt;
===Application support===&lt;br /&gt;
The implementation of fingerprint scanning support in the relevant applications varies.&lt;br /&gt;
&lt;br /&gt;
Here is the behaviour of the most common ones:&lt;br /&gt;
* In gdm enter your username and there should pop up an (ugly) image to swipe your finger and... magic - you can login without a password.&lt;br /&gt;
* kdm doesn't give any visual indication, other than that the cursor stops blinking. Just swipe your finger and hope it lets you log in.&lt;br /&gt;
* In xdm, enter your username and a blank password, then swipe (there is no popup as well). Identification support for xdm can be achieved with [http://www.nax.cz/pub/bioapi/2005/xdm/xdm_bio.patch this patch].&lt;br /&gt;
* The KDE screen saver in SUSE 10 requires you to enter an empty password (or select the correct user and then enter an empty password) in order to get the fingerprint prompt.&lt;br /&gt;
* For Fedora users, the redhat-config tools will crash if no root.bir presents. Also, there won't be any visual idication unless X server is properly configured for root to access. Just swipe your finger when the HDD stopped blinking or issue the following command in advance:&lt;br /&gt;
:{{cmduser|xhost +local:}}&lt;br /&gt;
* For RHEL4 users gdm, console (virtual terminal) logins and the xscreensaver all work&lt;br /&gt;
&lt;br /&gt;
===kdm support===&lt;br /&gt;
To add graphical popup to kdm, you need following:&lt;br /&gt;
* Patch for pam_bioapi. This patch adds third parameter to {{path|pam_bioapi.so}} module, which is a name of file with additional environment variables that will be supplied to the UPEK driver.&lt;br /&gt;
:{{cmdroot|wget http://upir.cz/linux/patches/pam_bioapi-0.2.1-alter-environ.patch}}&lt;br /&gt;
:{{cmdroot|patch -p1 &amp;lt; pam_bioapi-0.2.1-alter-environ.patch}}&lt;br /&gt;
* Edit your {{path|Xsetup}} file (on SUSE 10 it's {{path|/etc/X11/xdm/Xsetup}}) and add these lines:&lt;br /&gt;
 echo &amp;quot;XAUTHORITY=$XAUTHORITY&amp;quot; &amp;gt; /var/lib/xdm/kdm_env&lt;br /&gt;
 echo &amp;quot;DISPLAY=$DISPLAY&amp;quot; &amp;gt;&amp;gt; /var/lib/xdm/kdm_env&lt;br /&gt;
* In {{path|/etc/pam.d/xdm}} file, add {{path|/var/lib/xdm/kdm_env}} as a third parameter for {{path|pam_bioapi.so}} module:&lt;br /&gt;
 auth sufficient pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/ /var/lib/xdm/kdm_env&lt;br /&gt;
* On Ubuntu simply do: &lt;br /&gt;
 echo &amp;quot;DISPLAY=$DISPLAY&amp;quot; &amp;gt;&amp;gt; /var/lib/kdm/kdm_env&lt;br /&gt;
* If you have created /etc/pam.d/bioapi then modify:&lt;br /&gt;
 auth sufficient pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/ /var/lib/kdm/kdm_env&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please note, that this won't work if you have more than one Xserver.&lt;br /&gt;
&lt;br /&gt;
==Make xscreensaver use the scanner==&lt;br /&gt;
If you are using Gentoo, you can get a portage overlay with the necessary patches here: http://dl.getdropbox.com/u/869/xscreensaver-fingerprint-overlay.tar.gz&lt;br /&gt;
*Get the needed xscreensaver sources:&lt;br /&gt;
:{{cmduser|wget http://www.jwz.org/xscreensaver/xscreensaver-4.23.tar.gz}}&lt;br /&gt;
:{{cmduser|tar xzf xscreensaver-4.23.tar.gz}}&lt;br /&gt;
:{{cmduser|cd xscreensaver-4.23}}&lt;br /&gt;
:{{cmduser|wget http://www.nax.cz/pub/bioapi/2005/xscreensaver/xscreensaver-4.22_alternativeAuth.diff&amp;lt;br/&amp;gt; mirror: http://zepan.org/files/xscreensaver-4.22_alternativeAuth.diff&amp;lt;br/&amp;gt;For xscreensaver 5.00, you can get a patch here: http://www.zzamboni.org/brt/files/xscreensaver-5.00-alternativeauth.patch}}&lt;br /&gt;
*After reviewing the patch (it's small and straightforward), do&lt;br /&gt;
:{{cmduser|patch -p1 &amp;lt; xscreensaver-4.22_alternativeAuth.diff}}&amp;lt;br /&amp;gt;The patch prevents xscreensaver from opening an authentification window and dispatches the authentification request to another program, in our case &amp;lt;tt&amp;gt;pam&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;pam_bioapi&amp;lt;/tt&amp;gt;. It should apply with some offset, don't mind that. If it says something about rejected though, then there's a problem.&lt;br /&gt;
*Compile with&lt;br /&gt;
:{{cmduser|./configure --with-pam &amp;amp;&amp;amp; make}}&amp;lt;br /&amp;gt;&lt;br /&gt;
*If you receive an error like &amp;quot;Couldn't find X11 headers/libs&amp;quot; and are running a Debian-like system, try &amp;quot;apt-get install xlibs-dev&amp;quot;&lt;br /&gt;
*If you receive an error like &amp;quot;undefined reference to `XmuPrintDefaultErrorMessage'&amp;quot; then install the libxmu-dev package and run the previous line again and then install as root with&lt;br /&gt;
:{{cmduser|su -c make install}} .&lt;br /&gt;
*Make sure that the newly compiled xscreensaver is used:&lt;br /&gt;
:{{cmduser|which xscreensaver}} should return&lt;br /&gt;
:{{cmdresult|/usr/local/bin/xscreensaver}} .&lt;br /&gt;
*In case it doesn't, try adjusting your PATH.&lt;br /&gt;
&lt;br /&gt;
==Common problems==&lt;br /&gt;
===Bioapi error #3===&lt;br /&gt;
This is sometimes caused by improper permissions. The full error message is &amp;quot;BioAPI Error Code: 3 (0x3)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
However, at least on Gentoo, recent upgrades to glibc and gcc 4.1.1 caused Bioapi to break down due to some sort of incompatibility with bioapi registry. Reinstalling does '''not''' repair the issue automatically. However, you can still fix the issue manually, by removing /var/bioapi. You need to reinstall tfm-fingerprint driver after reinstalling bioapi so that the driver is properly re-registered. As root, type&lt;br /&gt;
&lt;br /&gt;
:{{cmdroot|emerge -C bioapi}}&lt;br /&gt;
:{{cmdroot|rm -rf /var/bioapi}}&lt;br /&gt;
:{{cmdroot|emerge -av1 bioapi tfm-fingerprint}}&lt;/div&gt;</summary>
		<author><name>ZZamboni</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_hotswap_Ultrabay_devices&amp;diff=25200</id>
		<title>How to hotswap Ultrabay devices</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_hotswap_Ultrabay_devices&amp;diff=25200"/>
		<updated>2006-10-10T08:50:23Z</updated>

		<summary type="html">&lt;p&gt;ZZamboni: Patched the ultrabay_open script to unmount filesystems by reverse length of mount point, to unmount nested mountpoints in the correct order.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following discusses hotswap (AKA &amp;quot;hotplug&amp;quot;) of devices in the [[UltraBay]].&lt;br /&gt;
&lt;br /&gt;
==When using the &amp;lt;tt&amp;gt;ide-disk&amp;lt;/tt&amp;gt; driver==&lt;br /&gt;
The following applies if you use the &amp;lt;tt&amp;gt;ide-disk&amp;lt;/tt&amp;gt; driver for the UltraBay device.&lt;br /&gt;
&lt;br /&gt;
Hotswapping is supposed to be supported as well, using either hdparm/[http://packages.debian.org/unstable/admin/hotswap Debian hotswap] or [[lt_hotswap]] to (un)register IDE devices. The latter is the recommended method with kernels from 2.6, since it will leave DMA working. However, for recent models (R52, T43, X41, Z60 and later) no method is known to work while maintaining DMA support; see [[Problems with SATA and Linux]].&lt;br /&gt;
&lt;br /&gt;
Only IDE devices (HDD's, optical drives, zip drives) require special treatment - batteries, floppies and other devices can just be pulled from the bay, provided they are not mounted or in use at the time. However, you should still power them down first using the [[ibm-acpi]] eject function.&lt;br /&gt;
&lt;br /&gt;
The [[ibm-acpi]] kernel module has an eject function ({{cmdroot|echo eject &amp;gt; /proc/acpi/ibm/bay}}). This only manages the ACPI calls to power down the device and the bay. It does not actually unregister the device from the IDE driver. {{cmdroot|cat /proc/acpi/ibm/bay}} shows &amp;quot;unoccupied&amp;quot; unless an IDE device is present, but the eject function still works and should still be used.&lt;br /&gt;
&lt;br /&gt;
To unregister the device, you can either use the [http://packages.debian.org/unstable/admin/hotswap Debian hotswap] package, or [[lt_hotswap]].&lt;br /&gt;
&lt;br /&gt;
[http://packages.debian.org/unstable/admin/hotswap Debian hotswap] also allows the drive to be swapped as a normal user by default, which is useful. You should use &amp;lt;tt&amp;gt;hotswap&amp;lt;/tt&amp;gt; to unregister the device and then {{cmdroot|echo eject &amp;gt; /proc/acpi/ibm/bay}}. However, if you use this method on a 2.6 kernel, you will lose DMA support for the reinserted drive. This is due to kernel issues. This method was reported to work on a ThinkPad {{T23}} (kernels 2.6.8.1, 2.6.14.2 and 2.6.15-arch) and {{T42}} (kernel 2.6.13), but fails on a ThinkPad {{T43}} (kernel 2.6.14.3).&lt;br /&gt;
&lt;br /&gt;
[[lt_hotswap]] is now the recommended method to un- and reregister the IDE device. It installs as a kernel module and has support for automatically unregistering the device when the eject event is generated by [[ibm-acpi]]. It will leave DMA support intact. It has supported to work on a ThinkPad {{T22}} and {{T40}} and should work with many other models (but not recent models which require the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver for disk DMA support).&lt;br /&gt;
&lt;br /&gt;
==When using the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver==&lt;br /&gt;
The following applies when using the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver, which is necessary for many recent ThinkPad models that use an [[Intel ICH6-M]] controller. See also [[Problems with SATA and Linux]]. &lt;br /&gt;
&lt;br /&gt;
Mainline kernels before 2.6.18 cannot reliably recognize newly (re-)inserted UltraBay drives without a reboot. There are experimental hotplug patches against pre-2.6.18 mainline kernels [http://home-tj.org/wiki/index.php/Libata-tj-stable here].&lt;br /&gt;
&lt;br /&gt;
* Available hotplug patches&lt;br /&gt;
**[http://home-tj.org/files/libata-tj-stable/libata-tj-2.6.16.16-20060512.tar.bz2 Patch tarball against 2.6.16.16] ([http://lwn.net/Articles/183407/ Announce])&lt;br /&gt;
**[http://home-tj.org/files/libata-tj-stable/libata-tj-2.6.17-20060625-1.tar.bz2 Patch tarball against 2.6.17/2.6.17.1] ([http://article.gmane.org/gmane.linux.ide/11598 Announce])&lt;br /&gt;
**[http://home-tj.org/files/libata-tj-stable/libata-tj-2.6.17.4-20060710.tar.bz2 Patch tarball against 2.6.17.4]&lt;br /&gt;
&lt;br /&gt;
* Confirmed to work on&lt;br /&gt;
**ThinkPad {{T43}}, {{T43p}}&lt;br /&gt;
**ThinkPad {{R52}}&lt;br /&gt;
&lt;br /&gt;
For 2.6.18 kernels, or older kernels that were patched to support &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; hotplug (don't try it otherwise!), one can issue the following after inserting an UltraBay drive to rescan the port:&lt;br /&gt;
 {{cmdroot|echo 0 0 0 &amp;gt;  /sys/class/scsi_host/host1/scan}}&lt;br /&gt;
The inserted drive should now be recognized by the kernel, and appropriate {{path|/dev/*}} entries created automatically (e.g., by &amp;lt;tt&amp;gt;udev&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
You can safely shut down the drive by issuing the following (this works with all recent mainline kernels):&lt;br /&gt;
 {{cmdroot|echo 1 &amp;gt; /sys/class/scsi_device/1\:0\:0\:0/device/delete}}&lt;br /&gt;
 {{cmdroot|echo eject &amp;gt;  /proc/acpi/ibm/bay}}&lt;br /&gt;
The drive can now be ejected.&lt;br /&gt;
&lt;br /&gt;
===Scripts for hotswapping===&lt;br /&gt;
&lt;br /&gt;
The following scripts and [[acpid]] daemon configuration files do the following:&lt;br /&gt;
* Automatically unmounts the relevant filesystems and power off the UltraBay when the UltraBay eject lever is released. Screams if some filesystem can't be unmounted.&lt;br /&gt;
* Rescans the UltraBay port when then UltraBay eject lever is pushed back in.&lt;br /&gt;
&lt;br /&gt;
They assumes you're using the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver with an appropriate kernel (see above).&lt;br /&gt;
&lt;br /&gt;
Create {{path|/usr/local/sbin/ultrabay_close}} with permissions 755:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
echo 12 &amp;gt; /proc/acpi/ibm/beep&lt;br /&gt;
sync&lt;br /&gt;
echo 0 0 0 &amp;gt; /sys/class/scsi_host/host1/scan&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create {{path|/usr/local/sbin/ultrabay_open}} with permissions 755:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
ULTRABAY_SYSDIR='/sys/class/scsi_device/1:0:0:0/device'&lt;br /&gt;
shopt -s nullglob&lt;br /&gt;
&lt;br /&gt;
# Umount the filesystem(s) backed by the given major:minor device(s)&lt;br /&gt;
unmount_rdev() { perl - &amp;quot;$@&amp;quot; &amp;lt;&amp;lt;'EOPERL'  # let's do it in Perl&lt;br /&gt;
	for $major_minor (@ARGV) {&lt;br /&gt;
		$major_minor =~ m/^(\d+):(\d+)$/ or die;&lt;br /&gt;
		push(@tgt_rdevs, ($1&amp;lt;&amp;lt;8)|$2);&lt;br /&gt;
	}&lt;br /&gt;
        # Sort by reverse length of mount point, to unmount sub-directories first&lt;br /&gt;
        open MOUNTS,&amp;quot;&amp;lt;/proc/mounts&amp;quot; or die &amp;quot;$!&amp;quot;;&lt;br /&gt;
        @mounts=sort { length($b-&amp;gt;[1]) &amp;lt;=&amp;gt; length($a-&amp;gt;[1]) } map { [ split ] } &amp;lt;MOUNTS&amp;gt;;&lt;br /&gt;
        close MOUNTS;&lt;br /&gt;
        foreach $m (@mounts) {&lt;br /&gt;
                ($dev,$dir)=@$m;&lt;br /&gt;
		next unless -b $dev;  $rdev=(stat($dev))[6];&lt;br /&gt;
		next unless grep($_==$rdev, @tgt_rdevs);&lt;br /&gt;
		system(&amp;quot;umount&amp;quot;,&amp;quot;-v&amp;quot;,&amp;quot;$dir&amp;quot;)==0  or  $bad=1;&lt;br /&gt;
	}&lt;br /&gt;
	exit 1 if $bad;&lt;br /&gt;
EOPERL&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Get the UltraBay's /dev/foo block device node&lt;br /&gt;
ultrabay_dev_node() {&lt;br /&gt;
	UDEV_PATH=&amp;quot;`readlink -e &amp;quot;$ULTRABAY_SYSDIR/block:&amp;quot;*`&amp;quot; || return 1&lt;br /&gt;
	UDEV_NAME=&amp;quot;`udevinfo -q name -p $UDEV_PATH`&amp;quot; || return 1&lt;br /&gt;
	echo /dev/$UDEV_NAME&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if [ -d $ULTRABAY_SYSDIR ]; then&lt;br /&gt;
	sync&lt;br /&gt;
	# Unmount filesystems backed by this device&lt;br /&gt;
	unmount_rdev `cat $ULTRABAY_SYSDIR/block\:*/dev     \&lt;br /&gt;
	                  $ULTRABAY_SYSDIR/block\:*/*/dev`  \&lt;br /&gt;
	|| {&lt;br /&gt;
		echo 10 &amp;gt; /proc/acpi/ibm/beep;  # error tone&lt;br /&gt;
		exit 1;&lt;br /&gt;
	}&lt;br /&gt;
        sync&lt;br /&gt;
        # Nicely power off the device&lt;br /&gt;
	DEVNODE=`ultrabay_dev_node` &amp;amp;&amp;amp; hdparm -Y $DEVNODE&lt;br /&gt;
        # Let HAL+KDE notice the unmount and let the disk spin down&lt;br /&gt;
	sleep 0.5&lt;br /&gt;
	# Unregister this SCSI device:&lt;br /&gt;
	sync&lt;br /&gt;
	echo 1 &amp;gt; $ULTRABAY_SYSDIR/delete&lt;br /&gt;
fi&lt;br /&gt;
sync&lt;br /&gt;
# Turn off power to the UltraBay:&lt;br /&gt;
if [ -d /proc/acpi/bay ]; then&lt;br /&gt;
	echo 1 &amp;gt; /proc/acpi/bay/*/eject&lt;br /&gt;
else&lt;br /&gt;
	echo eject &amp;gt; /proc/acpi/ibm/bay&lt;br /&gt;
fi&lt;br /&gt;
# Tell the user we're OK&lt;br /&gt;
echo 12 &amp;gt; /proc/acpi/ibm/beep&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create {{path|/etc/acpi/events/ultrabay-close}}:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
event=(ibm/bay|bay) MSTR 00000001 00000000&lt;br /&gt;
action=/usr/local/sbin/ultrabay_close&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create {{path|/etc/acpi/events/ultrabay-open}}:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
event=(ibm/bay|bay) MSTR 00000003 00000000&lt;br /&gt;
action=/usr/local/sbin/ultrabay_open&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart &amp;lt;tt&amp;gt;acpid&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===HAL support===&lt;br /&gt;
&lt;br /&gt;
Many programs, KDe included, rely on [[HAL]] to get notifications and information about device hotplugging. You need to tell HAL that devices connected the UltraBay port are hotpluggable. To do so, create the file {{path|/etc/hal/fdi/information/10-ultrabay.fdi}} as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt; &amp;lt;!-- -*- SGML -*- --&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;deviceinfo version=&amp;quot;0.2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;device&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- UltraBay Devices --&amp;gt;&lt;br /&gt;
    &amp;lt;match key=&amp;quot;storage.bus&amp;quot; string=&amp;quot;scsi&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;match key=&amp;quot;storage.physical_device&amp;quot; string=&amp;quot;/org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_scsi_device_lun0&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;merge key=&amp;quot;storage.hotpluggable&amp;quot; type=&amp;quot;bool&amp;quot;&amp;gt;true&amp;lt;/merge&amp;gt;&lt;br /&gt;
      &amp;lt;/match&amp;gt;&lt;br /&gt;
    &amp;lt;/match&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;/device&amp;gt;&lt;br /&gt;
&amp;lt;/deviceinfo&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Details====&lt;br /&gt;
&lt;br /&gt;
By default, HAL doesn't know that UltraBay devices are hotpluggable:&lt;br /&gt;
&lt;br /&gt;
 # PHYSDEV=/org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_scsi_device_lun0&lt;br /&gt;
 # UDI=`hal-find-by-property --key storage.physical_device --string $PHYSDEV` || echo Failed&lt;br /&gt;
 # hal-get-property --udi $UDI --key block.device&lt;br /&gt;
 /dev/sdb&lt;br /&gt;
 # hal-get-property --udi $UDI --key storage.hotpluggable&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
After creating {{path|/etc/hal/fdi/information/10-ultrabay.fdi}} as above and re-plugging the device, it will get marked correctly:&lt;br /&gt;
&lt;br /&gt;
 # PHYSDEV=/org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_scsi_device_lun0&lt;br /&gt;
 # UDI=`hal-find-by-property --key storage.physical_device --string $PHYSDEV` || echo Failed&lt;br /&gt;
 # hal-get-property --udi $UDI --key block.device&lt;br /&gt;
 /dev/sdb&lt;br /&gt;
 # hal-get-property --udi $UDI --key storage.hotpluggable&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
The string &amp;quot;8086_2653&amp;quot; gives the PCI ID of the [[Intel 82801FBM]] southbridge. If your model has a different southbridge, or the UltraBay is attached to a different port, then you can find the appropriate &amp;lt;tt&amp;gt;storage.physical_device&amp;lt;/tt&amp;gt; value by finding out the block device of the currently running UltraBay device (&amp;lt;tt&amp;gt;/dev/sdb&amp;lt;/tt&amp;gt; in the following example) and then running:&lt;br /&gt;
&lt;br /&gt;
 # DEVICE=/dev/sdb&lt;br /&gt;
 # UDI=`hal-find-by-property --key block.device --string $DEVICE` || echo Failed&lt;br /&gt;
 # hal-get-property --udi $UDI --key storage.physical_device&lt;br /&gt;
 /org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_scsi_device_lun0&lt;br /&gt;
&lt;br /&gt;
If you have a different &amp;lt;tt&amp;gt;storage.physical_device&amp;lt;/tt&amp;gt; value, please report your findings. &lt;br /&gt;
&lt;br /&gt;
==Other comments==&lt;br /&gt;
&lt;br /&gt;
If you are hot-swapping a hard disk on a disk tray, make sure the disk does not have a password set, otherwise it will not be recognized on reinsertion.&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>ZZamboni</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_hotswap_Ultrabay_devices&amp;diff=25198</id>
		<title>How to hotswap Ultrabay devices</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_hotswap_Ultrabay_devices&amp;diff=25198"/>
		<updated>2006-10-10T08:45:13Z</updated>

		<summary type="html">&lt;p&gt;ZZamboni: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following discusses hotswap (AKA &amp;quot;hotplug&amp;quot;) of devices in the [[UltraBay]].&lt;br /&gt;
&lt;br /&gt;
==When using the &amp;lt;tt&amp;gt;ide-disk&amp;lt;/tt&amp;gt; driver==&lt;br /&gt;
The following applies if you use the &amp;lt;tt&amp;gt;ide-disk&amp;lt;/tt&amp;gt; driver for the UltraBay device.&lt;br /&gt;
&lt;br /&gt;
Hotswapping is supposed to be supported as well, using either hdparm/[http://packages.debian.org/unstable/admin/hotswap Debian hotswap] or [[lt_hotswap]] to (un)register IDE devices. The latter is the recommended method with kernels from 2.6, since it will leave DMA working. However, for recent models (R52, T43, X41, Z60 and later) no method is known to work while maintaining DMA support; see [[Problems with SATA and Linux]].&lt;br /&gt;
&lt;br /&gt;
Only IDE devices (HDD's, optical drives, zip drives) require special treatment - batteries, floppies and other devices can just be pulled from the bay, provided they are not mounted or in use at the time. However, you should still power them down first using the [[ibm-acpi]] eject function.&lt;br /&gt;
&lt;br /&gt;
The [[ibm-acpi]] kernel module has an eject function ({{cmdroot|echo eject &amp;gt; /proc/acpi/ibm/bay}}). This only manages the ACPI calls to power down the device and the bay. It does not actually unregister the device from the IDE driver. {{cmdroot|cat /proc/acpi/ibm/bay}} shows &amp;quot;unoccupied&amp;quot; unless an IDE device is present, but the eject function still works and should still be used.&lt;br /&gt;
&lt;br /&gt;
To unregister the device, you can either use the [http://packages.debian.org/unstable/admin/hotswap Debian hotswap] package, or [[lt_hotswap]].&lt;br /&gt;
&lt;br /&gt;
[http://packages.debian.org/unstable/admin/hotswap Debian hotswap] also allows the drive to be swapped as a normal user by default, which is useful. You should use &amp;lt;tt&amp;gt;hotswap&amp;lt;/tt&amp;gt; to unregister the device and then {{cmdroot|echo eject &amp;gt; /proc/acpi/ibm/bay}}. However, if you use this method on a 2.6 kernel, you will lose DMA support for the reinserted drive. This is due to kernel issues. This method was reported to work on a ThinkPad {{T23}} (kernels 2.6.8.1, 2.6.14.2 and 2.6.15-arch) and {{T42}} (kernel 2.6.13), but fails on a ThinkPad {{T43}} (kernel 2.6.14.3).&lt;br /&gt;
&lt;br /&gt;
[[lt_hotswap]] is now the recommended method to un- and reregister the IDE device. It installs as a kernel module and has support for automatically unregistering the device when the eject event is generated by [[ibm-acpi]]. It will leave DMA support intact. It has supported to work on a ThinkPad {{T22}} and {{T40}} and should work with many other models (but not recent models which require the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver for disk DMA support).&lt;br /&gt;
&lt;br /&gt;
==When using the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver==&lt;br /&gt;
The following applies when using the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver, which is necessary for many recent ThinkPad models that use an [[Intel ICH6-M]] controller. See also [[Problems with SATA and Linux]]. &lt;br /&gt;
&lt;br /&gt;
Mainline kernels before 2.6.18 cannot reliably recognize newly (re-)inserted UltraBay drives without a reboot. There are experimental hotplug patches against pre-2.6.18 mainline kernels [http://home-tj.org/wiki/index.php/Libata-tj-stable here].&lt;br /&gt;
&lt;br /&gt;
* Available hotplug patches&lt;br /&gt;
**[http://home-tj.org/files/libata-tj-stable/libata-tj-2.6.16.16-20060512.tar.bz2 Patch tarball against 2.6.16.16] ([http://lwn.net/Articles/183407/ Announce])&lt;br /&gt;
**[http://home-tj.org/files/libata-tj-stable/libata-tj-2.6.17-20060625-1.tar.bz2 Patch tarball against 2.6.17/2.6.17.1] ([http://article.gmane.org/gmane.linux.ide/11598 Announce])&lt;br /&gt;
**[http://home-tj.org/files/libata-tj-stable/libata-tj-2.6.17.4-20060710.tar.bz2 Patch tarball against 2.6.17.4]&lt;br /&gt;
&lt;br /&gt;
* Confirmed to work on&lt;br /&gt;
**ThinkPad {{T43}}, {{T43p}}&lt;br /&gt;
**ThinkPad {{R52}}&lt;br /&gt;
&lt;br /&gt;
For 2.6.18 kernels, or older kernels that were patched to support &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; hotplug (don't try it otherwise!), one can issue the following after inserting an UltraBay drive to rescan the port:&lt;br /&gt;
 {{cmdroot|echo 0 0 0 &amp;gt;  /sys/class/scsi_host/host1/scan}}&lt;br /&gt;
The inserted drive should now be recognized by the kernel, and appropriate {{path|/dev/*}} entries created automatically (e.g., by &amp;lt;tt&amp;gt;udev&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
You can safely shut down the drive by issuing the following (this works with all recent mainline kernels):&lt;br /&gt;
 {{cmdroot|echo 1 &amp;gt; /sys/class/scsi_device/1\:0\:0\:0/device/delete}}&lt;br /&gt;
 {{cmdroot|echo eject &amp;gt;  /proc/acpi/ibm/bay}}&lt;br /&gt;
The drive can now be ejected.&lt;br /&gt;
&lt;br /&gt;
===Scripts for hotswapping===&lt;br /&gt;
&lt;br /&gt;
The following scripts and [[acpid]] daemon configuration files do the following:&lt;br /&gt;
* Automatically unmounts the relevant filesystems and power off the UltraBay when the UltraBay eject lever is released. Screams if some filesystem can't be unmounted.&lt;br /&gt;
* Rescans the UltraBay port when then UltraBay eject lever is pushed back in.&lt;br /&gt;
&lt;br /&gt;
They assumes you're using the &amp;lt;tt&amp;gt;ata_piix&amp;lt;/tt&amp;gt; driver with an appropriate kernel (see above).&lt;br /&gt;
&lt;br /&gt;
Create {{path|/usr/local/sbin/ultrabay_close}} with permissions 755:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
echo 12 &amp;gt; /proc/acpi/ibm/beep&lt;br /&gt;
sync&lt;br /&gt;
echo 0 0 0 &amp;gt; /sys/class/scsi_host/host1/scan&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create {{path|/usr/local/sbin/ultrabay_open}} with permissions 755:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
ULTRABAY_SYSDIR='/sys/class/scsi_device/1:0:0:0/device'&lt;br /&gt;
shopt -s nullglob&lt;br /&gt;
&lt;br /&gt;
# Umount the filesystem(s) backed by the given major:minor device(s)&lt;br /&gt;
unmount_rdev() { perl - &amp;quot;$@&amp;quot; &amp;lt;&amp;lt;'EOPERL'  # let's do it in Perl&lt;br /&gt;
	for $major_minor (@ARGV) {&lt;br /&gt;
		$major_minor =~ m/^(\d+):(\d+)$/ or die;&lt;br /&gt;
		push(@tgt_rdevs, ($1&amp;lt;&amp;lt;8)|$2);&lt;br /&gt;
	}&lt;br /&gt;
	open MOUNTS,&amp;quot;&amp;lt;/proc/mounts&amp;quot; or die &amp;quot;$!&amp;quot;;&lt;br /&gt;
	while (&amp;lt;MOUNTS&amp;gt;) {&lt;br /&gt;
		($dev,$dir)=split;&lt;br /&gt;
		next unless -b $dev;  $rdev=(stat($dev))[6];&lt;br /&gt;
		next unless grep($_==$rdev, @tgt_rdevs);&lt;br /&gt;
		system(&amp;quot;umount&amp;quot;,&amp;quot;-v&amp;quot;,&amp;quot;$dir&amp;quot;)==0  or  $bad=1;&lt;br /&gt;
	}&lt;br /&gt;
	exit 1 if $bad;&lt;br /&gt;
EOPERL&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# Get the UltraBay's /dev/foo block device node&lt;br /&gt;
ultrabay_dev_node() {&lt;br /&gt;
	UDEV_PATH=&amp;quot;`readlink -e &amp;quot;$ULTRABAY_SYSDIR/block:&amp;quot;*`&amp;quot; || return 1&lt;br /&gt;
	UDEV_NAME=&amp;quot;`udevinfo -q name -p $UDEV_PATH`&amp;quot; || return 1&lt;br /&gt;
	echo /dev/$UDEV_NAME&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if [ -d $ULTRABAY_SYSDIR ]; then&lt;br /&gt;
	sync&lt;br /&gt;
	# Unmount filesystems backed by this device&lt;br /&gt;
	unmount_rdev `cat $ULTRABAY_SYSDIR/block\:*/dev     \&lt;br /&gt;
	                  $ULTRABAY_SYSDIR/block\:*/*/dev`  \&lt;br /&gt;
	|| {&lt;br /&gt;
		echo 10 &amp;gt; /proc/acpi/ibm/beep;  # error tone&lt;br /&gt;
		exit 1;&lt;br /&gt;
	}&lt;br /&gt;
        sync&lt;br /&gt;
        # Nicely power off the device&lt;br /&gt;
	DEVNODE=`ultrabay_dev_node` &amp;amp;&amp;amp; hdparm -Y $DEVNODE&lt;br /&gt;
        # Let HAL+KDE notice the unmount and let the disk spin down&lt;br /&gt;
	sleep 0.5&lt;br /&gt;
	# Unregister this SCSI device:&lt;br /&gt;
	sync&lt;br /&gt;
	echo 1 &amp;gt; $ULTRABAY_SYSDIR/delete&lt;br /&gt;
fi&lt;br /&gt;
sync&lt;br /&gt;
# Turn off power to the UltraBay:&lt;br /&gt;
if [ -d /proc/acpi/bay ]; then&lt;br /&gt;
	echo 1 &amp;gt; /proc/acpi/bay/*/eject&lt;br /&gt;
else&lt;br /&gt;
	echo eject &amp;gt; /proc/acpi/ibm/bay&lt;br /&gt;
fi&lt;br /&gt;
# Tell the user we're OK&lt;br /&gt;
echo 12 &amp;gt; /proc/acpi/ibm/beep&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create {{path|/etc/acpi/events/ultrabay-close}}:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
event=(ibm/bay|bay) MSTR 00000001 00000000&lt;br /&gt;
action=/usr/local/sbin/ultrabay_close&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create {{path|/etc/acpi/events/ultrabay-open}}:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
event=(ibm/bay|bay) MSTR 00000003 00000000&lt;br /&gt;
action=/usr/local/sbin/ultrabay_open&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Restart &amp;lt;tt&amp;gt;acpid&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===HAL support===&lt;br /&gt;
&lt;br /&gt;
Many programs, KDe included, rely on [[HAL]] to get notifications and information about device hotplugging. You need to tell HAL that devices connected the UltraBay port are hotpluggable. To do so, create the file {{path|/etc/hal/fdi/information/10-ultrabay.fdi}} as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt; &amp;lt;!-- -*- SGML -*- --&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;deviceinfo version=&amp;quot;0.2&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;device&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;!-- UltraBay Devices --&amp;gt;&lt;br /&gt;
    &amp;lt;match key=&amp;quot;storage.bus&amp;quot; string=&amp;quot;scsi&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;match key=&amp;quot;storage.physical_device&amp;quot; string=&amp;quot;/org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_scsi_device_lun0&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;merge key=&amp;quot;storage.hotpluggable&amp;quot; type=&amp;quot;bool&amp;quot;&amp;gt;true&amp;lt;/merge&amp;gt;&lt;br /&gt;
      &amp;lt;/match&amp;gt;&lt;br /&gt;
    &amp;lt;/match&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;/device&amp;gt;&lt;br /&gt;
&amp;lt;/deviceinfo&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Details====&lt;br /&gt;
&lt;br /&gt;
By default, HAL doesn't know that UltraBay devices are hotpluggable:&lt;br /&gt;
&lt;br /&gt;
 # PHYSDEV=/org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_scsi_device_lun0&lt;br /&gt;
 # UDI=`hal-find-by-property --key storage.physical_device --string $PHYSDEV` || echo Failed&lt;br /&gt;
 # hal-get-property --udi $UDI --key block.device&lt;br /&gt;
 /dev/sdb&lt;br /&gt;
 # hal-get-property --udi $UDI --key storage.hotpluggable&lt;br /&gt;
 false&lt;br /&gt;
&lt;br /&gt;
After creating {{path|/etc/hal/fdi/information/10-ultrabay.fdi}} as above and re-plugging the device, it will get marked correctly:&lt;br /&gt;
&lt;br /&gt;
 # PHYSDEV=/org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_scsi_device_lun0&lt;br /&gt;
 # UDI=`hal-find-by-property --key storage.physical_device --string $PHYSDEV` || echo Failed&lt;br /&gt;
 # hal-get-property --udi $UDI --key block.device&lt;br /&gt;
 /dev/sdb&lt;br /&gt;
 # hal-get-property --udi $UDI --key storage.hotpluggable&lt;br /&gt;
 true&lt;br /&gt;
&lt;br /&gt;
The string &amp;quot;8086_2653&amp;quot; gives the PCI ID of the [[Intel 82801FBM]] southbridge. If your model has a different southbridge, or the UltraBay is attached to a different port, then you can find the appropriate &amp;lt;tt&amp;gt;storage.physical_device&amp;lt;/tt&amp;gt; value by finding out the block device of the currently running UltraBay device (&amp;lt;tt&amp;gt;/dev/sdb&amp;lt;/tt&amp;gt; in the following example) and then running:&lt;br /&gt;
&lt;br /&gt;
 # DEVICE=/dev/sdb&lt;br /&gt;
 # UDI=`hal-find-by-property --key block.device --string $DEVICE` || echo Failed&lt;br /&gt;
 # hal-get-property --udi $UDI --key storage.physical_device&lt;br /&gt;
 /org/freedesktop/Hal/devices/pci_8086_2653_scsi_host_scsi_device_lun0&lt;br /&gt;
&lt;br /&gt;
If you have a different &amp;lt;tt&amp;gt;storage.physical_device&amp;lt;/tt&amp;gt; value, please report your findings. &lt;br /&gt;
&lt;br /&gt;
==Other comments==&lt;br /&gt;
&lt;br /&gt;
If you are hot-swapping a hard disk on a disk tray, make sure the disk does not have a password set, otherwise it will not be recognized on reinsertion.&lt;br /&gt;
&lt;br /&gt;
[[Category:Scripts]]&lt;/div&gt;</summary>
		<author><name>ZZamboni</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Talk:How_to_hotswap_Ultrabay_devices&amp;diff=25197</id>
		<title>Talk:How to hotswap Ultrabay devices</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Talk:How_to_hotswap_Ultrabay_devices&amp;diff=25197"/>
		<updated>2006-10-10T08:42:18Z</updated>

		<summary type="html">&lt;p&gt;ZZamboni: Added solution.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I recently tried using the libata-tj patch tarball for 2.6.16.16, applying this against the newly released 2.6.16.18 kernel (released today.)  Patch applied cleanly.  Upon boot, I immediately get a multitude of &amp;quot;weird&amp;quot; errors -- strange lockups, programs segmentation fault (running &amp;quot;top&amp;quot; resulted in a seg fault), and ultimately a hard lockup.&lt;br /&gt;
&lt;br /&gt;
I booted back to my vanilla 2.6.16.16, ran fsck (appeared to just replay a few transactions, no major damage), and am back to normal.  However, it successfully scared me off - unfortunately can't risk too much downtime (or worse, subtle fs corruption) right now on my main system.  Anybody have experiences with this on a T43p using piix driver?&lt;br /&gt;
&lt;br /&gt;
--[[User:gsmenden|gsmenden]] 00:00, 23 May 2006 (EST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
The 2.6.16.16 patch works fine on my T43. There's a git tree (mentioned on the patch's webpage) which is closer to 2.6.18, but AFAIK no simple unified patch was prepred.&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 08:37, 23 May 2006 (CEST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Cool.  If I get brave I'll try it again on the 43p against 2.6.16.16 proper and report back.&lt;br /&gt;
&lt;br /&gt;
--[[User:gsmenden|gsmenden]] 15:29, 23 May 2006 (EST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Works fine here on 2.6.16.&lt;br /&gt;
I got only one crash with Suspend to Ram, which I'm unable to reproduce yet.&lt;br /&gt;
I renamed the acpi event files because at least my acpid doesn't read files that ends with .conf&lt;br /&gt;
&lt;br /&gt;
--[[User:Defiant|Defiant]] 21:09, 28 May 2006 (CEST)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Update - patched against 2.6.16.19, works fine.  It appears my previous problems were due to a disk error unrelated to the patch.  Excellent!&lt;br /&gt;
&lt;br /&gt;
--[[User:gsmenden|gsmenden]] 00:57, 31 May 2006 (EST)&lt;br /&gt;
&lt;br /&gt;
Anybody have time to make a patch of the libata(-tj) .git tree against the recently released 2.6.17?  I hope to make one in the future if not...&lt;br /&gt;
&lt;br /&gt;
--[[User:gsmenden|gsmenden]] 22:08, 19 Jun 2006 (EST)&lt;br /&gt;
&lt;br /&gt;
== one nit about ultrabay_close script / patch against 2.6.17 available ==&lt;br /&gt;
&lt;br /&gt;
Howdy,&lt;br /&gt;
&lt;br /&gt;
In ultrabay_close, there is 'sleep 3' for disk spinup, which isn't necessary.  libata itself waits for disk spinup and if something breaks (e.g. first reset fails w/ timeout or something), it's libata's fault.  Please remove that line and see if anything breaks.&lt;br /&gt;
&lt;br /&gt;
Also, I've uploaded patch against 2.6.17/2.6.17.1 today.&lt;br /&gt;
&lt;br /&gt;
http://home-tj.org/files/libata-tj-stable/libata-tj-2.6.17-20060625-1.tar.bz2&lt;br /&gt;
&lt;br /&gt;
Hmmm... My post looks different from others.  This wasn't intentional.  Just don't know how to add normal discussion entry.  Sorry.&lt;br /&gt;
&lt;br /&gt;
--tj&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Right, it works fine without &amp;quot;sleep 3&amp;quot; using the new patches. Sleep removed.&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 12:35, 1 July 2006 (CEST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Is it correct, that the ata_piix driver in kernel 2.6.18 RC4 now supports hot swapping like described in the howto and announced here http://lwn.net/Articles/183734/?&lt;br /&gt;
&lt;br /&gt;
--[[User:cob|cob]] 15:53, 23 August 2006&lt;br /&gt;
&lt;br /&gt;
== T42 freezing up when trying to hot swap ultrabay. ==&lt;br /&gt;
&lt;br /&gt;
Hi, &lt;br /&gt;
&lt;br /&gt;
Please bear with me.  I am totally new at this and I am making my best effort to understand and learn. &lt;br /&gt;
&lt;br /&gt;
My problem is that when typing &amp;quot;# echo eject &amp;gt; /proc/acpi/ibm/bay&amp;quot; to eject my ultrabay and put another in, I see the power going off in the ultrabay LED, but then my PC freezes completely. &lt;br /&gt;
&lt;br /&gt;
I am running Fedora 6 Test 3, kernel 2.6.17-1.2647 and my notebook is a ThinkPad T42.&lt;br /&gt;
&lt;br /&gt;
Please help!  I have to constantly be changing my bay to use information in other hard drives, and I have to shutdown the system completely to not have any problems. &lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
&lt;br /&gt;
--Barny  09/21/2006@7:46PM EST&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Have the same problem on a T40p running SuSE 10.1. Also lt_hotplug module is of no help. Keep me informed in case you have a solution!&lt;br /&gt;
Thanks,&lt;br /&gt;
--[[User:Ays|Ays]] 19:49, 5 October 2006 (CEST)&lt;br /&gt;
&lt;br /&gt;
== Second disk not seen correctly on reinsert (T43p) [solved] ==&lt;br /&gt;
&lt;br /&gt;
(update: see below for solution)&lt;br /&gt;
&lt;br /&gt;
I have followed the instructions on my T43p running Gentoo using 2.6.18. I have a second hard disk in the UltraBay, using ata_piix, so it is seen as /dev/sdb (as described in [[Problems with SATA and Linux#No_DMA_on_system_hard_disk|Problems with SATA and Linux]]). The eject works fine. When I reinsert it and issue the rescan command, Only the main /dev/sdb device reappears, but not the ones corresponding to the partitions (/dev/sdb1, etc.), so I cannot mount them, and fdisk /dev/sdb says that it cannot open the device.&lt;br /&gt;
&lt;br /&gt;
In dmesg, I see a bunch of errors like these, repeated multiple times:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sd 1:0:0:0: SCSI error: return code = 0x08000002&lt;br /&gt;
sdb: Current: sense key=0xb&lt;br /&gt;
    ASC=0x0 ASCQ=0x0&lt;br /&gt;
end_request: I/O error, dev sdb, sector 0&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And at the end:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sdb: Current: sense key=0xb&lt;br /&gt;
    ASC=0x0 ASCQ=0x0&lt;br /&gt;
end_request: I/O error, dev sdb, sector 0&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
SCSI device sdb: 117210240 512-byte hdwr sectors (60012 MB)&lt;br /&gt;
sdb: Write Protect is off&lt;br /&gt;
sdb: Mode Sense: 00 3a 00 00&lt;br /&gt;
SCSI device sdb: drive cache: write back&lt;br /&gt;
SCSI device sdb: 117210240 512-byte hdwr sectors (60012 MB)&lt;br /&gt;
sdb: Write Protect is off&lt;br /&gt;
sdb: Mode Sense: 00 3a 00 00&lt;br /&gt;
SCSI device sdb: drive cache: write back&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The situation is not cured by a reboot (I still see only /dev/sdb), I have to power cycle to get the devices back.&lt;br /&gt;
&lt;br /&gt;
Thanks for any ideas.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
(2006-10-10) As a followup to my note above, I have noticed that the DVD-RW drive works perfectly after hot-swapping it - it's just the second hard disk that doesg not get recognized properly. I can &amp;quot;scsiping&amp;quot; the /dev/sdb device and it seems to respond OK, I have tried restarting udevd without success, and I'm at a loss as to what to try next.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
It turned out to be an obvious problem - I had a disk password set on my second disk, so on reinsert it could not be accessed. I turned off the disk password, and now it works perfectly.&lt;/div&gt;</summary>
		<author><name>ZZamboni</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Talk:How_to_hotswap_Ultrabay_devices&amp;diff=25188</id>
		<title>Talk:How to hotswap Ultrabay devices</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Talk:How_to_hotswap_Ultrabay_devices&amp;diff=25188"/>
		<updated>2006-10-10T06:56:20Z</updated>

		<summary type="html">&lt;p&gt;ZZamboni: Update about DVD-RW working properly after hotswap, even though hard disk does not.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I recently tried using the libata-tj patch tarball for 2.6.16.16, applying this against the newly released 2.6.16.18 kernel (released today.)  Patch applied cleanly.  Upon boot, I immediately get a multitude of &amp;quot;weird&amp;quot; errors -- strange lockups, programs segmentation fault (running &amp;quot;top&amp;quot; resulted in a seg fault), and ultimately a hard lockup.&lt;br /&gt;
&lt;br /&gt;
I booted back to my vanilla 2.6.16.16, ran fsck (appeared to just replay a few transactions, no major damage), and am back to normal.  However, it successfully scared me off - unfortunately can't risk too much downtime (or worse, subtle fs corruption) right now on my main system.  Anybody have experiences with this on a T43p using piix driver?&lt;br /&gt;
&lt;br /&gt;
--[[User:gsmenden|gsmenden]] 00:00, 23 May 2006 (EST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
The 2.6.16.16 patch works fine on my T43. There's a git tree (mentioned on the patch's webpage) which is closer to 2.6.18, but AFAIK no simple unified patch was prepred.&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 08:37, 23 May 2006 (CEST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Cool.  If I get brave I'll try it again on the 43p against 2.6.16.16 proper and report back.&lt;br /&gt;
&lt;br /&gt;
--[[User:gsmenden|gsmenden]] 15:29, 23 May 2006 (EST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Works fine here on 2.6.16.&lt;br /&gt;
I got only one crash with Suspend to Ram, which I'm unable to reproduce yet.&lt;br /&gt;
I renamed the acpi event files because at least my acpid doesn't read files that ends with .conf&lt;br /&gt;
&lt;br /&gt;
--[[User:Defiant|Defiant]] 21:09, 28 May 2006 (CEST)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Update - patched against 2.6.16.19, works fine.  It appears my previous problems were due to a disk error unrelated to the patch.  Excellent!&lt;br /&gt;
&lt;br /&gt;
--[[User:gsmenden|gsmenden]] 00:57, 31 May 2006 (EST)&lt;br /&gt;
&lt;br /&gt;
Anybody have time to make a patch of the libata(-tj) .git tree against the recently released 2.6.17?  I hope to make one in the future if not...&lt;br /&gt;
&lt;br /&gt;
--[[User:gsmenden|gsmenden]] 22:08, 19 Jun 2006 (EST)&lt;br /&gt;
&lt;br /&gt;
== one nit about ultrabay_close script / patch against 2.6.17 available ==&lt;br /&gt;
&lt;br /&gt;
Howdy,&lt;br /&gt;
&lt;br /&gt;
In ultrabay_close, there is 'sleep 3' for disk spinup, which isn't necessary.  libata itself waits for disk spinup and if something breaks (e.g. first reset fails w/ timeout or something), it's libata's fault.  Please remove that line and see if anything breaks.&lt;br /&gt;
&lt;br /&gt;
Also, I've uploaded patch against 2.6.17/2.6.17.1 today.&lt;br /&gt;
&lt;br /&gt;
http://home-tj.org/files/libata-tj-stable/libata-tj-2.6.17-20060625-1.tar.bz2&lt;br /&gt;
&lt;br /&gt;
Hmmm... My post looks different from others.  This wasn't intentional.  Just don't know how to add normal discussion entry.  Sorry.&lt;br /&gt;
&lt;br /&gt;
--tj&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Right, it works fine without &amp;quot;sleep 3&amp;quot; using the new patches. Sleep removed.&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 12:35, 1 July 2006 (CEST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Is it correct, that the ata_piix driver in kernel 2.6.18 RC4 now supports hot swapping like described in the howto and announced here http://lwn.net/Articles/183734/?&lt;br /&gt;
&lt;br /&gt;
--[[User:cob|cob]] 15:53, 23 August 2006&lt;br /&gt;
&lt;br /&gt;
== T42 freezing up when trying to hot swap ultrabay. ==&lt;br /&gt;
&lt;br /&gt;
Hi, &lt;br /&gt;
&lt;br /&gt;
Please bear with me.  I am totally new at this and I am making my best effort to understand and learn. &lt;br /&gt;
&lt;br /&gt;
My problem is that when typing &amp;quot;# echo eject &amp;gt; /proc/acpi/ibm/bay&amp;quot; to eject my ultrabay and put another in, I see the power going off in the ultrabay LED, but then my PC freezes completely. &lt;br /&gt;
&lt;br /&gt;
I am running Fedora 6 Test 3, kernel 2.6.17-1.2647 and my notebook is a ThinkPad T42.&lt;br /&gt;
&lt;br /&gt;
Please help!  I have to constantly be changing my bay to use information in other hard drives, and I have to shutdown the system completely to not have any problems. &lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
&lt;br /&gt;
--Barny  09/21/2006@7:46PM EST&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Have the same problem on a T40p running SuSE 10.1. Also lt_hotplug module is of no help. Keep me informed in case you have a solution!&lt;br /&gt;
Thanks,&lt;br /&gt;
--[[User:Ays|Ays]] 19:49, 5 October 2006 (CEST)&lt;br /&gt;
&lt;br /&gt;
== Second disk not seen correctly on reinsert (T43p) ==&lt;br /&gt;
&lt;br /&gt;
I have followed the instructions on my T43p running Gentoo using 2.6.18. I have a second hard disk in the UltraBay, using ata_piix, so it is seen as /dev/sdb (as described in [[Problems with SATA and Linux#No_DMA_on_system_hard_disk|Problems with SATA and Linux]]). The eject works fine. When I reinsert it and issue the rescan command, Only the main /dev/sdb device reappears, but not the ones corresponding to the partitions (/dev/sdb1, etc.), so I cannot mount them, and fdisk /dev/sdb says that it cannot open the device.&lt;br /&gt;
&lt;br /&gt;
In dmesg, I see a bunch of errors like these, repeated multiple times:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sd 1:0:0:0: SCSI error: return code = 0x08000002&lt;br /&gt;
sdb: Current: sense key=0xb&lt;br /&gt;
    ASC=0x0 ASCQ=0x0&lt;br /&gt;
end_request: I/O error, dev sdb, sector 0&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And at the end:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sdb: Current: sense key=0xb&lt;br /&gt;
    ASC=0x0 ASCQ=0x0&lt;br /&gt;
end_request: I/O error, dev sdb, sector 0&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
SCSI device sdb: 117210240 512-byte hdwr sectors (60012 MB)&lt;br /&gt;
sdb: Write Protect is off&lt;br /&gt;
sdb: Mode Sense: 00 3a 00 00&lt;br /&gt;
SCSI device sdb: drive cache: write back&lt;br /&gt;
SCSI device sdb: 117210240 512-byte hdwr sectors (60012 MB)&lt;br /&gt;
sdb: Write Protect is off&lt;br /&gt;
sdb: Mode Sense: 00 3a 00 00&lt;br /&gt;
SCSI device sdb: drive cache: write back&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The situation is not cured by a reboot (I still see only /dev/sdb), I have to power cycle to get the devices back.&lt;br /&gt;
&lt;br /&gt;
Thanks for any ideas.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
(2006-10-10) As a followup to my note above, I have noticed that the DVD-RW drive works perfectly after hot-swapping it - it's just the second hard disk that doesg not get recognized properly. I can &amp;quot;scsiping&amp;quot; the /dev/sdb device and it seems to respond OK, I have tried restarting udevd without success, and I'm at a loss as to what to try next.&lt;/div&gt;</summary>
		<author><name>ZZamboni</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Talk:How_to_hotswap_Ultrabay_devices&amp;diff=25125</id>
		<title>Talk:How to hotswap Ultrabay devices</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Talk:How_to_hotswap_Ultrabay_devices&amp;diff=25125"/>
		<updated>2006-10-05T13:44:30Z</updated>

		<summary type="html">&lt;p&gt;ZZamboni: Second disk not seen correctly on reinsert (T43p)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I recently tried using the libata-tj patch tarball for 2.6.16.16, applying this against the newly released 2.6.16.18 kernel (released today.)  Patch applied cleanly.  Upon boot, I immediately get a multitude of &amp;quot;weird&amp;quot; errors -- strange lockups, programs segmentation fault (running &amp;quot;top&amp;quot; resulted in a seg fault), and ultimately a hard lockup.&lt;br /&gt;
&lt;br /&gt;
I booted back to my vanilla 2.6.16.16, ran fsck (appeared to just replay a few transactions, no major damage), and am back to normal.  However, it successfully scared me off - unfortunately can't risk too much downtime (or worse, subtle fs corruption) right now on my main system.  Anybody have experiences with this on a T43p using piix driver?&lt;br /&gt;
&lt;br /&gt;
--[[User:gsmenden|gsmenden]] 00:00, 23 May 2006 (EST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
The 2.6.16.16 patch works fine on my T43. There's a git tree (mentioned on the patch's webpage) which is closer to 2.6.18, but AFAIK no simple unified patch was prepred.&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 08:37, 23 May 2006 (CEST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Cool.  If I get brave I'll try it again on the 43p against 2.6.16.16 proper and report back.&lt;br /&gt;
&lt;br /&gt;
--[[User:gsmenden|gsmenden]] 15:29, 23 May 2006 (EST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Works fine here on 2.6.16.&lt;br /&gt;
I got only one crash with Suspend to Ram, which I'm unable to reproduce yet.&lt;br /&gt;
I renamed the acpi event files because at least my acpid doesn't read files that ends with .conf&lt;br /&gt;
&lt;br /&gt;
--[[User:Defiant|Defiant]] 21:09, 28 May 2006 (CEST)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
Update - patched against 2.6.16.19, works fine.  It appears my previous problems were due to a disk error unrelated to the patch.  Excellent!&lt;br /&gt;
&lt;br /&gt;
--[[User:gsmenden|gsmenden]] 00:57, 31 May 2006 (EST)&lt;br /&gt;
&lt;br /&gt;
Anybody have time to make a patch of the libata(-tj) .git tree against the recently released 2.6.17?  I hope to make one in the future if not...&lt;br /&gt;
&lt;br /&gt;
--[[User:gsmenden|gsmenden]] 22:08, 19 Jun 2006 (EST)&lt;br /&gt;
&lt;br /&gt;
== one nit about ultrabay_close script / patch against 2.6.17 available ==&lt;br /&gt;
&lt;br /&gt;
Howdy,&lt;br /&gt;
&lt;br /&gt;
In ultrabay_close, there is 'sleep 3' for disk spinup, which isn't necessary.  libata itself waits for disk spinup and if something breaks (e.g. first reset fails w/ timeout or something), it's libata's fault.  Please remove that line and see if anything breaks.&lt;br /&gt;
&lt;br /&gt;
Also, I've uploaded patch against 2.6.17/2.6.17.1 today.&lt;br /&gt;
&lt;br /&gt;
http://home-tj.org/files/libata-tj-stable/libata-tj-2.6.17-20060625-1.tar.bz2&lt;br /&gt;
&lt;br /&gt;
Hmmm... My post looks different from others.  This wasn't intentional.  Just don't know how to add normal discussion entry.  Sorry.&lt;br /&gt;
&lt;br /&gt;
--tj&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Right, it works fine without &amp;quot;sleep 3&amp;quot; using the new patches. Sleep removed.&lt;br /&gt;
&lt;br /&gt;
--[[User:Thinker|Thinker]] 12:35, 1 July 2006 (CEST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Is it correct, that the ata_piix driver in kernel 2.6.18 RC4 now supports hot swapping like described in the howto and announced here http://lwn.net/Articles/183734/?&lt;br /&gt;
&lt;br /&gt;
--[[User:cob|cob]] 15:53, 23 August 2006&lt;br /&gt;
&lt;br /&gt;
== T42 freezing up when trying to hot swap ultrabay. ==&lt;br /&gt;
&lt;br /&gt;
Hi, &lt;br /&gt;
&lt;br /&gt;
Please bear with me.  I am totally new at this and I am making my best effort to understand and learn. &lt;br /&gt;
&lt;br /&gt;
My problem is that when typing &amp;quot;# echo eject &amp;gt; /proc/acpi/ibm/bay&amp;quot; to eject my ultrabay and put another in, I see the power going off in the ultrabay LED, but then my PC freezes completely. &lt;br /&gt;
&lt;br /&gt;
I am running Fedora 6 Test 3, kernel 2.6.17-1.2647 and my notebook is a ThinkPad T42.&lt;br /&gt;
&lt;br /&gt;
Please help!  I have to constantly be changing my bay to use information in other hard drives, and I have to shutdown the system completely to not have any problems. &lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
&lt;br /&gt;
--Barny  09/21/2006@7:46PM EST&lt;br /&gt;
&lt;br /&gt;
== Second disk not seen correctly on reinsert (T43p) ==&lt;br /&gt;
&lt;br /&gt;
I have followed the instructions on my T43p running Gentoo using 2.6.18. I have a second hard disk in the UltraBay, using ata_piix, so it is seen as /dev/sdb (as described in [[Problems with SATA and Linux#No_DMA_on_system_hard_disk|Problems with SATA and Linux]]). The eject works fine. When I reinsert it and issue the rescan command, Only the main /dev/sdb device reappears, but not the ones corresponding to the partitions (/dev/sdb1, etc.), so I cannot mount them, and fdisk /dev/sdb says that it cannot open the device.&lt;br /&gt;
&lt;br /&gt;
In dmesg, I see a bunch of errors like these, repeated multiple times:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sd 1:0:0:0: SCSI error: return code = 0x08000002&lt;br /&gt;
sdb: Current: sense key=0xb&lt;br /&gt;
    ASC=0x0 ASCQ=0x0&lt;br /&gt;
end_request: I/O error, dev sdb, sector 0&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
ata2.00: speed down requested but no transfer mode left&lt;br /&gt;
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0&lt;br /&gt;
ata2.00: tag 0 cmd 0x20 Emask 0x1 stat 0x51 err 0x4 (device error)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And at the end:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sdb: Current: sense key=0xb&lt;br /&gt;
    ASC=0x0 ASCQ=0x0&lt;br /&gt;
end_request: I/O error, dev sdb, sector 0&lt;br /&gt;
ata2: EH complete&lt;br /&gt;
SCSI device sdb: 117210240 512-byte hdwr sectors (60012 MB)&lt;br /&gt;
sdb: Write Protect is off&lt;br /&gt;
sdb: Mode Sense: 00 3a 00 00&lt;br /&gt;
SCSI device sdb: drive cache: write back&lt;br /&gt;
SCSI device sdb: 117210240 512-byte hdwr sectors (60012 MB)&lt;br /&gt;
sdb: Write Protect is off&lt;br /&gt;
sdb: Mode Sense: 00 3a 00 00&lt;br /&gt;
SCSI device sdb: drive cache: write back&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The situation is not cured by a reboot (I still see only /dev/sdb), I have to power cycle to get the devices back.&lt;br /&gt;
&lt;br /&gt;
Thanks for any ideas.&lt;/div&gt;</summary>
		<author><name>ZZamboni</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_enable_integrated_fingerprint_reader_with_BioAPI&amp;diff=22913</id>
		<title>How to enable integrated fingerprint reader with BioAPI</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_enable_integrated_fingerprint_reader_with_BioAPI&amp;diff=22913"/>
		<updated>2006-06-26T12:42:24Z</updated>

		<summary type="html">&lt;p&gt;ZZamboni: /* Make xscreensaver use the scanner */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page describes the process of getting the [[Integrated Fingerprint Reader|integrated fingerprint reader]] to work under Linux. It is based on experiences in {{Ubuntu}} on a T43. The same works on {{Fedora}} 4 and 5, RHEL4, SuSE 9.3, SuSE 10, and {{Gentoo}}.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Basic installation==&lt;br /&gt;
===Installing the bioapi framework===&lt;br /&gt;
====Automated installation script====&lt;br /&gt;
The [[Script for enabling the fingerprint reader]] automates the installation of most components (bioapi framework, driver, pam_bioapi, pam setup, device permissions, pamtester and enrolling), for some Linux distributions.&lt;br /&gt;
&lt;br /&gt;
====Binary packages====&lt;br /&gt;
&lt;br /&gt;
Note that these packages only take care of this one section. If you can use one, you should do so and then proceed to the section entitled, Installing and Configuring the Driver.&lt;br /&gt;
&lt;br /&gt;
=====Debian=====&lt;br /&gt;
*If you're using {{Debian}} Sid (the unstable branch) you can try the packages from Michael R. Crusoe's site, either [http://www.qrivy.net/~michael/temp/ version 1.2.3] (recommended) or [http://www.qrivy.net/~michael/debs/unstable/ older versions] which might not work with the steps in this howto.&lt;br /&gt;
*This seems to work for {{Ubuntu}} Breezy/Dapper too, so save yourself some trouble and grab it.&lt;br /&gt;
=====Gentoo=====&lt;br /&gt;
You can either grab the [http://www.qrivy.net/~michael/blua/bioapi/bioapi-1.2.2.ebuild.tar.bz2 ebuild], or use the source-install procedure below.&lt;br /&gt;
&lt;br /&gt;
Also see [http://toe.ch/~tsa/ibm-fingerprint/ http://toe.ch/~tsa/ibm-fingerprint/] for alternative documentation on installing on Gentoo including ebuilds for all the packages used.&lt;br /&gt;
=====Fedora Core=====&lt;br /&gt;
RPM packages for Fedora Core and installation instructions are available [[Installing Fedora Core 5 on a ThinkPad X41 Tablet#Fingerprint_Reader|here]]&lt;br /&gt;
&lt;br /&gt;
====Installing from source====&lt;br /&gt;
*Get the bioapi source:&lt;br /&gt;
:{{cmduser|wget http://www.qrivy.net/~michael/blua/bioapi/bioapi-latest.tar.bz2}}&lt;br /&gt;
*I could not compile bioapi with the graphical Qt tools. To do it manually, do the following:&lt;br /&gt;
:{{cmduser|tar xjf bioapi-latest.tar.bz2}}&lt;br /&gt;
:{{cmduser|cd bioapi-1.2.2}}&lt;br /&gt;
:{{cmduser|1=./configure --with-Qt-dir=no}}&lt;br /&gt;
:{{cmduser|make}}&lt;br /&gt;
:and then as root&lt;br /&gt;
:{{cmdroot|make install}}&lt;br /&gt;
:If make install fails, be sure you're root and then:&lt;br /&gt;
:{{cmdroot|1=export LD_LIBRARY_PATH=/usr/local/lib}}&lt;br /&gt;
:{{cmdroot|make install}}&lt;br /&gt;
:and if you want to compile pam_bioapi for auth later&lt;br /&gt;
:{{cmdroot|cp include/bioapi_util.h include/installdefs.h imports/cdsa/v2_0/inc/cssmtype.h /usr/include}}&lt;br /&gt;
:Be aware that checkinstall will not work!&lt;br /&gt;
:(I got through configure with Qt, but got a cryptic build error.  It all worked fine with Qt disabled as above)&lt;br /&gt;
:buzz: This is due to a wrong qt include path, set it manually in configure and everything should work.&lt;br /&gt;
*Bioapi (at least version 1.2.2) doesn't compile with GCC4. You need to patch it:&lt;br /&gt;
*This is neccessary to compile on SUSE 10.1 which it using gcc version 4.1.0.&lt;br /&gt;
:{{cmduser|wget http://upir.cz/linux/patches/bioapi-1.2.2-gcc4.patch}}&lt;br /&gt;
:{{cmduser|patch -p1 &amp;lt; bioapi-1.2.2-gcc4.patch}}&lt;br /&gt;
*Patch for gcc 4.1 is available here - http://cvs.pld-linux.org/cgi-bin/cvsweb/SOURCES/bioapi-c++.patch&lt;br /&gt;
* By default, bioapi will install numerous files in {{path|/usr/local/&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;bin,lib,include&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;}}, including files with &amp;quot;self-explanatory&amp;quot; names such as {{path|/usr/local/bin/Sample}}. To prevent this pollution:&lt;br /&gt;
:Create a dedicated directory, for example {{path|/opt/bioapi}} .&lt;br /&gt;
:Append &amp;lt;tt&amp;gt;--prefix=/opt/bioapi&amp;lt;/tt&amp;gt; to the above &amp;lt;tt&amp;gt;./configure&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
:Append {{path|/opt/bioapi/bin}} to &amp;lt;tt&amp;gt;$PATH&amp;lt;/tt&amp;gt; and {{path|/opt/bioapi/lib}} to &amp;lt;tt&amp;gt;$LD_LIBRARY_PATH&amp;lt;/tt&amp;gt;.&lt;br /&gt;
:When installing the driver (below), tell it the new install path: {{cmdroot|sh install.sh /opt/bioapi/lib}}&lt;br /&gt;
&lt;br /&gt;
====Adjusting ldconfigs library search path====&lt;br /&gt;
At least on {{Fedora}} or {{Aurox}} 11, you may need to add {{path|/usr/local/lib}} to the library path so that the libraries referenced from &amp;lt;tt&amp;gt;pam_bioapi.so&amp;lt;/tt&amp;gt; get picked up properly. The usual way to do this is adding it to the ldconfig configuration:&lt;br /&gt;
:{{cmdroot|echo '/usr/local/lib' &amp;gt; /etc/ld.so.conf.d/bioapi.conf}}&lt;br /&gt;
:{{cmdroot|ldconfig}}&lt;br /&gt;
Alternatively you can add it to the LD_LIBRARY variable.&lt;br /&gt;
&lt;br /&gt;
If you see bioapi libs in the output of &lt;br /&gt;
:{{cmdroot|ldconfig -p | grep bioapi}}&lt;br /&gt;
then it should work.&lt;br /&gt;
&lt;br /&gt;
===Installing and configuring the driver===&lt;br /&gt;
====Installing the driver====&lt;br /&gt;
*Download {{path|TFMESS_BSP_LIN_1.0.zip}} from the [http://www.upek.com/support/dl_linux_bsp.asp UPEK support site] and unzip it into a seperate folder, as it will not create one.&lt;br /&gt;
*Change to that folder and do as root:&lt;br /&gt;
:{{cmdroot|sh install.sh}}&lt;br /&gt;
:If you're running Gentoo, use&lt;br /&gt;
:{{cmdroot|sh install.sh /usr/lib}}&lt;br /&gt;
:If that fails, it may be that make install failed up above -- try setting LD_LIBRARY_PATH, do the make install again, and come back here and try this again.  You also need {{cmd|mod_install|}} from bioapi in your PATH.&lt;br /&gt;
:May there still occures and error, which means mod_install: command not found.&lt;br /&gt;
:Then login as root - not su!&lt;br /&gt;
:Do this:&lt;br /&gt;
:{{cmdroot|sh install.sh}}&lt;br /&gt;
:again. It should work. SU to root does not work since then the /usr/local/bin directory is not used per default.&lt;br /&gt;
&lt;br /&gt;
====Configuring permissions for non-root use====&lt;br /&gt;
If you want to use PAM-aware applications like xscreensaver that are NOT running with root permissions (as opposed to login, gdm or other authentication mechanisms), you may need to do all or at least some of the things in this section.  More details on what is necessary on which distributions would be greately appreciated.&lt;br /&gt;
*Create two groups, one for access to BioAPI files and the other for access to the usb files.  (This is done for full generality; i.e., you may have other USB devices which you want accessable to other users, without exposing your BioAPI configuration to them).  Add your normal user (the one you wish to use PAM-aware applications with) to both of these groups.&lt;br /&gt;
On {{Debian}} this is done with&lt;br /&gt;
:{{cmdroot|addgroup --system bioapi}}&lt;br /&gt;
:{{cmdroot|addgroup --system usbfs}}&lt;br /&gt;
:{{cmdroot|adduser yournormaluser bioapi}}&lt;br /&gt;
:{{cmdroot|adduser yournormaluser usbfs}}&lt;br /&gt;
On {{SUSE}} this is done with&lt;br /&gt;
:{{cmdroot|groupadd --system bioapi}}&lt;br /&gt;
:{{cmdroot|groupadd --system usbfs}}&lt;br /&gt;
:{{cmdroot|groupmod -A yournormaluser bioapi}}&lt;br /&gt;
:{{cmdroot|groupmod -A yournormaluser usbfs}}&lt;br /&gt;
On {{Mandriva}} this is done with&lt;br /&gt;
:{{cmdroot|groupadd -r bioapi}}&lt;br /&gt;
:{{cmdroot|groupadd -r usbfs}}&lt;br /&gt;
:{{cmdroot|usermod -G bioapi,usbfs yournormaluser}}&lt;br /&gt;
&lt;br /&gt;
:(where {{cmd|yournormaluser|}} is your normal user name).  You will need to log out and log back in for this to take effect.&lt;br /&gt;
*Set permissions on the BioAPI config/registry directory:&lt;br /&gt;
:{{cmdroot|chown -R root:bioapi /usr/local/var/bioapi/}}&lt;br /&gt;
:{{cmdroot|chmod -R 770 /usr/local/var/bioapi/}}&lt;br /&gt;
:(change this path if you used an alternate BioAPI install directory above)&lt;br /&gt;
*Set permissions on the files in {{path|/proc/bus/usb}}:&lt;br /&gt;
:{{cmdroot|chown -R root:usbfs /proc/bus/usb}}&lt;br /&gt;
:{{cmdroot|chmod -R g+X /proc/bus/usb}}&lt;br /&gt;
:{{cmdroot|chown root:usbfs /proc/bus/usb/`lsusb &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; sed -ne &amp;quot;/0483:2016/s/Bus\ \(.*\)\ Device\ \(.*\):\ .*/\1\/\2/p&amp;quot;`}}&lt;br /&gt;
:{{cmdroot|chmod 660 /proc/bus/usb/`lsusb &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; sed -ne &amp;quot;/0483:2016/s/Bus\ \(.*\)\ Device\ \(.*\):\ .*/\1\/\2/p&amp;quot;`}}&lt;br /&gt;
:You may need to replace {{cmd|lsusb|}} with its full path, which is something like {{cmd|/sbin/lsusb|}} or {{cmd|/usr/bin/lsusb|}} depending on your distro.  It might be necessary to put these lines into a script which is run at startup and resume from suspend/hibernate.&lt;br /&gt;
*As an alternative to the {{cmd|chown|}}/{{cmd|chmod|}} commands above, you can set mount options for usbfs with a line in {{path|/etc/fstab|}}; an example would be&lt;br /&gt;
 none /proc/bus/usb usbfs defaults,devgid=108,devmode=0660,busgid=108,busmode=0770,listgid=108,listmode=0660 0 0&lt;br /&gt;
:where 108 is replaced with the numerical group ID of the usbfs group (you can determine this with something like {{cmd|cat /etc/group &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; grep usbfs &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; cut -d':' -f 3|}}).  Make sure you only have one {{path|/proc/bus/usb}} entry in {{path|/etc/fstab}}.  See the {{cmd|mount(8)|}} manpage for more information on these options.  This is &amp;quot;cleaner&amp;quot; but seems to have a few weird issues -- see the talk page for details.&lt;br /&gt;
*You may also have files in {{path|/dev/bus/usb}}, which the driver will try before {{path|/proc/bus/usb}}.  If this is another usbfs mount point ({{cmd|mount|}} shows a line containing {{cmdresult|/dev/bus/usb type usbfs}}), then simply follow the above instructions with {{path|/dev/bus/usb}} rather than {{path|/proc/bus/usb}}.  Otherwise, you may be running a new kernel (i.e. 2.6.15) that makes usbfs-like files available through {{path|/dev/bus/usb}}.  On systems running udev these files are dynamically created; you can configure their permissions by editing a udev config file.  On Debian this is done by changing the &amp;lt;tt&amp;gt;usb_device&amp;lt;/tt&amp;gt; line of {{path|/etc/udev/permissions.rules}} to read&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb_device&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;usbfs&amp;quot;&lt;br /&gt;
*For the beta versions only, there is a logfile, which needs to exist with the proper permissions:&lt;br /&gt;
:{{cmdroot|touch /var/log/BSP.log &amp;amp;&amp;amp; chown root:bioapi /var/log/BSP.log &amp;amp;&amp;amp; chmod 660 /var/log/BSP.log}}&lt;br /&gt;
&lt;br /&gt;
====Miscellaneous configuration====&lt;br /&gt;
* To increase the security level (minimize false accept rate), set this in {{path|/etc/tfmessbsp.cfg}}:&lt;br /&gt;
 security-level=&amp;quot;5&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Testing the driver and enrolling a fingerprint===&lt;br /&gt;
To test the driver and generate the file containing your fingerprint information, you need a sample program included with the driver.  The compilation steps below were discovered by trial and error; if they don't work for you, try the binary {{cmd|Sample|}} utility that came with the beta versions of the driver (i.e., {{path|TFMESS_BSP_LIN_1.0beta2.zip}} as mentioned above).&lt;br /&gt;
Go to the folder where you extracted {{path|TFMESS_BSP_LIN_1.0.zip}} and do:&lt;br /&gt;
:{{cmdroot|cd NonGUI_Sample}}&lt;br /&gt;
:Edit {{path|main.c|}} and remove (or comment out) the line&lt;br /&gt;
 #include &amp;quot;port/bioapi_port.h&amp;quot;&lt;br /&gt;
:{{cmdroot|gcc -o Sample main.c -L/usr/local/lib -lbioapi100 -DUNIX -DLITTLE_ENDIAN}}&lt;br /&gt;
:{{cmdroot|./Sample}}&lt;br /&gt;
:Note that Sample may only run as root, unless you've already configured the usbfs file permissions.&lt;br /&gt;
:You can try to &amp;quot;e&amp;quot;nroll (to record a fingerprint for an account) and then &amp;quot;v&amp;quot;erify (to test a fingerprint against the one it expects for an account).&lt;br /&gt;
:You'll save a step later if you use your own login username as the username to enroll here.&lt;br /&gt;
&lt;br /&gt;
==Login via pam_bioapi==&lt;br /&gt;
&lt;br /&gt;
The following explains how to add fingerprint authentiation to programs that use the PAM (Pluggable Authentication Modules) framework, such as  Gnome's GDM and KDE's KDM and screensaver.&lt;br /&gt;
&lt;br /&gt;
===Getting required libs &amp;amp; tools===&lt;br /&gt;
====Installing pam_bioapi====&lt;br /&gt;
*Prerequisites&lt;br /&gt;
:On SuSE 10, I needed to install the pam-devel RPM&lt;br /&gt;
:In general, you will need pam itself (standard for most distros) as well as the pam development files (probably an optional package for your distro).&lt;br /&gt;
*Get and compile the pam_bioapi module.&lt;br /&gt;
:{{cmduser|wget http://www.qrivy.net/~michael/blua/pam_bioapi/pam_bioapi-latest.tar.bz2}}&lt;br /&gt;
:{{cmduser|tar xjf pam_bioapi-latest.tar.bz2}}&lt;br /&gt;
:{{cmduser|cd pam_bioapi-0.2.1}}&lt;br /&gt;
:{{cmduser|wget http://badcode.de/downloads/fingerprint.patch}}&lt;br /&gt;
:{{cmduser|patch -p0 &amp;lt; fingerprint.patch}}&lt;br /&gt;
:If you want to, review the patch. In general you should review all code you download and compile, if possible. The patch comes from [http://linuxbiometrics.com/modules/newbb/viewtopic.php?viewmode=flat&amp;amp;topic_id=80&amp;amp;forum=1 this thread].&lt;br /&gt;
:{{cmduser|./configure &amp;amp;&amp;amp; make}}&lt;br /&gt;
:and as root&lt;br /&gt;
:{{cmdroot| make install}}&lt;br /&gt;
:{{cmdroot| cp /usr/local/lib/security/* /lib/security/}}&lt;br /&gt;
{{NOTE|If you get a 'rpl_malloc' error in /var/log/auth.log when trying to use the fingerprint reader, redo these steps and remove the related term from Makefile after running ./configure. (FC3, Debian etch)}}&lt;br /&gt;
*If you get 'configure: error: cannot find required header: security/_pam_macros.h' and are on a Debian-like system, do &amp;quot;apt-get install libpam0g-dev&amp;quot; and try again. If you are using a Mandriva distribution, do &amp;quot;urpmi libpam0-devel&amp;quot; instead.&lt;br /&gt;
*If you get 'PAM [dlerror: /lib/security/pam_bioapi.so: undefined symbol: BioAPIMemoryFuncs]' error in your syslog, replace 'LIBS = ' line in {{path|libpam_bioapi/makefile}} with the following (of course, replace {{path|/opt/bioapi/}} with the path where you installed bioapi):&lt;br /&gt;
 LIBS = -L/opt/bioapi/lib -lbioapi100 -lbioapi_mds300 -lmds_util&lt;br /&gt;
*Use the sample tool from the fingerprint reader to create {{path|&amp;lt;username&amp;gt;.bir}} (&amp;lt;tt&amp;gt;&amp;lt;username&amp;gt;&amp;lt;/tt&amp;gt; '''must''' be the username you want to login with. gdm will probably break for any login name that has no .bir file).&lt;br /&gt;
*As root do:&lt;br /&gt;
:{{cmdroot|SERIAL&amp;lt;nowiki&amp;gt;=`BioAPITest | sed -ne &amp;quot;/Fingerprint/{n;n;s/^.*: \(.\{9\}\)\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)\(.*\)/\1-\2-\3-\4-\5/gp}&amp;quot;` &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
:{{cmdroot|echo $SERIAL}} should print something like {{cmdresult|&amp;lt;nowiki&amp;gt;{5550454b-2054-464d-2f45-535320425350}&amp;lt;/nowiki&amp;gt;}} now.&lt;br /&gt;
:If it does, do:&lt;br /&gt;
:{{cmdroot|mkdir -p /etc/bioapi/pam/$SERIAL}}&lt;br /&gt;
:{{cmdroot|cp &amp;lt;username&amp;gt;.bir /etc/bioapi/pam/$SERIAL}}&lt;br /&gt;
:If not, you might just try&lt;br /&gt;
:{{cmdroot|SERIAL&amp;lt;nowiki&amp;gt;={5550454b-2054-464d-2f45-535320425350}&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
:as this value is hardcoded into the UPEK docs.&lt;br /&gt;
&lt;br /&gt;
===Configuring pam===&lt;br /&gt;
The following part is distribution specific. On {{Ubuntu}} or {{SUSE}} you can modify {{path|/etc/pam.d/common-auth}} (on {{Gentoo}} and {{Fedora}} it is {{path|/etc/pam.d/system-auth}}) to look like this:&lt;br /&gt;
&lt;br /&gt;
 #&lt;br /&gt;
 # /etc/pam.d/common-auth - authentication settings common to all services&lt;br /&gt;
 #&lt;br /&gt;
 # This file is included from other service-specific PAM config files,&lt;br /&gt;
 # and should contain a list of the authentication modules that define&lt;br /&gt;
 # the central authentication scheme for use on the system&lt;br /&gt;
 # (e.g., /etc/shadow, LDAP, Kerberos, etc.).  The default is to use the&lt;br /&gt;
 # traditional Unix authentication mechanisms.&lt;br /&gt;
 #&lt;br /&gt;
 auth       sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 password   sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 auth       required     pam_unix.so nullok_secure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
For '''Gentoo'''-Users - this allows you to attempt a password first. If you simply press enter, it then prompts for a fingerprints. Create a file named {{path|/etc/pam.d/bioapi}}. This also means that remote services, such as SSH keep working:&lt;br /&gt;
&lt;br /&gt;
 auth       required     pam_env.so&lt;br /&gt;
 auth       sufficient   pam_unix.so likeauth nullok&lt;br /&gt;
 auth       sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 auth       required     pam_deny.so&lt;br /&gt;
 &lt;br /&gt;
 account    required     pam_unix.so&lt;br /&gt;
 &lt;br /&gt;
 session    required     pam_limits.so&lt;br /&gt;
 session    required     pam_unix.so&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Now, simply replace &amp;quot;auth include system-auth&amp;quot; in all services that you wish to use fingerprint for with &amp;quot;auth include bioapi&amp;quot;. For example, {{path|/etc/pam.d/kde}} by default contains&lt;br /&gt;
&lt;br /&gt;
  auth       include      system-auth&lt;br /&gt;
  auth       required     pam_nologin.so&lt;br /&gt;
  &lt;br /&gt;
  account    include      system-auth&lt;br /&gt;
  &lt;br /&gt;
  password   include      system-auth&lt;br /&gt;
  &lt;br /&gt;
  session    include      system-auth&lt;br /&gt;
&lt;br /&gt;
Simply replace the first &amp;quot;system-auth&amp;quot; with bioapi and you can also get rid of KDE desktop lock with a fingerprint. If you do not wish to allow for &amp;quot;password fallback&amp;quot; then remove &lt;br /&gt;
&lt;br /&gt;
 auth       sufficient   pam_unix.so likeauth nullok&lt;br /&gt;
&lt;br /&gt;
from {{path|/etc/pam.d/bioapi}}.&lt;br /&gt;
&lt;br /&gt;
{{WARN|If su/sudo expects to receive the root password (SuSE 10), you need to have fingerprint settings for root (that is, copy in a root.bir as well as a your-username.bir).  Otherwise, they get a segmentation fault.  Which is a little unfortunate, given that you need to su or sudo to change your settings... }}&lt;br /&gt;
{{WARN|Not only SuSE 10 requires root.bir to be available for su to work. Just make sure you have root.bir when su is not working with your fingerprint reader but other applications are...}}&lt;br /&gt;
Note that sshd may pick up the fingerprint settings from {{path|/etc/pam.d/common-auth}}.  I didn't want that, so I removed the &amp;quot;auth include common-auth&amp;quot; line from {{path|/etc/pam.d/sshd}} and replaced it with the lines that were originally in my {{path|/etc/pam.d/common-auth}}.  That way most local services use the fingerprint reader, but sshd does not.&lt;br /&gt;
&lt;br /&gt;
Another way to do this is to create a file ({{path|/etc/pam.d/bioapi|}} for example) which contains the {{cmd|pam_bioapi.so|}} lines, and explicitly {{cmd|@include|}} this '''before''' {{path|/etc/pam.d/common-auth|}} in the files for services which should use the fingerprint reader.  In this case you should leave {{path|/etc/pam.d/common-auth|}} alone.&lt;br /&gt;
&lt;br /&gt;
{{NOTE|This was discovered through trial and success, if it is plain wrong, wikorrect it, please.}}&lt;br /&gt;
&lt;br /&gt;
In {{Fedora}} the original 'session' terms in {{path|/etc/pam.d/system-auth}} need to be kept.&lt;br /&gt;
&lt;br /&gt;
{{HINT|The setup described above will/could affect remote ssh logins to also use biometric logins, which is a bit silly (who wants to remote ssh to the laptop, and then have to walk over to it and swipe your finger)&amp;lt;br /&amp;gt;To avoid that you can copy the default &amp;lt;tt&amp;gt;/etc/pam.d/system-auth&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/etc/pam.d/sshd&amp;lt;/tt&amp;gt; which will allow the sshd service to use the standard authentication procedure.}}&lt;br /&gt;
&lt;br /&gt;
You can do some useful testing with [http://pamtester.sourceforge.net/ {{cmd|pamtester|}}], which calls the pam modules as if it were a program of your choice.  Examples:&lt;br /&gt;
:{{cmdroot|pamtester xdm yourusername authenticate}}&lt;br /&gt;
:{{cmduser|pamtester xscreensaver yourusername authenticate}}&lt;br /&gt;
where {{cmd|yourusername|}} is your username.  Note that {{cmd|pamtester|}} should run as root if and only if the program in question does.&lt;br /&gt;
&lt;br /&gt;
===Application support===&lt;br /&gt;
The implementation of fingerprint scanning support in the relevant applications varies.&lt;br /&gt;
&lt;br /&gt;
Here is the behaviour of the most common ones:&lt;br /&gt;
* In gdm enter your username and there should pop up an (ugly) image to swipe your finger and... magic - you can login without a password.&lt;br /&gt;
* kdm doesn't give any visual indication, other than that the cursor stops blinking. Just swipe your finger and hope it lets you log in.&lt;br /&gt;
* In xdm, enter your username and a blank password, then swipe (there is no popup as well).&lt;br /&gt;
* The KDE screen saver in SUSE 10 requires you to enter an empty password (or select the correct user and then enter an empty password) in order to get the fingerprint prompt.&lt;br /&gt;
* For Fedora users, the redhat-config tools will crash if no root.bir presents. Also, there won't be any visual idication unless X server is properly configured for root to access. Just swipe your finger when the HDD stopped blinking or issue the following command in advance:&lt;br /&gt;
:{{cmduser|xhost +local:}}&lt;br /&gt;
* For RHEL4 users gdm, console (virtual terminal) logins and the xscreensaver all work&lt;br /&gt;
&lt;br /&gt;
===kdm support===&lt;br /&gt;
To add graphical popup to kdm, you need following:&lt;br /&gt;
* Patch for pam_bioapi. This patch adds third parameter to {{path|pam_bioapi.so}} module, which is a name of file with additional environment variables that will be supplied to the UPEK driver.&lt;br /&gt;
:{{cmdroot|wget http://upir.cz/linux/patches/pam_bioapi-0.2.1-alter-environ.patch}}&lt;br /&gt;
:{{cmdroot|patch -p1 &amp;lt; pam_bioapi-0.2.1-alter-environ.patch}}&lt;br /&gt;
* Edit your {{path|Xsetup}} file (on SUSE 10 it's {{path|/etc/X11/xdm/Xsetup}}) and add these lines:&lt;br /&gt;
 echo &amp;quot;XAUTHORITY=$XAUTHORITY&amp;quot; &amp;gt; /var/lib/xdm/kdm_env&lt;br /&gt;
 echo &amp;quot;DISPLAY=$DISPLAY&amp;quot; &amp;gt;&amp;gt; /var/lib/xdm/kdm_env&lt;br /&gt;
* In {{path|/etc/pam.d/xdm}} file, add {{path|/var/lib/xdm/kdm_env}} as a third parameter for {{path|pam_bioapi.so}} module:&lt;br /&gt;
 auth sufficient pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/ /var/lib/xdm/kdm_env&lt;br /&gt;
&lt;br /&gt;
Please note, that this won't work if you have more than one Xserver.&lt;br /&gt;
&lt;br /&gt;
==Make xscreensaver use the scanner==&lt;br /&gt;
If you are using Gentoo, you can get a portage overlay with the necessary patches here: http://www.zzamboni.org/brt/files/xscreensaver-fingerprint-overlay.tar.gz&lt;br /&gt;
*Get the needed xscreensaver sources:&lt;br /&gt;
:{{cmduser|wget http://www.jwz.org/xscreensaver/xscreensaver-4.23.tar.gz}}&lt;br /&gt;
:{{cmduser|tar xzf xscreensaver-4.23.tar.gz}}&lt;br /&gt;
:{{cmduser|cd xscreensaver-4.23}}&lt;br /&gt;
:{{cmduser|wget http://nax.hn.org/pub/bioapi/xscreensaver-4.22_alternativeAuth.diff&amp;lt;br/&amp;gt;This site seems to be down, use this mirror: http://zepan.org/files/xscreensaver-4.22_alternativeAuth.diff&amp;lt;br/&amp;gt;For xscreensaver 5.00, you can get a patch here: http://www.zzamboni.org/brt/files/xscreensaver-5.00-alternativeauth.patch}}&lt;br /&gt;
*After reviewing the patch (it's small and straightforward), do&lt;br /&gt;
:{{cmduser|patch -p1 &amp;lt; xscreensaver-4.22_alternativeAuth.diff}}&amp;lt;br /&amp;gt;The patch prevents xscreensaver from opening an authentification window and dispatches the authentification request to another program, in our case &amp;lt;tt&amp;gt;pam&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;pam_bioapi&amp;lt;/tt&amp;gt;. It should apply with some offset, don't mind that. If it says something about rejected though, then there's a problem.&lt;br /&gt;
*Compile with&lt;br /&gt;
:{{cmduser|./configure --with-pam &amp;amp;&amp;amp; make}}&amp;lt;br /&amp;gt;&lt;br /&gt;
*If you receive an error like &amp;quot;Couldn't find X11 headers/libs&amp;quot; and are running a Debian-like system, try &amp;quot;apt-get install xlibs-dev&amp;quot;&lt;br /&gt;
*If you receive an error like &amp;quot;undefined reference to `XmuPrintDefaultErrorMessage'&amp;quot; then install the libxmu-dev package and run the previous line again and then install as root with&lt;br /&gt;
:{{cmduser|su -c make install}} .&lt;br /&gt;
*Make sure that the newly compiled xscreensaver is used:&lt;br /&gt;
:{{cmduser|which xscreensaver}} should return&lt;br /&gt;
:{{cmdresult|/usr/local/bin/xscreensaver}} .&lt;br /&gt;
*In case it doesn't, try adjusting your PATH.&lt;/div&gt;</summary>
		<author><name>ZZamboni</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_enable_integrated_fingerprint_reader_with_BioAPI&amp;diff=22912</id>
		<title>How to enable integrated fingerprint reader with BioAPI</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_enable_integrated_fingerprint_reader_with_BioAPI&amp;diff=22912"/>
		<updated>2006-06-26T12:38:55Z</updated>

		<summary type="html">&lt;p&gt;ZZamboni: /* Make xscreensaver use the scanner */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page describes the process of getting the [[Integrated Fingerprint Reader|integrated fingerprint reader]] to work under Linux. It is based on experiences in {{Ubuntu}} on a T43. The same works on {{Fedora}} 4 and 5, RHEL4, SuSE 9.3, SuSE 10, and {{Gentoo}}.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Basic installation==&lt;br /&gt;
===Installing the bioapi framework===&lt;br /&gt;
====Automated installation script====&lt;br /&gt;
The [[Script for enabling the fingerprint reader]] automates the installation of most components (bioapi framework, driver, pam_bioapi, pam setup, device permissions, pamtester and enrolling), for some Linux distributions.&lt;br /&gt;
&lt;br /&gt;
====Binary packages====&lt;br /&gt;
&lt;br /&gt;
Note that these packages only take care of this one section. If you can use one, you should do so and then proceed to the section entitled, Installing and Configuring the Driver.&lt;br /&gt;
&lt;br /&gt;
=====Debian=====&lt;br /&gt;
*If you're using {{Debian}} Sid (the unstable branch) you can try the packages from Michael R. Crusoe's site, either [http://www.qrivy.net/~michael/temp/ version 1.2.3] (recommended) or [http://www.qrivy.net/~michael/debs/unstable/ older versions] which might not work with the steps in this howto.&lt;br /&gt;
*This seems to work for {{Ubuntu}} Breezy/Dapper too, so save yourself some trouble and grab it.&lt;br /&gt;
=====Gentoo=====&lt;br /&gt;
You can either grab the [http://www.qrivy.net/~michael/blua/bioapi/bioapi-1.2.2.ebuild.tar.bz2 ebuild], or use the source-install procedure below.&lt;br /&gt;
&lt;br /&gt;
Also see [http://toe.ch/~tsa/ibm-fingerprint/ http://toe.ch/~tsa/ibm-fingerprint/] for alternative documentation on installing on Gentoo including ebuilds for all the packages used.&lt;br /&gt;
=====Fedora Core=====&lt;br /&gt;
RPM packages for Fedora Core and installation instructions are available [[Installing Fedora Core 5 on a ThinkPad X41 Tablet#Fingerprint_Reader|here]]&lt;br /&gt;
&lt;br /&gt;
====Installing from source====&lt;br /&gt;
*Get the bioapi source:&lt;br /&gt;
:{{cmduser|wget http://www.qrivy.net/~michael/blua/bioapi/bioapi-latest.tar.bz2}}&lt;br /&gt;
*I could not compile bioapi with the graphical Qt tools. To do it manually, do the following:&lt;br /&gt;
:{{cmduser|tar xjf bioapi-latest.tar.bz2}}&lt;br /&gt;
:{{cmduser|cd bioapi-1.2.2}}&lt;br /&gt;
:{{cmduser|1=./configure --with-Qt-dir=no}}&lt;br /&gt;
:{{cmduser|make}}&lt;br /&gt;
:and then as root&lt;br /&gt;
:{{cmdroot|make install}}&lt;br /&gt;
:If make install fails, be sure you're root and then:&lt;br /&gt;
:{{cmdroot|1=export LD_LIBRARY_PATH=/usr/local/lib}}&lt;br /&gt;
:{{cmdroot|make install}}&lt;br /&gt;
:and if you want to compile pam_bioapi for auth later&lt;br /&gt;
:{{cmdroot|cp include/bioapi_util.h include/installdefs.h imports/cdsa/v2_0/inc/cssmtype.h /usr/include}}&lt;br /&gt;
:Be aware that checkinstall will not work!&lt;br /&gt;
:(I got through configure with Qt, but got a cryptic build error.  It all worked fine with Qt disabled as above)&lt;br /&gt;
:buzz: This is due to a wrong qt include path, set it manually in configure and everything should work.&lt;br /&gt;
*Bioapi (at least version 1.2.2) doesn't compile with GCC4. You need to patch it:&lt;br /&gt;
*This is neccessary to compile on SUSE 10.1 which it using gcc version 4.1.0.&lt;br /&gt;
:{{cmduser|wget http://upir.cz/linux/patches/bioapi-1.2.2-gcc4.patch}}&lt;br /&gt;
:{{cmduser|patch -p1 &amp;lt; bioapi-1.2.2-gcc4.patch}}&lt;br /&gt;
*Patch for gcc 4.1 is available here - http://cvs.pld-linux.org/cgi-bin/cvsweb/SOURCES/bioapi-c++.patch&lt;br /&gt;
* By default, bioapi will install numerous files in {{path|/usr/local/&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;bin,lib,include&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;}}, including files with &amp;quot;self-explanatory&amp;quot; names such as {{path|/usr/local/bin/Sample}}. To prevent this pollution:&lt;br /&gt;
:Create a dedicated directory, for example {{path|/opt/bioapi}} .&lt;br /&gt;
:Append &amp;lt;tt&amp;gt;--prefix=/opt/bioapi&amp;lt;/tt&amp;gt; to the above &amp;lt;tt&amp;gt;./configure&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
:Append {{path|/opt/bioapi/bin}} to &amp;lt;tt&amp;gt;$PATH&amp;lt;/tt&amp;gt; and {{path|/opt/bioapi/lib}} to &amp;lt;tt&amp;gt;$LD_LIBRARY_PATH&amp;lt;/tt&amp;gt;.&lt;br /&gt;
:When installing the driver (below), tell it the new install path: {{cmdroot|sh install.sh /opt/bioapi/lib}}&lt;br /&gt;
&lt;br /&gt;
====Adjusting ldconfigs library search path====&lt;br /&gt;
At least on {{Fedora}} or {{Aurox}} 11, you may need to add {{path|/usr/local/lib}} to the library path so that the libraries referenced from &amp;lt;tt&amp;gt;pam_bioapi.so&amp;lt;/tt&amp;gt; get picked up properly. The usual way to do this is adding it to the ldconfig configuration:&lt;br /&gt;
:{{cmdroot|echo '/usr/local/lib' &amp;gt; /etc/ld.so.conf.d/bioapi.conf}}&lt;br /&gt;
:{{cmdroot|ldconfig}}&lt;br /&gt;
Alternatively you can add it to the LD_LIBRARY variable.&lt;br /&gt;
&lt;br /&gt;
If you see bioapi libs in the output of &lt;br /&gt;
:{{cmdroot|ldconfig -p | grep bioapi}}&lt;br /&gt;
then it should work.&lt;br /&gt;
&lt;br /&gt;
===Installing and configuring the driver===&lt;br /&gt;
====Installing the driver====&lt;br /&gt;
*Download {{path|TFMESS_BSP_LIN_1.0.zip}} from the [http://www.upek.com/support/dl_linux_bsp.asp UPEK support site] and unzip it into a seperate folder, as it will not create one.&lt;br /&gt;
*Change to that folder and do as root:&lt;br /&gt;
:{{cmdroot|sh install.sh}}&lt;br /&gt;
:If you're running Gentoo, use&lt;br /&gt;
:{{cmdroot|sh install.sh /usr/lib}}&lt;br /&gt;
:If that fails, it may be that make install failed up above -- try setting LD_LIBRARY_PATH, do the make install again, and come back here and try this again.  You also need {{cmd|mod_install|}} from bioapi in your PATH.&lt;br /&gt;
:May there still occures and error, which means mod_install: command not found.&lt;br /&gt;
:Then login as root - not su!&lt;br /&gt;
:Do this:&lt;br /&gt;
:{{cmdroot|sh install.sh}}&lt;br /&gt;
:again. It should work. SU to root does not work since then the /usr/local/bin directory is not used per default.&lt;br /&gt;
&lt;br /&gt;
====Configuring permissions for non-root use====&lt;br /&gt;
If you want to use PAM-aware applications like xscreensaver that are NOT running with root permissions (as opposed to login, gdm or other authentication mechanisms), you may need to do all or at least some of the things in this section.  More details on what is necessary on which distributions would be greately appreciated.&lt;br /&gt;
*Create two groups, one for access to BioAPI files and the other for access to the usb files.  (This is done for full generality; i.e., you may have other USB devices which you want accessable to other users, without exposing your BioAPI configuration to them).  Add your normal user (the one you wish to use PAM-aware applications with) to both of these groups.&lt;br /&gt;
On {{Debian}} this is done with&lt;br /&gt;
:{{cmdroot|addgroup --system bioapi}}&lt;br /&gt;
:{{cmdroot|addgroup --system usbfs}}&lt;br /&gt;
:{{cmdroot|adduser yournormaluser bioapi}}&lt;br /&gt;
:{{cmdroot|adduser yournormaluser usbfs}}&lt;br /&gt;
On {{SUSE}} this is done with&lt;br /&gt;
:{{cmdroot|groupadd --system bioapi}}&lt;br /&gt;
:{{cmdroot|groupadd --system usbfs}}&lt;br /&gt;
:{{cmdroot|groupmod -A yournormaluser bioapi}}&lt;br /&gt;
:{{cmdroot|groupmod -A yournormaluser usbfs}}&lt;br /&gt;
On {{Mandriva}} this is done with&lt;br /&gt;
:{{cmdroot|groupadd -r bioapi}}&lt;br /&gt;
:{{cmdroot|groupadd -r usbfs}}&lt;br /&gt;
:{{cmdroot|usermod -G bioapi,usbfs yournormaluser}}&lt;br /&gt;
&lt;br /&gt;
:(where {{cmd|yournormaluser|}} is your normal user name).  You will need to log out and log back in for this to take effect.&lt;br /&gt;
*Set permissions on the BioAPI config/registry directory:&lt;br /&gt;
:{{cmdroot|chown -R root:bioapi /usr/local/var/bioapi/}}&lt;br /&gt;
:{{cmdroot|chmod -R 770 /usr/local/var/bioapi/}}&lt;br /&gt;
:(change this path if you used an alternate BioAPI install directory above)&lt;br /&gt;
*Set permissions on the files in {{path|/proc/bus/usb}}:&lt;br /&gt;
:{{cmdroot|chown -R root:usbfs /proc/bus/usb}}&lt;br /&gt;
:{{cmdroot|chmod -R g+X /proc/bus/usb}}&lt;br /&gt;
:{{cmdroot|chown root:usbfs /proc/bus/usb/`lsusb &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; sed -ne &amp;quot;/0483:2016/s/Bus\ \(.*\)\ Device\ \(.*\):\ .*/\1\/\2/p&amp;quot;`}}&lt;br /&gt;
:{{cmdroot|chmod 660 /proc/bus/usb/`lsusb &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; sed -ne &amp;quot;/0483:2016/s/Bus\ \(.*\)\ Device\ \(.*\):\ .*/\1\/\2/p&amp;quot;`}}&lt;br /&gt;
:You may need to replace {{cmd|lsusb|}} with its full path, which is something like {{cmd|/sbin/lsusb|}} or {{cmd|/usr/bin/lsusb|}} depending on your distro.  It might be necessary to put these lines into a script which is run at startup and resume from suspend/hibernate.&lt;br /&gt;
*As an alternative to the {{cmd|chown|}}/{{cmd|chmod|}} commands above, you can set mount options for usbfs with a line in {{path|/etc/fstab|}}; an example would be&lt;br /&gt;
 none /proc/bus/usb usbfs defaults,devgid=108,devmode=0660,busgid=108,busmode=0770,listgid=108,listmode=0660 0 0&lt;br /&gt;
:where 108 is replaced with the numerical group ID of the usbfs group (you can determine this with something like {{cmd|cat /etc/group &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; grep usbfs &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; cut -d':' -f 3|}}).  Make sure you only have one {{path|/proc/bus/usb}} entry in {{path|/etc/fstab}}.  See the {{cmd|mount(8)|}} manpage for more information on these options.  This is &amp;quot;cleaner&amp;quot; but seems to have a few weird issues -- see the talk page for details.&lt;br /&gt;
*You may also have files in {{path|/dev/bus/usb}}, which the driver will try before {{path|/proc/bus/usb}}.  If this is another usbfs mount point ({{cmd|mount|}} shows a line containing {{cmdresult|/dev/bus/usb type usbfs}}), then simply follow the above instructions with {{path|/dev/bus/usb}} rather than {{path|/proc/bus/usb}}.  Otherwise, you may be running a new kernel (i.e. 2.6.15) that makes usbfs-like files available through {{path|/dev/bus/usb}}.  On systems running udev these files are dynamically created; you can configure their permissions by editing a udev config file.  On Debian this is done by changing the &amp;lt;tt&amp;gt;usb_device&amp;lt;/tt&amp;gt; line of {{path|/etc/udev/permissions.rules}} to read&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb_device&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;usbfs&amp;quot;&lt;br /&gt;
*For the beta versions only, there is a logfile, which needs to exist with the proper permissions:&lt;br /&gt;
:{{cmdroot|touch /var/log/BSP.log &amp;amp;&amp;amp; chown root:bioapi /var/log/BSP.log &amp;amp;&amp;amp; chmod 660 /var/log/BSP.log}}&lt;br /&gt;
&lt;br /&gt;
====Miscellaneous configuration====&lt;br /&gt;
* To increase the security level (minimize false accept rate), set this in {{path|/etc/tfmessbsp.cfg}}:&lt;br /&gt;
 security-level=&amp;quot;5&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Testing the driver and enrolling a fingerprint===&lt;br /&gt;
To test the driver and generate the file containing your fingerprint information, you need a sample program included with the driver.  The compilation steps below were discovered by trial and error; if they don't work for you, try the binary {{cmd|Sample|}} utility that came with the beta versions of the driver (i.e., {{path|TFMESS_BSP_LIN_1.0beta2.zip}} as mentioned above).&lt;br /&gt;
Go to the folder where you extracted {{path|TFMESS_BSP_LIN_1.0.zip}} and do:&lt;br /&gt;
:{{cmdroot|cd NonGUI_Sample}}&lt;br /&gt;
:Edit {{path|main.c|}} and remove (or comment out) the line&lt;br /&gt;
 #include &amp;quot;port/bioapi_port.h&amp;quot;&lt;br /&gt;
:{{cmdroot|gcc -o Sample main.c -L/usr/local/lib -lbioapi100 -DUNIX -DLITTLE_ENDIAN}}&lt;br /&gt;
:{{cmdroot|./Sample}}&lt;br /&gt;
:Note that Sample may only run as root, unless you've already configured the usbfs file permissions.&lt;br /&gt;
:You can try to &amp;quot;e&amp;quot;nroll (to record a fingerprint for an account) and then &amp;quot;v&amp;quot;erify (to test a fingerprint against the one it expects for an account).&lt;br /&gt;
:You'll save a step later if you use your own login username as the username to enroll here.&lt;br /&gt;
&lt;br /&gt;
==Login via pam_bioapi==&lt;br /&gt;
&lt;br /&gt;
The following explains how to add fingerprint authentiation to programs that use the PAM (Pluggable Authentication Modules) framework, such as  Gnome's GDM and KDE's KDM and screensaver.&lt;br /&gt;
&lt;br /&gt;
===Getting required libs &amp;amp; tools===&lt;br /&gt;
====Installing pam_bioapi====&lt;br /&gt;
*Prerequisites&lt;br /&gt;
:On SuSE 10, I needed to install the pam-devel RPM&lt;br /&gt;
:In general, you will need pam itself (standard for most distros) as well as the pam development files (probably an optional package for your distro).&lt;br /&gt;
*Get and compile the pam_bioapi module.&lt;br /&gt;
:{{cmduser|wget http://www.qrivy.net/~michael/blua/pam_bioapi/pam_bioapi-latest.tar.bz2}}&lt;br /&gt;
:{{cmduser|tar xjf pam_bioapi-latest.tar.bz2}}&lt;br /&gt;
:{{cmduser|cd pam_bioapi-0.2.1}}&lt;br /&gt;
:{{cmduser|wget http://badcode.de/downloads/fingerprint.patch}}&lt;br /&gt;
:{{cmduser|patch -p0 &amp;lt; fingerprint.patch}}&lt;br /&gt;
:If you want to, review the patch. In general you should review all code you download and compile, if possible. The patch comes from [http://linuxbiometrics.com/modules/newbb/viewtopic.php?viewmode=flat&amp;amp;topic_id=80&amp;amp;forum=1 this thread].&lt;br /&gt;
:{{cmduser|./configure &amp;amp;&amp;amp; make}}&lt;br /&gt;
:and as root&lt;br /&gt;
:{{cmdroot| make install}}&lt;br /&gt;
:{{cmdroot| cp /usr/local/lib/security/* /lib/security/}}&lt;br /&gt;
{{NOTE|If you get a 'rpl_malloc' error in /var/log/auth.log when trying to use the fingerprint reader, redo these steps and remove the related term from Makefile after running ./configure. (FC3, Debian etch)}}&lt;br /&gt;
*If you get 'configure: error: cannot find required header: security/_pam_macros.h' and are on a Debian-like system, do &amp;quot;apt-get install libpam0g-dev&amp;quot; and try again. If you are using a Mandriva distribution, do &amp;quot;urpmi libpam0-devel&amp;quot; instead.&lt;br /&gt;
*If you get 'PAM [dlerror: /lib/security/pam_bioapi.so: undefined symbol: BioAPIMemoryFuncs]' error in your syslog, replace 'LIBS = ' line in {{path|libpam_bioapi/makefile}} with the following (of course, replace {{path|/opt/bioapi/}} with the path where you installed bioapi):&lt;br /&gt;
 LIBS = -L/opt/bioapi/lib -lbioapi100 -lbioapi_mds300 -lmds_util&lt;br /&gt;
*Use the sample tool from the fingerprint reader to create {{path|&amp;lt;username&amp;gt;.bir}} (&amp;lt;tt&amp;gt;&amp;lt;username&amp;gt;&amp;lt;/tt&amp;gt; '''must''' be the username you want to login with. gdm will probably break for any login name that has no .bir file).&lt;br /&gt;
*As root do:&lt;br /&gt;
:{{cmdroot|SERIAL&amp;lt;nowiki&amp;gt;=`BioAPITest | sed -ne &amp;quot;/Fingerprint/{n;n;s/^.*: \(.\{9\}\)\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)\(.*\)/\1-\2-\3-\4-\5/gp}&amp;quot;` &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
:{{cmdroot|echo $SERIAL}} should print something like {{cmdresult|&amp;lt;nowiki&amp;gt;{5550454b-2054-464d-2f45-535320425350}&amp;lt;/nowiki&amp;gt;}} now.&lt;br /&gt;
:If it does, do:&lt;br /&gt;
:{{cmdroot|mkdir -p /etc/bioapi/pam/$SERIAL}}&lt;br /&gt;
:{{cmdroot|cp &amp;lt;username&amp;gt;.bir /etc/bioapi/pam/$SERIAL}}&lt;br /&gt;
:If not, you might just try&lt;br /&gt;
:{{cmdroot|SERIAL&amp;lt;nowiki&amp;gt;={5550454b-2054-464d-2f45-535320425350}&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
:as this value is hardcoded into the UPEK docs.&lt;br /&gt;
&lt;br /&gt;
===Configuring pam===&lt;br /&gt;
The following part is distribution specific. On {{Ubuntu}} or {{SUSE}} you can modify {{path|/etc/pam.d/common-auth}} (on {{Gentoo}} and {{Fedora}} it is {{path|/etc/pam.d/system-auth}}) to look like this:&lt;br /&gt;
&lt;br /&gt;
 #&lt;br /&gt;
 # /etc/pam.d/common-auth - authentication settings common to all services&lt;br /&gt;
 #&lt;br /&gt;
 # This file is included from other service-specific PAM config files,&lt;br /&gt;
 # and should contain a list of the authentication modules that define&lt;br /&gt;
 # the central authentication scheme for use on the system&lt;br /&gt;
 # (e.g., /etc/shadow, LDAP, Kerberos, etc.).  The default is to use the&lt;br /&gt;
 # traditional Unix authentication mechanisms.&lt;br /&gt;
 #&lt;br /&gt;
 auth       sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 password   sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 auth       required     pam_unix.so nullok_secure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
For '''Gentoo'''-Users - this allows you to attempt a password first. If you simply press enter, it then prompts for a fingerprints. Create a file named {{path|/etc/pam.d/bioapi}}. This also means that remote services, such as SSH keep working:&lt;br /&gt;
&lt;br /&gt;
 auth       required     pam_env.so&lt;br /&gt;
 auth       sufficient   pam_unix.so likeauth nullok&lt;br /&gt;
 auth       sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 auth       required     pam_deny.so&lt;br /&gt;
 &lt;br /&gt;
 account    required     pam_unix.so&lt;br /&gt;
 &lt;br /&gt;
 session    required     pam_limits.so&lt;br /&gt;
 session    required     pam_unix.so&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Now, simply replace &amp;quot;auth include system-auth&amp;quot; in all services that you wish to use fingerprint for with &amp;quot;auth include bioapi&amp;quot;. For example, {{path|/etc/pam.d/kde}} by default contains&lt;br /&gt;
&lt;br /&gt;
  auth       include      system-auth&lt;br /&gt;
  auth       required     pam_nologin.so&lt;br /&gt;
  &lt;br /&gt;
  account    include      system-auth&lt;br /&gt;
  &lt;br /&gt;
  password   include      system-auth&lt;br /&gt;
  &lt;br /&gt;
  session    include      system-auth&lt;br /&gt;
&lt;br /&gt;
Simply replace the first &amp;quot;system-auth&amp;quot; with bioapi and you can also get rid of KDE desktop lock with a fingerprint. If you do not wish to allow for &amp;quot;password fallback&amp;quot; then remove &lt;br /&gt;
&lt;br /&gt;
 auth       sufficient   pam_unix.so likeauth nullok&lt;br /&gt;
&lt;br /&gt;
from {{path|/etc/pam.d/bioapi}}.&lt;br /&gt;
&lt;br /&gt;
{{WARN|If su/sudo expects to receive the root password (SuSE 10), you need to have fingerprint settings for root (that is, copy in a root.bir as well as a your-username.bir).  Otherwise, they get a segmentation fault.  Which is a little unfortunate, given that you need to su or sudo to change your settings... }}&lt;br /&gt;
{{WARN|Not only SuSE 10 requires root.bir to be available for su to work. Just make sure you have root.bir when su is not working with your fingerprint reader but other applications are...}}&lt;br /&gt;
Note that sshd may pick up the fingerprint settings from {{path|/etc/pam.d/common-auth}}.  I didn't want that, so I removed the &amp;quot;auth include common-auth&amp;quot; line from {{path|/etc/pam.d/sshd}} and replaced it with the lines that were originally in my {{path|/etc/pam.d/common-auth}}.  That way most local services use the fingerprint reader, but sshd does not.&lt;br /&gt;
&lt;br /&gt;
Another way to do this is to create a file ({{path|/etc/pam.d/bioapi|}} for example) which contains the {{cmd|pam_bioapi.so|}} lines, and explicitly {{cmd|@include|}} this '''before''' {{path|/etc/pam.d/common-auth|}} in the files for services which should use the fingerprint reader.  In this case you should leave {{path|/etc/pam.d/common-auth|}} alone.&lt;br /&gt;
&lt;br /&gt;
{{NOTE|This was discovered through trial and success, if it is plain wrong, wikorrect it, please.}}&lt;br /&gt;
&lt;br /&gt;
In {{Fedora}} the original 'session' terms in {{path|/etc/pam.d/system-auth}} need to be kept.&lt;br /&gt;
&lt;br /&gt;
{{HINT|The setup described above will/could affect remote ssh logins to also use biometric logins, which is a bit silly (who wants to remote ssh to the laptop, and then have to walk over to it and swipe your finger)&amp;lt;br /&amp;gt;To avoid that you can copy the default &amp;lt;tt&amp;gt;/etc/pam.d/system-auth&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/etc/pam.d/sshd&amp;lt;/tt&amp;gt; which will allow the sshd service to use the standard authentication procedure.}}&lt;br /&gt;
&lt;br /&gt;
You can do some useful testing with [http://pamtester.sourceforge.net/ {{cmd|pamtester|}}], which calls the pam modules as if it were a program of your choice.  Examples:&lt;br /&gt;
:{{cmdroot|pamtester xdm yourusername authenticate}}&lt;br /&gt;
:{{cmduser|pamtester xscreensaver yourusername authenticate}}&lt;br /&gt;
where {{cmd|yourusername|}} is your username.  Note that {{cmd|pamtester|}} should run as root if and only if the program in question does.&lt;br /&gt;
&lt;br /&gt;
===Application support===&lt;br /&gt;
The implementation of fingerprint scanning support in the relevant applications varies.&lt;br /&gt;
&lt;br /&gt;
Here is the behaviour of the most common ones:&lt;br /&gt;
* In gdm enter your username and there should pop up an (ugly) image to swipe your finger and... magic - you can login without a password.&lt;br /&gt;
* kdm doesn't give any visual indication, other than that the cursor stops blinking. Just swipe your finger and hope it lets you log in.&lt;br /&gt;
* In xdm, enter your username and a blank password, then swipe (there is no popup as well).&lt;br /&gt;
* The KDE screen saver in SUSE 10 requires you to enter an empty password (or select the correct user and then enter an empty password) in order to get the fingerprint prompt.&lt;br /&gt;
* For Fedora users, the redhat-config tools will crash if no root.bir presents. Also, there won't be any visual idication unless X server is properly configured for root to access. Just swipe your finger when the HDD stopped blinking or issue the following command in advance:&lt;br /&gt;
:{{cmduser|xhost +local:}}&lt;br /&gt;
* For RHEL4 users gdm, console (virtual terminal) logins and the xscreensaver all work&lt;br /&gt;
&lt;br /&gt;
===kdm support===&lt;br /&gt;
To add graphical popup to kdm, you need following:&lt;br /&gt;
* Patch for pam_bioapi. This patch adds third parameter to {{path|pam_bioapi.so}} module, which is a name of file with additional environment variables that will be supplied to the UPEK driver.&lt;br /&gt;
:{{cmdroot|wget http://upir.cz/linux/patches/pam_bioapi-0.2.1-alter-environ.patch}}&lt;br /&gt;
:{{cmdroot|patch -p1 &amp;lt; pam_bioapi-0.2.1-alter-environ.patch}}&lt;br /&gt;
* Edit your {{path|Xsetup}} file (on SUSE 10 it's {{path|/etc/X11/xdm/Xsetup}}) and add these lines:&lt;br /&gt;
 echo &amp;quot;XAUTHORITY=$XAUTHORITY&amp;quot; &amp;gt; /var/lib/xdm/kdm_env&lt;br /&gt;
 echo &amp;quot;DISPLAY=$DISPLAY&amp;quot; &amp;gt;&amp;gt; /var/lib/xdm/kdm_env&lt;br /&gt;
* In {{path|/etc/pam.d/xdm}} file, add {{path|/var/lib/xdm/kdm_env}} as a third parameter for {{path|pam_bioapi.so}} module:&lt;br /&gt;
 auth sufficient pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/ /var/lib/xdm/kdm_env&lt;br /&gt;
&lt;br /&gt;
Please note, that this won't work if you have more than one Xserver.&lt;br /&gt;
&lt;br /&gt;
==Make xscreensaver use the scanner==&lt;br /&gt;
If you are using Gentoo, you can get a portage overlay with the necessary patches here: http://www.zzamboni.org/brt/2006/04/25/106/&lt;br /&gt;
*Get the needed xscreensaver sources:&lt;br /&gt;
:{{cmduser|wget http://www.jwz.org/xscreensaver/xscreensaver-4.23.tar.gz}}&lt;br /&gt;
:{{cmduser|tar xzf xscreensaver-4.23.tar.gz}}&lt;br /&gt;
:{{cmduser|cd xscreensaver-4.23}}&lt;br /&gt;
:{{cmduser|wget http://nax.hn.org/pub/bioapi/xscreensaver-4.22_alternativeAuth.diff&amp;lt;br/&amp;gt;This site seems to be down, use this mirror: http://zepan.org/files/xscreensaver-4.22_alternativeAuth.diff&amp;lt;br/&amp;gt;For xscreensaver 5.00, you can get a patch here: http://www.zzamboni.org/brt/files/xscreensaver-5.00-alternativeauth.patch}}&lt;br /&gt;
*After reviewing the patch (it's small and straightforward), do&lt;br /&gt;
:{{cmduser|patch -p1 &amp;lt; xscreensaver-4.22_alternativeAuth.diff}}&amp;lt;br /&amp;gt;The patch prevents xscreensaver from opening an authentification window and dispatches the authentification request to another program, in our case &amp;lt;tt&amp;gt;pam&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;pam_bioapi&amp;lt;/tt&amp;gt;. It should apply with some offset, don't mind that. If it says something about rejected though, then there's a problem.&lt;br /&gt;
*Compile with&lt;br /&gt;
:{{cmduser|./configure --with-pam &amp;amp;&amp;amp; make}}&amp;lt;br /&amp;gt;&lt;br /&gt;
*If you receive an error like &amp;quot;Couldn't find X11 headers/libs&amp;quot; and are running a Debian-like system, try &amp;quot;apt-get install xlibs-dev&amp;quot;&lt;br /&gt;
*If you receive an error like &amp;quot;undefined reference to `XmuPrintDefaultErrorMessage'&amp;quot; then install the libxmu-dev package and run the previous line again and then install as root with&lt;br /&gt;
:{{cmduser|su -c make install}} .&lt;br /&gt;
*Make sure that the newly compiled xscreensaver is used:&lt;br /&gt;
:{{cmduser|which xscreensaver}} should return&lt;br /&gt;
:{{cmdresult|/usr/local/bin/xscreensaver}} .&lt;br /&gt;
*In case it doesn't, try adjusting your PATH.&lt;/div&gt;</summary>
		<author><name>ZZamboni</name></author>
		
	</entry>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=How_to_enable_integrated_fingerprint_reader_with_BioAPI&amp;diff=22911</id>
		<title>How to enable integrated fingerprint reader with BioAPI</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=How_to_enable_integrated_fingerprint_reader_with_BioAPI&amp;diff=22911"/>
		<updated>2006-06-26T12:18:38Z</updated>

		<summary type="html">&lt;p&gt;ZZamboni: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| width=&amp;quot;100%&amp;quot;&lt;br /&gt;
|style=&amp;quot;vertical-align:top;padding-right:20px;width:10px;white-space:nowrap;&amp;quot; | __TOC__&lt;br /&gt;
|style=&amp;quot;vertical-align:top&amp;quot; |&lt;br /&gt;
This page describes the process of getting the [[Integrated Fingerprint Reader|integrated fingerprint reader]] to work under Linux. It is based on experiences in {{Ubuntu}} on a T43. The same works on {{Fedora}} 4 and 5, RHEL4, SuSE 9.3, SuSE 10, and {{Gentoo}}.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Basic installation==&lt;br /&gt;
===Installing the bioapi framework===&lt;br /&gt;
====Automated installation script====&lt;br /&gt;
The [[Script for enabling the fingerprint reader]] automates the installation of most components (bioapi framework, driver, pam_bioapi, pam setup, device permissions, pamtester and enrolling), for some Linux distributions.&lt;br /&gt;
&lt;br /&gt;
====Binary packages====&lt;br /&gt;
&lt;br /&gt;
Note that these packages only take care of this one section. If you can use one, you should do so and then proceed to the section entitled, Installing and Configuring the Driver.&lt;br /&gt;
&lt;br /&gt;
=====Debian=====&lt;br /&gt;
*If you're using {{Debian}} Sid (the unstable branch) you can try the packages from Michael R. Crusoe's site, either [http://www.qrivy.net/~michael/temp/ version 1.2.3] (recommended) or [http://www.qrivy.net/~michael/debs/unstable/ older versions] which might not work with the steps in this howto.&lt;br /&gt;
*This seems to work for {{Ubuntu}} Breezy/Dapper too, so save yourself some trouble and grab it.&lt;br /&gt;
=====Gentoo=====&lt;br /&gt;
You can either grab the [http://www.qrivy.net/~michael/blua/bioapi/bioapi-1.2.2.ebuild.tar.bz2 ebuild], or use the source-install procedure below.&lt;br /&gt;
&lt;br /&gt;
Also see [http://toe.ch/~tsa/ibm-fingerprint/ http://toe.ch/~tsa/ibm-fingerprint/] for alternative documentation on installing on Gentoo including ebuilds for all the packages used.&lt;br /&gt;
=====Fedora Core=====&lt;br /&gt;
RPM packages for Fedora Core and installation instructions are available [[Installing Fedora Core 5 on a ThinkPad X41 Tablet#Fingerprint_Reader|here]]&lt;br /&gt;
&lt;br /&gt;
====Installing from source====&lt;br /&gt;
*Get the bioapi source:&lt;br /&gt;
:{{cmduser|wget http://www.qrivy.net/~michael/blua/bioapi/bioapi-latest.tar.bz2}}&lt;br /&gt;
*I could not compile bioapi with the graphical Qt tools. To do it manually, do the following:&lt;br /&gt;
:{{cmduser|tar xjf bioapi-latest.tar.bz2}}&lt;br /&gt;
:{{cmduser|cd bioapi-1.2.2}}&lt;br /&gt;
:{{cmduser|1=./configure --with-Qt-dir=no}}&lt;br /&gt;
:{{cmduser|make}}&lt;br /&gt;
:and then as root&lt;br /&gt;
:{{cmdroot|make install}}&lt;br /&gt;
:If make install fails, be sure you're root and then:&lt;br /&gt;
:{{cmdroot|1=export LD_LIBRARY_PATH=/usr/local/lib}}&lt;br /&gt;
:{{cmdroot|make install}}&lt;br /&gt;
:and if you want to compile pam_bioapi for auth later&lt;br /&gt;
:{{cmdroot|cp include/bioapi_util.h include/installdefs.h imports/cdsa/v2_0/inc/cssmtype.h /usr/include}}&lt;br /&gt;
:Be aware that checkinstall will not work!&lt;br /&gt;
:(I got through configure with Qt, but got a cryptic build error.  It all worked fine with Qt disabled as above)&lt;br /&gt;
:buzz: This is due to a wrong qt include path, set it manually in configure and everything should work.&lt;br /&gt;
*Bioapi (at least version 1.2.2) doesn't compile with GCC4. You need to patch it:&lt;br /&gt;
*This is neccessary to compile on SUSE 10.1 which it using gcc version 4.1.0.&lt;br /&gt;
:{{cmduser|wget http://upir.cz/linux/patches/bioapi-1.2.2-gcc4.patch}}&lt;br /&gt;
:{{cmduser|patch -p1 &amp;lt; bioapi-1.2.2-gcc4.patch}}&lt;br /&gt;
*Patch for gcc 4.1 is available here - http://cvs.pld-linux.org/cgi-bin/cvsweb/SOURCES/bioapi-c++.patch&lt;br /&gt;
* By default, bioapi will install numerous files in {{path|/usr/local/&amp;lt;nowiki&amp;gt;{&amp;lt;/nowiki&amp;gt;bin,lib,include&amp;lt;nowiki&amp;gt;}&amp;lt;/nowiki&amp;gt;}}, including files with &amp;quot;self-explanatory&amp;quot; names such as {{path|/usr/local/bin/Sample}}. To prevent this pollution:&lt;br /&gt;
:Create a dedicated directory, for example {{path|/opt/bioapi}} .&lt;br /&gt;
:Append &amp;lt;tt&amp;gt;--prefix=/opt/bioapi&amp;lt;/tt&amp;gt; to the above &amp;lt;tt&amp;gt;./configure&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
:Append {{path|/opt/bioapi/bin}} to &amp;lt;tt&amp;gt;$PATH&amp;lt;/tt&amp;gt; and {{path|/opt/bioapi/lib}} to &amp;lt;tt&amp;gt;$LD_LIBRARY_PATH&amp;lt;/tt&amp;gt;.&lt;br /&gt;
:When installing the driver (below), tell it the new install path: {{cmdroot|sh install.sh /opt/bioapi/lib}}&lt;br /&gt;
&lt;br /&gt;
====Adjusting ldconfigs library search path====&lt;br /&gt;
At least on {{Fedora}} or {{Aurox}} 11, you may need to add {{path|/usr/local/lib}} to the library path so that the libraries referenced from &amp;lt;tt&amp;gt;pam_bioapi.so&amp;lt;/tt&amp;gt; get picked up properly. The usual way to do this is adding it to the ldconfig configuration:&lt;br /&gt;
:{{cmdroot|echo '/usr/local/lib' &amp;gt; /etc/ld.so.conf.d/bioapi.conf}}&lt;br /&gt;
:{{cmdroot|ldconfig}}&lt;br /&gt;
Alternatively you can add it to the LD_LIBRARY variable.&lt;br /&gt;
&lt;br /&gt;
If you see bioapi libs in the output of &lt;br /&gt;
:{{cmdroot|ldconfig -p | grep bioapi}}&lt;br /&gt;
then it should work.&lt;br /&gt;
&lt;br /&gt;
===Installing and configuring the driver===&lt;br /&gt;
====Installing the driver====&lt;br /&gt;
*Download {{path|TFMESS_BSP_LIN_1.0.zip}} from the [http://www.upek.com/support/dl_linux_bsp.asp UPEK support site] and unzip it into a seperate folder, as it will not create one.&lt;br /&gt;
*Change to that folder and do as root:&lt;br /&gt;
:{{cmdroot|sh install.sh}}&lt;br /&gt;
:If you're running Gentoo, use&lt;br /&gt;
:{{cmdroot|sh install.sh /usr/lib}}&lt;br /&gt;
:If that fails, it may be that make install failed up above -- try setting LD_LIBRARY_PATH, do the make install again, and come back here and try this again.  You also need {{cmd|mod_install|}} from bioapi in your PATH.&lt;br /&gt;
:May there still occures and error, which means mod_install: command not found.&lt;br /&gt;
:Then login as root - not su!&lt;br /&gt;
:Do this:&lt;br /&gt;
:{{cmdroot|sh install.sh}}&lt;br /&gt;
:again. It should work. SU to root does not work since then the /usr/local/bin directory is not used per default.&lt;br /&gt;
&lt;br /&gt;
====Configuring permissions for non-root use====&lt;br /&gt;
If you want to use PAM-aware applications like xscreensaver that are NOT running with root permissions (as opposed to login, gdm or other authentication mechanisms), you may need to do all or at least some of the things in this section.  More details on what is necessary on which distributions would be greately appreciated.&lt;br /&gt;
*Create two groups, one for access to BioAPI files and the other for access to the usb files.  (This is done for full generality; i.e., you may have other USB devices which you want accessable to other users, without exposing your BioAPI configuration to them).  Add your normal user (the one you wish to use PAM-aware applications with) to both of these groups.&lt;br /&gt;
On {{Debian}} this is done with&lt;br /&gt;
:{{cmdroot|addgroup --system bioapi}}&lt;br /&gt;
:{{cmdroot|addgroup --system usbfs}}&lt;br /&gt;
:{{cmdroot|adduser yournormaluser bioapi}}&lt;br /&gt;
:{{cmdroot|adduser yournormaluser usbfs}}&lt;br /&gt;
On {{SUSE}} this is done with&lt;br /&gt;
:{{cmdroot|groupadd --system bioapi}}&lt;br /&gt;
:{{cmdroot|groupadd --system usbfs}}&lt;br /&gt;
:{{cmdroot|groupmod -A yournormaluser bioapi}}&lt;br /&gt;
:{{cmdroot|groupmod -A yournormaluser usbfs}}&lt;br /&gt;
On {{Mandriva}} this is done with&lt;br /&gt;
:{{cmdroot|groupadd -r bioapi}}&lt;br /&gt;
:{{cmdroot|groupadd -r usbfs}}&lt;br /&gt;
:{{cmdroot|usermod -G bioapi,usbfs yournormaluser}}&lt;br /&gt;
&lt;br /&gt;
:(where {{cmd|yournormaluser|}} is your normal user name).  You will need to log out and log back in for this to take effect.&lt;br /&gt;
*Set permissions on the BioAPI config/registry directory:&lt;br /&gt;
:{{cmdroot|chown -R root:bioapi /usr/local/var/bioapi/}}&lt;br /&gt;
:{{cmdroot|chmod -R 770 /usr/local/var/bioapi/}}&lt;br /&gt;
:(change this path if you used an alternate BioAPI install directory above)&lt;br /&gt;
*Set permissions on the files in {{path|/proc/bus/usb}}:&lt;br /&gt;
:{{cmdroot|chown -R root:usbfs /proc/bus/usb}}&lt;br /&gt;
:{{cmdroot|chmod -R g+X /proc/bus/usb}}&lt;br /&gt;
:{{cmdroot|chown root:usbfs /proc/bus/usb/`lsusb &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; sed -ne &amp;quot;/0483:2016/s/Bus\ \(.*\)\ Device\ \(.*\):\ .*/\1\/\2/p&amp;quot;`}}&lt;br /&gt;
:{{cmdroot|chmod 660 /proc/bus/usb/`lsusb &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; sed -ne &amp;quot;/0483:2016/s/Bus\ \(.*\)\ Device\ \(.*\):\ .*/\1\/\2/p&amp;quot;`}}&lt;br /&gt;
:You may need to replace {{cmd|lsusb|}} with its full path, which is something like {{cmd|/sbin/lsusb|}} or {{cmd|/usr/bin/lsusb|}} depending on your distro.  It might be necessary to put these lines into a script which is run at startup and resume from suspend/hibernate.&lt;br /&gt;
*As an alternative to the {{cmd|chown|}}/{{cmd|chmod|}} commands above, you can set mount options for usbfs with a line in {{path|/etc/fstab|}}; an example would be&lt;br /&gt;
 none /proc/bus/usb usbfs defaults,devgid=108,devmode=0660,busgid=108,busmode=0770,listgid=108,listmode=0660 0 0&lt;br /&gt;
:where 108 is replaced with the numerical group ID of the usbfs group (you can determine this with something like {{cmd|cat /etc/group &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; grep usbfs &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; cut -d':' -f 3|}}).  Make sure you only have one {{path|/proc/bus/usb}} entry in {{path|/etc/fstab}}.  See the {{cmd|mount(8)|}} manpage for more information on these options.  This is &amp;quot;cleaner&amp;quot; but seems to have a few weird issues -- see the talk page for details.&lt;br /&gt;
*You may also have files in {{path|/dev/bus/usb}}, which the driver will try before {{path|/proc/bus/usb}}.  If this is another usbfs mount point ({{cmd|mount|}} shows a line containing {{cmdresult|/dev/bus/usb type usbfs}}), then simply follow the above instructions with {{path|/dev/bus/usb}} rather than {{path|/proc/bus/usb}}.  Otherwise, you may be running a new kernel (i.e. 2.6.15) that makes usbfs-like files available through {{path|/dev/bus/usb}}.  On systems running udev these files are dynamically created; you can configure their permissions by editing a udev config file.  On Debian this is done by changing the &amp;lt;tt&amp;gt;usb_device&amp;lt;/tt&amp;gt; line of {{path|/etc/udev/permissions.rules}} to read&lt;br /&gt;
 SUBSYSTEM==&amp;quot;usb_device&amp;quot;, MODE=&amp;quot;0660&amp;quot;, GROUP=&amp;quot;usbfs&amp;quot;&lt;br /&gt;
*For the beta versions only, there is a logfile, which needs to exist with the proper permissions:&lt;br /&gt;
:{{cmdroot|touch /var/log/BSP.log &amp;amp;&amp;amp; chown root:bioapi /var/log/BSP.log &amp;amp;&amp;amp; chmod 660 /var/log/BSP.log}}&lt;br /&gt;
&lt;br /&gt;
====Miscellaneous configuration====&lt;br /&gt;
* To increase the security level (minimize false accept rate), set this in {{path|/etc/tfmessbsp.cfg}}:&lt;br /&gt;
 security-level=&amp;quot;5&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Testing the driver and enrolling a fingerprint===&lt;br /&gt;
To test the driver and generate the file containing your fingerprint information, you need a sample program included with the driver.  The compilation steps below were discovered by trial and error; if they don't work for you, try the binary {{cmd|Sample|}} utility that came with the beta versions of the driver (i.e., {{path|TFMESS_BSP_LIN_1.0beta2.zip}} as mentioned above).&lt;br /&gt;
Go to the folder where you extracted {{path|TFMESS_BSP_LIN_1.0.zip}} and do:&lt;br /&gt;
:{{cmdroot|cd NonGUI_Sample}}&lt;br /&gt;
:Edit {{path|main.c|}} and remove (or comment out) the line&lt;br /&gt;
 #include &amp;quot;port/bioapi_port.h&amp;quot;&lt;br /&gt;
:{{cmdroot|gcc -o Sample main.c -L/usr/local/lib -lbioapi100 -DUNIX -DLITTLE_ENDIAN}}&lt;br /&gt;
:{{cmdroot|./Sample}}&lt;br /&gt;
:Note that Sample may only run as root, unless you've already configured the usbfs file permissions.&lt;br /&gt;
:You can try to &amp;quot;e&amp;quot;nroll (to record a fingerprint for an account) and then &amp;quot;v&amp;quot;erify (to test a fingerprint against the one it expects for an account).&lt;br /&gt;
:You'll save a step later if you use your own login username as the username to enroll here.&lt;br /&gt;
&lt;br /&gt;
==Login via pam_bioapi==&lt;br /&gt;
&lt;br /&gt;
The following explains how to add fingerprint authentiation to programs that use the PAM (Pluggable Authentication Modules) framework, such as  Gnome's GDM and KDE's KDM and screensaver.&lt;br /&gt;
&lt;br /&gt;
===Getting required libs &amp;amp; tools===&lt;br /&gt;
====Installing pam_bioapi====&lt;br /&gt;
*Prerequisites&lt;br /&gt;
:On SuSE 10, I needed to install the pam-devel RPM&lt;br /&gt;
:In general, you will need pam itself (standard for most distros) as well as the pam development files (probably an optional package for your distro).&lt;br /&gt;
*Get and compile the pam_bioapi module.&lt;br /&gt;
:{{cmduser|wget http://www.qrivy.net/~michael/blua/pam_bioapi/pam_bioapi-latest.tar.bz2}}&lt;br /&gt;
:{{cmduser|tar xjf pam_bioapi-latest.tar.bz2}}&lt;br /&gt;
:{{cmduser|cd pam_bioapi-0.2.1}}&lt;br /&gt;
:{{cmduser|wget http://badcode.de/downloads/fingerprint.patch}}&lt;br /&gt;
:{{cmduser|patch -p0 &amp;lt; fingerprint.patch}}&lt;br /&gt;
:If you want to, review the patch. In general you should review all code you download and compile, if possible. The patch comes from [http://linuxbiometrics.com/modules/newbb/viewtopic.php?viewmode=flat&amp;amp;topic_id=80&amp;amp;forum=1 this thread].&lt;br /&gt;
:{{cmduser|./configure &amp;amp;&amp;amp; make}}&lt;br /&gt;
:and as root&lt;br /&gt;
:{{cmdroot| make install}}&lt;br /&gt;
:{{cmdroot| cp /usr/local/lib/security/* /lib/security/}}&lt;br /&gt;
{{NOTE|If you get a 'rpl_malloc' error in /var/log/auth.log when trying to use the fingerprint reader, redo these steps and remove the related term from Makefile after running ./configure. (FC3, Debian etch)}}&lt;br /&gt;
*If you get 'configure: error: cannot find required header: security/_pam_macros.h' and are on a Debian-like system, do &amp;quot;apt-get install libpam0g-dev&amp;quot; and try again. If you are using a Mandriva distribution, do &amp;quot;urpmi libpam0-devel&amp;quot; instead.&lt;br /&gt;
*If you get 'PAM [dlerror: /lib/security/pam_bioapi.so: undefined symbol: BioAPIMemoryFuncs]' error in your syslog, replace 'LIBS = ' line in {{path|libpam_bioapi/makefile}} with the following (of course, replace {{path|/opt/bioapi/}} with the path where you installed bioapi):&lt;br /&gt;
 LIBS = -L/opt/bioapi/lib -lbioapi100 -lbioapi_mds300 -lmds_util&lt;br /&gt;
*Use the sample tool from the fingerprint reader to create {{path|&amp;lt;username&amp;gt;.bir}} (&amp;lt;tt&amp;gt;&amp;lt;username&amp;gt;&amp;lt;/tt&amp;gt; '''must''' be the username you want to login with. gdm will probably break for any login name that has no .bir file).&lt;br /&gt;
*As root do:&lt;br /&gt;
:{{cmdroot|SERIAL&amp;lt;nowiki&amp;gt;=`BioAPITest | sed -ne &amp;quot;/Fingerprint/{n;n;s/^.*: \(.\{9\}\)\(.\{4\}\)\(.\{4\}\)\(.\{4\}\)\(.*\)/\1-\2-\3-\4-\5/gp}&amp;quot;` &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
:{{cmdroot|echo $SERIAL}} should print something like {{cmdresult|&amp;lt;nowiki&amp;gt;{5550454b-2054-464d-2f45-535320425350}&amp;lt;/nowiki&amp;gt;}} now.&lt;br /&gt;
:If it does, do:&lt;br /&gt;
:{{cmdroot|mkdir -p /etc/bioapi/pam/$SERIAL}}&lt;br /&gt;
:{{cmdroot|cp &amp;lt;username&amp;gt;.bir /etc/bioapi/pam/$SERIAL}}&lt;br /&gt;
:If not, you might just try&lt;br /&gt;
:{{cmdroot|SERIAL&amp;lt;nowiki&amp;gt;={5550454b-2054-464d-2f45-535320425350}&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
:as this value is hardcoded into the UPEK docs.&lt;br /&gt;
&lt;br /&gt;
===Configuring pam===&lt;br /&gt;
The following part is distribution specific. On {{Ubuntu}} or {{SUSE}} you can modify {{path|/etc/pam.d/common-auth}} (on {{Gentoo}} and {{Fedora}} it is {{path|/etc/pam.d/system-auth}}) to look like this:&lt;br /&gt;
&lt;br /&gt;
 #&lt;br /&gt;
 # /etc/pam.d/common-auth - authentication settings common to all services&lt;br /&gt;
 #&lt;br /&gt;
 # This file is included from other service-specific PAM config files,&lt;br /&gt;
 # and should contain a list of the authentication modules that define&lt;br /&gt;
 # the central authentication scheme for use on the system&lt;br /&gt;
 # (e.g., /etc/shadow, LDAP, Kerberos, etc.).  The default is to use the&lt;br /&gt;
 # traditional Unix authentication mechanisms.&lt;br /&gt;
 #&lt;br /&gt;
 auth       sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 password   sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 auth       required     pam_unix.so nullok_secure&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
For '''Gentoo'''-Users - this allows you to attempt a password first. If you simply press enter, it then prompts for a fingerprints. Create a file named {{path|/etc/pam.d/bioapi}}. This also means that remote services, such as SSH keep working:&lt;br /&gt;
&lt;br /&gt;
 auth       required     pam_env.so&lt;br /&gt;
 auth       sufficient   pam_unix.so likeauth nullok&lt;br /&gt;
 auth       sufficient   pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/&lt;br /&gt;
 auth       required     pam_deny.so&lt;br /&gt;
 &lt;br /&gt;
 account    required     pam_unix.so&lt;br /&gt;
 &lt;br /&gt;
 session    required     pam_limits.so&lt;br /&gt;
 session    required     pam_unix.so&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Now, simply replace &amp;quot;auth include system-auth&amp;quot; in all services that you wish to use fingerprint for with &amp;quot;auth include bioapi&amp;quot;. For example, {{path|/etc/pam.d/kde}} by default contains&lt;br /&gt;
&lt;br /&gt;
  auth       include      system-auth&lt;br /&gt;
  auth       required     pam_nologin.so&lt;br /&gt;
  &lt;br /&gt;
  account    include      system-auth&lt;br /&gt;
  &lt;br /&gt;
  password   include      system-auth&lt;br /&gt;
  &lt;br /&gt;
  session    include      system-auth&lt;br /&gt;
&lt;br /&gt;
Simply replace the first &amp;quot;system-auth&amp;quot; with bioapi and you can also get rid of KDE desktop lock with a fingerprint. If you do not wish to allow for &amp;quot;password fallback&amp;quot; then remove &lt;br /&gt;
&lt;br /&gt;
 auth       sufficient   pam_unix.so likeauth nullok&lt;br /&gt;
&lt;br /&gt;
from {{path|/etc/pam.d/bioapi}}.&lt;br /&gt;
&lt;br /&gt;
{{WARN|If su/sudo expects to receive the root password (SuSE 10), you need to have fingerprint settings for root (that is, copy in a root.bir as well as a your-username.bir).  Otherwise, they get a segmentation fault.  Which is a little unfortunate, given that you need to su or sudo to change your settings... }}&lt;br /&gt;
{{WARN|Not only SuSE 10 requires root.bir to be available for su to work. Just make sure you have root.bir when su is not working with your fingerprint reader but other applications are...}}&lt;br /&gt;
Note that sshd may pick up the fingerprint settings from {{path|/etc/pam.d/common-auth}}.  I didn't want that, so I removed the &amp;quot;auth include common-auth&amp;quot; line from {{path|/etc/pam.d/sshd}} and replaced it with the lines that were originally in my {{path|/etc/pam.d/common-auth}}.  That way most local services use the fingerprint reader, but sshd does not.&lt;br /&gt;
&lt;br /&gt;
Another way to do this is to create a file ({{path|/etc/pam.d/bioapi|}} for example) which contains the {{cmd|pam_bioapi.so|}} lines, and explicitly {{cmd|@include|}} this '''before''' {{path|/etc/pam.d/common-auth|}} in the files for services which should use the fingerprint reader.  In this case you should leave {{path|/etc/pam.d/common-auth|}} alone.&lt;br /&gt;
&lt;br /&gt;
{{NOTE|This was discovered through trial and success, if it is plain wrong, wikorrect it, please.}}&lt;br /&gt;
&lt;br /&gt;
In {{Fedora}} the original 'session' terms in {{path|/etc/pam.d/system-auth}} need to be kept.&lt;br /&gt;
&lt;br /&gt;
{{HINT|The setup described above will/could affect remote ssh logins to also use biometric logins, which is a bit silly (who wants to remote ssh to the laptop, and then have to walk over to it and swipe your finger)&amp;lt;br /&amp;gt;To avoid that you can copy the default &amp;lt;tt&amp;gt;/etc/pam.d/system-auth&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/etc/pam.d/sshd&amp;lt;/tt&amp;gt; which will allow the sshd service to use the standard authentication procedure.}}&lt;br /&gt;
&lt;br /&gt;
You can do some useful testing with [http://pamtester.sourceforge.net/ {{cmd|pamtester|}}], which calls the pam modules as if it were a program of your choice.  Examples:&lt;br /&gt;
:{{cmdroot|pamtester xdm yourusername authenticate}}&lt;br /&gt;
:{{cmduser|pamtester xscreensaver yourusername authenticate}}&lt;br /&gt;
where {{cmd|yourusername|}} is your username.  Note that {{cmd|pamtester|}} should run as root if and only if the program in question does.&lt;br /&gt;
&lt;br /&gt;
===Application support===&lt;br /&gt;
The implementation of fingerprint scanning support in the relevant applications varies.&lt;br /&gt;
&lt;br /&gt;
Here is the behaviour of the most common ones:&lt;br /&gt;
* In gdm enter your username and there should pop up an (ugly) image to swipe your finger and... magic - you can login without a password.&lt;br /&gt;
* kdm doesn't give any visual indication, other than that the cursor stops blinking. Just swipe your finger and hope it lets you log in.&lt;br /&gt;
* In xdm, enter your username and a blank password, then swipe (there is no popup as well).&lt;br /&gt;
* The KDE screen saver in SUSE 10 requires you to enter an empty password (or select the correct user and then enter an empty password) in order to get the fingerprint prompt.&lt;br /&gt;
* For Fedora users, the redhat-config tools will crash if no root.bir presents. Also, there won't be any visual idication unless X server is properly configured for root to access. Just swipe your finger when the HDD stopped blinking or issue the following command in advance:&lt;br /&gt;
:{{cmduser|xhost +local:}}&lt;br /&gt;
* For RHEL4 users gdm, console (virtual terminal) logins and the xscreensaver all work&lt;br /&gt;
&lt;br /&gt;
===kdm support===&lt;br /&gt;
To add graphical popup to kdm, you need following:&lt;br /&gt;
* Patch for pam_bioapi. This patch adds third parameter to {{path|pam_bioapi.so}} module, which is a name of file with additional environment variables that will be supplied to the UPEK driver.&lt;br /&gt;
:{{cmdroot|wget http://upir.cz/linux/patches/pam_bioapi-0.2.1-alter-environ.patch}}&lt;br /&gt;
:{{cmdroot|patch -p1 &amp;lt; pam_bioapi-0.2.1-alter-environ.patch}}&lt;br /&gt;
* Edit your {{path|Xsetup}} file (on SUSE 10 it's {{path|/etc/X11/xdm/Xsetup}}) and add these lines:&lt;br /&gt;
 echo &amp;quot;XAUTHORITY=$XAUTHORITY&amp;quot; &amp;gt; /var/lib/xdm/kdm_env&lt;br /&gt;
 echo &amp;quot;DISPLAY=$DISPLAY&amp;quot; &amp;gt;&amp;gt; /var/lib/xdm/kdm_env&lt;br /&gt;
* In {{path|/etc/pam.d/xdm}} file, add {{path|/var/lib/xdm/kdm_env}} as a third parameter for {{path|pam_bioapi.so}} module:&lt;br /&gt;
 auth sufficient pam_bioapi.so {5550454b-2054-464d-2f45-535320425350} /etc/bioapi/pam/ /var/lib/xdm/kdm_env&lt;br /&gt;
&lt;br /&gt;
Please note, that this won't work if you have more than one Xserver.&lt;br /&gt;
&lt;br /&gt;
==Make xscreensaver use the scanner==&lt;br /&gt;
*Get the needed xscreensaver sources:&lt;br /&gt;
:{{cmduser|wget http://www.jwz.org/xscreensaver/xscreensaver-4.23.tar.gz}}&lt;br /&gt;
:{{cmduser|tar xzf xscreensaver-4.23.tar.gz}}&lt;br /&gt;
:{{cmduser|cd xscreensaver-4.23}}&lt;br /&gt;
:{{cmduser|wget http://nax.hn.org/pub/bioapi/xscreensaver-4.22_alternativeAuth.diff&amp;lt;br/&amp;gt;This site seems to be down, use this mirror: http://zepan.org/files/xscreensaver-4.22_alternativeAuth.diff&amp;lt;br/&amp;gt;For xscreensaver 5.00, you can get a patch here: http://www.zzamboni.org/brt/files/xscreensaver-5.00-alternativeauth.patch}}&lt;br /&gt;
*After reviewing the patch (it's small and straightforward), do&lt;br /&gt;
:{{cmduser|patch -p1 &amp;lt; xscreensaver-4.22_alternativeAuth.diff}}&amp;lt;br /&amp;gt;The patch prevents xscreensaver from opening an authentification window and dispatches the authentification request to another program, in our case &amp;lt;tt&amp;gt;pam&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;pam_bioapi&amp;lt;/tt&amp;gt;. It should apply with some offset, don't mind that. If it says something about rejected though, then there's a problem.&lt;br /&gt;
*Compile with&lt;br /&gt;
:{{cmduser|./configure --with-pam &amp;amp;&amp;amp; make}}&amp;lt;br /&amp;gt;&lt;br /&gt;
*If you receive an error like &amp;quot;Couldn't find X11 headers/libs&amp;quot; and are running a Debian-like system, try &amp;quot;apt-get install xlibs-dev&amp;quot;&lt;br /&gt;
*If you receive an error like &amp;quot;undefined reference to `XmuPrintDefaultErrorMessage'&amp;quot; then install the libxmu-dev package and run the previous line again and then install as root with&lt;br /&gt;
:{{cmduser|su -c make install}} .&lt;br /&gt;
*Make sure that the newly compiled xscreensaver is used:&lt;br /&gt;
:{{cmduser|which xscreensaver}} should return&lt;br /&gt;
:{{cmdresult|/usr/local/bin/xscreensaver}} .&lt;br /&gt;
*In case it doesn't, try adjusting your PATH.&lt;/div&gt;</summary>
		<author><name>ZZamboni</name></author>
		
	</entry>
</feed>