iRacing now has official Mac and Linux clients. Please use those.
Introduction and basics
iRacing.com is an auto racing simulation video game with a strong online community. The game is unique in that it tries to simulate real-world racing, including leagues, licenses, and safety ratings. It’s an impressive piece of software and community building, and a great opportunity to both have fun and practice real-world racing.
The trouble? It’s Windows-only. That leaves out us Linux users.
The solution? The Wine Windows compatibility layer. Wine is a reimplementation of the Windows operating system on top of the Unix operating system. Wine is built to run Windows programs on Linux and other Unixes, and it runs the iRacing client very well.
Here’s how iRacing works and how Wine fits in.
iRacing installs a system service called iRacingService.exe. This is launched when Windows starts. iRacingService.exe is actually a small HTTP server running on port 32034 and the iRacing website communicates with the HTTP server through AJAX. The iRacing website gets version data and the like from the service, and sends commands to the service to launch the simulation, or download and install updates, and so on.
Wine supports almost everything the iRacing service and client need right out of the box. iRacing uses some relatively obscure Windows APIs (largely the Windows Terminal Services APIs) to determine user account information. These aren’t well supported in Wine, as most applications don’t depend heavily on them. We will have to patch Wine to support these APIs before we can run iRacing. This is the only modification required to run iRacing, although further modifications can improve the experience.
The following steps require some knowledge of how Unix works and the Linux command line. You can probably cobble together a working system even if you have no idea what you’re doing, but you would be well served to learn about Unix/Linux so that you actually understand what you are doing. The Internet is a vast and great resource.
Before you build Wine, you will need to patch the source code to support these APIs. First, get the latest Wine source from Wine’s Git repository. Then, download the patch and apply it to Wine’s source tree. The patch was created against version 1.5.26 of Wine, but will probably apply to many later versions as well.
~$ wget http://smokingonabike.com/iracing/iracing_patch_1.5.26.patch ~$ cd wine-git wine-git$ git apply ~/iracing_patch_1.5.26.patch
If you’re git-savvy, go ahead and make that a commit so you can rebase on future Wine releases. Next, build and install Wine. I will not go into detail about how to build Wine. There are plenty of guides on the Internet about how to compile and install Wine. It’s not hard. It’s your choice where to install Wine, or you can even just run it straight out of the build tree.
I suggest using a special Wine prefix specifically for iRacing. A Wine prefix is like a self-contained Windows filesystem. Installing iRacing into its own prefix will prevent conflicts with other Windows programs that you might want to install with Wine in the future. To specify a Wine prefix, use the environment variable WINEPREFIX.
wine-git$ export WINEPREFIX=$HOME/iracing
Remember that exported environment variables only apply to the session in which they were exported. Next, run the iRacingInstaller program. This will eventually launch a DirectX SDK installer, which you should also install.
As I said earlier, iRacing runs as a Windows service. Windows services are automatically started on operating system boot, or in this case, when Wine is started. So you don’t actually need to run the iRacingService program. In fact, it will fail if you do, as it has already been started as a service. Instead, just run the `winecfg’ program and let that sit while the service runs in the background. This is sufficient to run the iRacing browser client and run the simulation.
Before we do a live test of the software with the iRacing browser client, let’s give it a quick test. Make sure the iRacingService program is running in the background (see the previous paragraph). Open a terminal and try to connect to the HTTP server:
Now that iRacing is installed and running, load up the iRacing member site and see if it works. I was able to get it to work in both Firefox 15 and Chrome 23. You should see a widget on the right side of the site saying something like, “Your software needs an update.” If you instead see a warning about the software not being running or installed, then something has gone wrong. Check your Internet browser plugins (NoScript’s ABE blocks localhost requests). Maybe dig into wireshark logs. Good luck!
Important: While you are testing your setup, you will probably be stopping and starting the iRacing service repeatedly. Unix network sockets have a timeout value which can cause new network connections to fail if too short a time has passed since that connection was closed. This will cause the browser client to fail to connect to your service, even though nothing is actually wrong. You can diagnose this problem by running winecfg with the environment variable WINEDEBUG set to “warn+winsock” and looking for the message “address already in use.” The fix is to simply wait a few minutes after exiting the Wine session before starting the service again.
Go ahead and install the updates through the browser client. You should see a simple dialog window pop up with download and installation progress bars. If you’ve reached this point, you are good to go! Keep reading if you want some tips for improving your experience.
Configuring Wine and iRacing
One handy tip is to use a virtual desktop. This is a fake desktop environment created by Wine inside of which all of your Windows programs will be displayed. This gives you more control over how iRacing is displayed, and tends to play nicer with multiple monitors. You can set the virtual desktop settings inside of the winecfg program. My personal configuration is set up so the Wine desktop size matches one of my monitors’ sizes. This appears to be fullscreen, even though it actually isn’t, which allows me to continue using my other monitor without issue. You may need to also tweak iRacing’s resolution to match that of your virtual desktop.
By the way, the iRacing community suggests targeting 80 FPS in your simulation.
I don’t have a racing wheel, and I race with an old XBox Controller S converted to USB. Really, any joystick or wheel supported by Linux should interface correctly with the game through Wine. I had to set a deadzone on the joystick input so it wouldn’t steer the car simply by my tilting the gamepad. To do this, launch regedit and create a new registry key:
The units are in hundredths of a percent, so the example is a 30% deadzone. Just keep tweaking the number until it feels right.
Do you have a racing wheel or pedals?
I’d love to hear about it! What manufacturer and model(s) do you have? Did you have any difficulty setting it up? Does force feedback work? Leave a comment below!
Thanks for the great tutorial, this helped me out big time 🙂
Worked perfectly. Thanks
One word of advice: If you use Ubuntu use this http://wiki.winehq.org/Ubuntu to install Wine from source. If you try from scratch you” end up in dependency hell…
I get an error when trying to patch Wine. I suspect that the patch no longer “fits” the wine build. If you could find time to update the patch it would be GREATLY appreciated!
Just a note, if you want another way to run iRacing on Linux, you can install it in a VMware Workstation virtual machine, but it seems that you are limited to 60 fps, and there is a performance overhead.
I got this error trying to patch:
patching file dlls/advapi32/security.c
Hunk #1 succeeded at 2451 (offset 79 lines).
patching file dlls/userenv/Makefile.in
patching file dlls/userenv/userenv_main.c
patching file dlls/wtsapi32/Makefile.in
patching file dlls/wtsapi32/wtsapi32.c
Hunk #1 succeeded at 217 (offset -4 lines).
Hunk #2 FAILED at 245.
Hunk #3 succeeded at 232 (offset -21 lines).
1 out of 3 hunks FAILED — saving rejects to file dlls/wtsapi32/wtsapi32.c.rej
Yep, you’re right. I updated the patch itself, and also changed the instructions to use git-apply which should be more robust for the future. Thanks for the notice!
I keep getting this error, in the browser, when trying to launch a game:
The following error occured while trying to join the session:
Failed WTSQueryUserToken 
Has anyone seen this or knows what to do. I get this both with the standard wine, PlayonLinux, and the patched wine.
Hmm, are you sure you’re using the patched Wine? That’s exactly the error that the patch should fix. Try to make sure you’re using the version of Wine that you built with the patch, not one that was installed by your package manager.
Have you found how to fix this????
Im having the same problem…
Finally I have something working.
Tip: If you are using 64 bit Ubuntu and trying to compile wine from git source.
Check Section: 32-bit Builds on AMD64a
You need to install: g++-multilib package
sudo aptitude install g++-multilib
If you are using Ubuntu 64bit, you have to use this guide: http://wiki.winehq.org/WineOn64bit
The section you are looking fore is: “chroot Method”
Forget everything else!
My Wheel is also working.
You need to calibrate it with jscal: “sudo jscal /dev/input/js0 -c”
I use a Logitech Momo Racing Force Feedback Wheel, and it works great with Force and everything.
compiled & installed, HTTP web interface is reachable works, but when the site call /start_downloads, the service returns a 500, internal server error 😮 😮 (wireshark)
is there a log in the service/wineserver?
Does anyone else have freezes when playing in Wine?
It does not happen to me when running under VMware Workstation.
The sound, and graphics locks up for 6-10 seconds, and then it continues. Very hard to win races when that happens.
I happens in 1/3 races.
Hi, i got my service up and downloading. But the problem is that i can’t see te download bars. And i dont know is it installing or not, website says that the download is completed. i’ve waited ~15-20 minutes after all download were completed.
Haven any one encountered similiar.
founded i had to “start” manually the iRacingUpdater. Now i can see what is happening
Does anyone been able to play with old gameport devices ? i have a MS sidewinder wheel with gameport connector. The game doesent recognize the device and doesent calibrate it.
When i try it on LFS there it works great.
My FFB is working. Logitech G27 racing wheel, Ubuntu Quantal.
But I have problem like Mnemonic posted: graphics locks up for ~10 seconds, but sound works nice.
Sorry my English not very well.