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:
~$ telnet -4 localhost 32034
Connected to localhost.
Escape character is '^]'.
GET /get_versions2 http/1.1
http/1.1 200 OK
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!