Gentoo Wiki


The X-Fi series of sound cards from Creative Labs is one of the best consumer oriented pieces of audio hardware today. It features:

Unfortunately, for years after the Windows release of the card, there existed no Linux driver. Creative has released two drivers now, 1.14, and latest, 1.18. Both have significant reliability problems and do not even compile on most systems.

This HOWTO will demonstrate how to use the 1.18 driver on Gentoo with ALSA built into the kernel. It is a complete and very BAD hack. I will repeat this: THIS IS A COMPLETE HACK!

Warning: You will most likely screw up some part of your system using these drivers and configuring them the way this guide suggests. The drivers are still unstable, there have been reports of crashing X, ALSA, and locking up the whole computer. Using these drivers is like waving a red flag at a bull.....


Non-Working Features

The following features do not work at all:

24 Bit Crystalizer
X-RAM (Platinum Models)



First of all, download the driver tarball.

or manually enter the command:


Modifying and Patching

The following listed errors show up in /var/log/creative-installer.log when the installer fails with a Make error 2.

Decompress the internal bz2 file:

tar xvjf XFiDrv_Linux_US-1.18.tar.bz2


Modify the LinuxSys driver file (drivers/src/ossrv/LinuxSys.c).

Remove the following line (~line 1581):


Modify and Add the following lines from Vasko (~line 1558):

sysGetFileSize(CTVOID *This, CTDWORD *pdwSize, CTHANDLE hFile)
    stFileHdl *pFileHdl = (stFileHdl *) hFile


sysGetFileSize(CTVOID *This, CTDWORD *pdwSize, CTHANDLE hFile)
    stFileHdl *pFileHdl = (stFileHdl *) hFile; // Comments By Vasko
	printk(KERN_WARNING "sysGetFileSize: no file handle\n");
	printk(KERN_WARNING "sysGetFileSize: no pointer to return value (pdwSize)\n");

Replace SA_SHIRQ with IRQF_SHARED (~line 648):

if (request_irq(phInterrupt->uIRQ, interrupt_callback, SA_SHIRQ, "x-fi", phInterrupt)) {


if (request_irq(phInterrupt->uIRQ, interrupt_callback, IRQF_SHARED, "x-fi", phInterrupt)) {

Add two include files (~line 33 and 37 respectively):

#include <linux/fs.h> //Included From Vasko
#include <asm-generic/fcntl.h> // otherwise, some MACROS are undefined


The drivers/ctsound init script loads all the necessary modules into the kernel and alerts ALSA as to the card's presence. The modules, however, are called in wrong order. In the original version it looks like this:

drivers="ctossrv ctsfman emupia ct20xut ctexfifx cthwiut haxfi ctalsa"

It must be:

drivers="ctossrv emupia ctsfman haxfi ctalsa ct20xut ctexfifx cthwiut"
Baselayout 2 and OpenRC Users

An alternate ctsound file must be used. Download and unpack it. Then, replace drivers/ctsound with this file.


Thanks to the_root on the Gentoo Forums!

Kernel Source

If you choose to compile without Creative's ./installer you can skip this step.


make -C /lib/modules/2.6.24-16-generic/build SUBDIRS=/tmp/xfisrc/src/ossrv modules
make[3]: Entering directory `/usr/src/linux-headers-2.6.24-16-generic' scripts/ *** CFLAGS was changed in "/tmp/xfisrc/src/ossrv/Makefile". Fix it to use EXTRA_CFLAGS.  Stop.
make[3]: *** [_module_/tmp/xfisrc/src/ossrv] Error 2
make[3]: Leaving directory `/usr/src/linux-headers-2.6.24-16-generic'
make[2]: *** [module] Error 2
make[2]: Leaving directory `/opt/Creative/XFiDrv_Linux_US-1.18/drivers/src/ossrv'
make[1]: *** [ctossrv] Error 2
make[1]: Leaving directory `/opt/Creative/XFiDrv_Linux_US-1.18/drivers'

Extremely hack fix: Edit


around line 46 and comment out the following lines:

       #ifneq ("$(save-cflags)","$(CFLAGS)")
               #$(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS)

I'm assuming that you'll want to either unfix this or re-emerge gentoo-sources before you recompile your kernel again.

Kernel 2.6.25-r5

Please format this article according to the guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article

Verify that the following kernel options are set:

Kernel hacking -> Enable unused/obsolete exported symbols[*]
General setup -> Choose SLAB allocator (SLAB)

Verify that the entire ALSA sound system is build as modules

Device Drivers -> Sound -> Sound card support -> ALSA [M]

Download this modified driver from here


Without Creative's ./installer

Remove all previous installation attempts by deleting:

rm /etc/init.d/ctsound && rm -R /etc/creative && rm -R /lib/modules/`uname -r`/kernel/drivers/ssound/

Reboot the machine or clear your environment with


Unpack the installation archive, "cd" to drivers directory, then execute the following:

./configure && make clean && make KBUILD_NOPEDANTIC=1 && make install


After ctsound has been added to /etc/init.d/ctsound, it must be modified. Replace the entire contents of /etc/init.d/ctsound with the following:

# ctsound:	This shell script takes care of starting and stopping 
#		the Creative X-Fi soundcard driver.
# Author:	Vasil Tsintsev
# Date:		Apr 30 2008
depend() {
        need localmount modules
	before alsasound
        after bootmisc modules isapnp coldplug hotplug ctsound

is_mods_installed() {
	local KV=$(uname -r)
	local MODPATH=/lib/modules/${KV}/kernel/drivers/ssound
        if [ ! -d "${MODPATH}" ]; then
                eerror "${MODPATH} does not exist. Please reinstall."
                return 1

start() {
	is_mods_installed || return 1

	local DRIVERS="ctossrv emupia ctsfman haxfi ctalsa ct20xut ctexfifx cthwiut"
	ebegin "Loading X-Fi drivers "
	local LOADED_MODULES="$(lsmod | sed -n -e 's/^\(snd[^ ]*\) .*/\1/p')"
        local MODULE
        for MODULE in ${LOADED_MODULES} ; do
            rmmod "${MODULE}"
        rmmod soundcore 2>/dev/null
        rmmod gameport 2>/dev/null

	if [ ! -c "/dev/emupia" ]; then
                mknod /dev/emupia c 14 11;
                chmod 666 /dev/emupia;
        if [ ! -c "/dev/x-fi" ]; then
                mknod /dev/x-fi c 14 15;
                chmod 666 /dev/x-fi;

        for MOD in ${DRIVERS}; do
                modprobe ${MOD}

	modprobe snd_usb_audio
       modprobe snd-seq

	eend 0

        if [ -f /etc/creative/creative.state ]; then
                ebegin "Restore Drv Default Mix Val"
                sleep 10
                alsactl -F -f /etc/creative/creative.state restore > /dev/null 2>&1 || :
                rm -f /etc/creative/creative.state
                eend 0
                ebegin "Alsa control restore"
                alsactl restore >/dev/null 2>&1 || :
                eend 0

stop() {
	ebegin "Unloading X-Fi drivers"

	local RMDRIVERS="ctalsa haxfi cthwiut ctexfifx ct20xut emupia ctsfman ctossrv"
	/usr/sbin/alsactl store >/dev/null 2>&1 || :
	for MOD in ${RMDRIVERS}; do
		rmmod ${MOD}
	eend 0

restart() {
        ebegin "Reloading X-Fi drivers"

	sleep 5
        eend 0

With Creative's ./installer

Simply run:


Be sure the "drivers" directory is repacked. This script automatically unpacks it.


Unless you're willing to do a multi-card ALSA configuration, do the following:

rc-update add ctsound default (does not work on OpenRC, see seperate section)

Reboot, disable your onboard sound you've been using until now :)

The next time Linux loads up, ALSA will start with errors because it's trying to load modules for your now disabled on-board sound.

In the event ctsound didn't load itself:

/etc/init.d/ctsound start

And enjoy!


The default /etc/init.d/ctsound script should rebuild all required modules from the modified source code stored in /opt/Creative/XFiDrv_Linux_US-1.18/ by itself when it finds that the modules don't exist in the running kernel's build. In the event that this fails, or the system is running Baselayout-2/OpenRC, cd to /opt/Creative/XFiDrv_Linux_US-1.18/drivers and follow directions for installing without Creative's ./installer.

Compatible X-Fi Models (add yours)

Troubleshooting and Known Problems

Kernel Oops with Reiser FS

If you are using reiserfs you can expect kernel opps, it can be fixed, just open:

/usr/src/linux/fs/reiserfs/file.c , go to "const struct file_operations reiserfs_file_operations = {"

and add this line:

.llseek = generic_file_llseek,

it should look like this:

const struct file_operations reiserfs_file_operations = {
.llseek = generic_file_llseek,
.read = do_sync_read,

Source: Gentoo forums

Ctsound script kills other sound cards

Comment out the following lines in /etc/init.d/ctsound:

#local LOADED_MODULES="$(lsmod | sed -n -e 's/^\(snd[^ ]*\) .*/\1/p')"
#local MODULE
#    rmmod "${MODULE}"
#rmmod soundcore 2>/dev/null
#rmmod gameport 2>/dev/null


Wine will not see the X-Fi as the default sound card unless it is the only one on the system. If more than one sound card is installed, Wine will need to be configured manually for ALSA card recognition. See this post for more information.


Open sound system drivers support some X-Fi models (1102:0005 or 1102:0009 pci id), but the support is limited (only stereo/96000 playback, recording may or may not work). On the other hand, these drivers typically don't present the risk of locking up the computer.

External links

Retrieved from ""

Last modified: Fri, 29 Aug 2008 04:42:00 +0000 Hits: 8,282