Sid Meier's Civilization V

Sid Meier's Civilization V

View Stats:
jqpdev Feb 22, 2018 @ 6:19pm
New patch needed to fix segfaults in Civ 5 Linux client for CPUs with more than 8 logical cores
Hello all,

Aspyr needs to release a patch to the Civ 5 Linux client. The game client encounters segfaults when run on CPUs with greater than 8 logical cores such as the Ryzen 7 which has 8 cores / 16 threads. The game and the OS sees 16 CPUs. The segfaults affect Ubuntu and non-Ubuntu users (I'm on Manjaro Linux v17.1.5). I didn't determine this on my own. Other Linux users in the Steam community discovered this:
https://steamcommunity.com/app/8930/discussions/1/38596747621681086/

CPUs affected:
- Ryzen 5 1600/1600 Pro/1600X
- Ryzen 7 (all)
- Ryzen Threadripper (all)
- Intel core i7-8700/8700K (Coffee Lake)

Some Ryzen APUs (CPUs with on-chip graphics) will be affected as well.

For now we have a temporary workaround. From the thread linked above, in post#16, "eternalnoobage" came up with a command string to limit the number of CPUs the Linux client runs on:
taskset -c 1-8 steam steam://rungameid/8930

However, since the taskset command references CPUs starting at zero the command string should be altered to limit the game to CPUs 0-7.
taskset -c 0-7 steam steam://rungameid/8930

To check for segfaults, one needs only to open a terminal and run "dmesg", and examine the output. The grep command can be used to filter the output. The segfault entries will look like the following:
[] Civ5XP[1667]: segfault at 14 ip 000000000885bd5f sp 000000007f5e50c0 error 4 in Civ5XP[8048000+22a7000]

Since Aspyr handled the Linux and Mac ports of the game, it is possible that the Mac client may have trouble if run on CPUs with greater than 8 logical cores. I don't have a means of testing this since I don't have a Mac and I don't run a Hackintosh setup. The Civ 5 Windows client is unaffected by this bug. I had to temporarily install Win 10 to test.

I placed the adjusted command string into the icon on my KDE desktop. I ran a test match in game with all DLCs enabled and all mods disabled. I have all the DLCs and expansions purchased. The match settings were:
- 8 Civs / 16 City States
- Randomly selected Civ
- All A.I. Civs are random
- Random Map
- Standard size
- Chieftain difficulty
- Quick game pace
- Ancient Era start
- All victory types are enabled
- Policy saving, promotion saving, and start bias disabled checked, all other boxes are unchecked

I played for 3+ hours (more than 100 turns) without any errors. I purposefully dragged the game along by not playing with a proper focused strategy. I also took breaks and locked the desktop multiple times.

Anyone running the Civ 6 Linux client, on the above listed CPUs, and encountering random crashes or the game randomly aborting?
< >
Showing 1-15 of 27 comments
jqpdev Feb 23, 2018 @ 12:21pm 
@[ZM]Dr. Dro:
Most consumers and especially the mainstream budget gamers are not going to be purchasing core i7-980X (6/12 cores/threads) CPUs when the MSRP is $999 US (wikipedia) and $1059 US (Intel). To be clear the core i7-980X and the i7-5960X CPUs are Core i7 Extreme branded CPUs. These are high end enthusiast CPUs that are generally out of the price range of most gaming oriented consumers, which would account for low number of users with those CPU types.

As stated in my original post, I installed Win 10 to test on my Ryzen 7 1700X system. There were no errors or crashes in Win 10. The difference is Aspyr is the company that is responsible for the code base on Linux. They handled the porting effort, where as the Windows version of the game was handled by 2k Games/Firaxis. We don't have feature parity between the Windows and Linux versions of the game so it is quite possible that there is something amiss with the Linux code base. If you want to see a difference in feature parity load the game on Windows and examine the options in Video Settings and then do the same on Linux.

Even if there is a issue between kernel versions, Aspyr is resistant to investigating the issue unless one is running the game on Steam OS or Ubuntu 16.04. Trying to lock users to a very specific release of Ubuntu is bound to create contention and give the impression that they will use any excuse to not provide support. I mean it would be beyond crazy to have a situation where I could play 12 different Steam games on my chosen distro of Linux but then I have to keep and maintain an Ubuntu 16.04 installation just to play Civ 5. Worse still is if I need to change to an "unsupported" kernel on Ubuntu for security reasons or compatibility with microcode changes from my CPU manufacturer, I'm likely to run into resistance from Aspyr if bugs/crashes are encountered.

I do not use Ubuntu because:
- Canonical does not respect user privacy (they put spyware in their distro)
- I detest the ugly look of the Unity desktop environment

I do not use Win 10 because:
- Microsoft does not respect user privacy (Win 10 is spyware masquerading as an OS)
- I detest the ugly look of Windows 10

The Windows 10 install that was used for testing only lasted long enough for me to determine if there was any issue on that platform given my hardware. The partition has been wiped and I've already re-installed Manjaro in its place. This is a time consuming effort and I'm not being compensated for my time. I just want to enjoy the game I paid for without jumping through unnecessary hoops.

Also, if the Aspyr guys looked at the thread I linked, in post #18 a user on the same Ryzen platform running Ubuntu 16.04 was having crashes.
Last edited by jqpdev; Feb 23, 2018 @ 12:45pm
jqpdev Feb 23, 2018 @ 2:52pm 
No I haven't tested on Mint. The guy in post #18 of the article I linked says he is on Ryzen 7 with Ubuntu 16.04.

On a side note:
Windows 10's telemetry is only partially configurable unless one is very adept at registry hacks, has an in-depth understanding of undocumented registry entries, or uses 3rd party undocumented apps. The Win 10 UI only allows one to partially opt-out of the data collection and casual use of the various OS features/apps leaks data back to MS and their business partners. Also, let's not forget the keylogging service that is enabled by default. You are welcome to disagree with me, but you have MS to thank for making it very difficult to refute my statements.
jqpdev Feb 23, 2018 @ 5:29pm 
Post a link to the P-shell script.
Damsteri Feb 24, 2018 @ 4:06am 
i7 980X owner here (now retired in behalf of i7 8700K). Windows version of Civ V works perfectly with 6C/12T CPU's and have always been working (but not getting any benefit from extra cores). Almost all of my +7000h is played with a 6C/12T CPU, so Win7/Win10 is definately clear of this problem and it's solely a problem of Aspyr's Mac/Linux port.
Last edited by Damsteri; Feb 24, 2018 @ 4:35am
Damsteri Feb 24, 2018 @ 10:18am 
Actually I did test how multiple cores and hyperthreading affects Civ V's loading times, for both the game itself and for loading a save file. Test can be found here: http://steamcommunity.com/app/8930/discussions/0/458604254428877171/

I didn't test game much on other aspect than loading times. I didn't find a good way to add a table for discussions, so it's text only. Civ V didn't benefit extra cores much and HT actually slows down loading. CPU clock speed was more important than amount of cores.

Test was run on my old i7 980X (used it normally at 4.6GHz on water). It surely was nice CPU, was my main computer's CPU for over 7 years (May 2010 to Oct 2017), se total €/year was not that bad after all.
Last edited by Damsteri; Feb 24, 2018 @ 10:21am
jqpdev Feb 24, 2018 @ 5:13pm 
Any of you guys run the game on Ubuntu or any other distro of Linux?
jqpdev Mar 18, 2018 @ 2:44pm 
The following is from Linux Mint 18.3 64-bit Cinnamon Edition (Ubuntu derivative based on Ubuntu LTS).

Computer Information:
Manufacturer: Unknown
Model: Unknown
Form Factor: Desktop
No Touch Input Detected

Processor Information:
CPU Vendor: AuthenticAMD
CPU Brand: AMD Ryzen 7 1700X Eight-Core Processor
CPU Family: 0x17
CPU Model: 0x1
CPU Stepping: 0x1
CPU Type: 0x0
Speed: 3800 Mhz
16 logical processors
8 physical processors
HyperThreading: Supported
FCMOV: Supported
SSE2: Supported
SSE3: Supported
SSSE3: Supported
SSE4a: Supported
SSE41: Supported
SSE42: Supported
AES: Supported
AVX: Supported
CMPXCHG16B: Supported
LAHF/SAHF: Supported
PrefetchW: Unsupported

Operating System Version:
Linux Mint 18.3 Sylvia (64 bit)
Kernel Name: Linux
Kernel Version: 4.13.0-37-generic
X Server Vendor: The X.Org Foundation
X Server Release: 11804000
X Window Manager: Mutter (Muffin)
Steam Runtime Version: steam-runtime-beta-release_2017-10-05

Video Card:
Driver: NVIDIA Corporation GeForce GTX 1060 6GB/PCIe/SSE2
Driver Version: 4.5.0 NVIDIA 384.111
OpenGL Version: 4.5
Desktop Color Depth: 24 bits per pixel
Monitor Refresh Rate: 119 Hz
VendorID: 0x10de
DeviceID: 0x1c03
Revision Not Detected
Number of Monitors: 1
Number of Logical Video Cards: 1
Primary Display Resolution: 1920 x 1080
Desktop Resolution: 1920 x 1080
Primary Display Size: 20.91" x 11.77" (23.98" diag)
53.1cm x 29.9cm (60.9cm diag)
Primary Bus: PCI Express 16x
Primary VRAM: 6144 MB
Supported MSAA Modes: 2x 4x 8x 16x

Sound card:
Audio device: Nvidia GPU 84 HDMI/DP

Memory:
RAM: 16032 Mb

Miscellaneous:
UI Language: English
LANG: en_US.UTF-8
Total Hard Disk Space Available: 98301 Mb
Largest Free Hard Disk Block: 61233 Mb
VR Headset: None detected

Recent Failure Reports:
jqpdev Mar 18, 2018 @ 2:45pm 
Here are segfaults from dmesg:

[] Civ5XP[13446]: segfault at 14 ip 000000000885bd5f sp 00000000e217d090 error 4 in Civ5XP[8048000+22a7000]
[] Civ5XP[13496]: segfault at 14 ip 000000000885bca7 sp 000000006a9b30a0 error 4 in Civ5XP[8048000+22a7000]
[] Civ5XP[13497]: segfault at 14 ip 000000000885bca7 sp 00000000697ff0a0 error 4 in Civ5XP[8048000+22a7000]

Again the issue is not limited to Manjaro and would affect the various Ubuntu based distros.
ger Mar 21, 2018 @ 1:48pm 
17.10 Kubuntu

taskset -c 0-7 steam steam://rungameid/8930

works for me.

[edit] 1700 & 480
Last edited by ger; Mar 21, 2018 @ 1:49pm
ger Mar 22, 2018 @ 10:05am 
ryzen 1700 ubuntu 17.10 working launch command

taskset -c 0-7 %command%
jqpdev Apr 29, 2018 @ 11:32pm 
Hey Ger did you try running it without using the tasket command on unbuntu?
ger Apr 30, 2018 @ 2:46am 
Originally posted by jqpdev:
Hey Ger did you try running it without using the tasket command on unbuntu?

not sure, went back to arch. just tried it there without any launch commands [linux4.16.5-1 & mesa 18.0.1] works fine now it seeems.
Karlodinium May 6, 2018 @ 2:51pm 
I have an i7-8700K and get regular crashes. The following is in dmesg.

[72579.232848] Civ5XP[1325]: segfault at 14 ip 000000000885bd5f sp 0000000098ed6100 error 4 in Civ5XP[8048000+22a7000] [76882.723408] Civ5XP[32319]: segfault at 0 ip 0000000008cd8534 sp 0000000086cff020 error 4 in Civ5XP[8048000+22a7000]

Originally posted by ger:
taskset -c 0-7 %command%

Thank you; this fixes it for me. Combined with the fix for Arch Linux, my full command is

LD_PRELOAD='./libcxxrt.so /usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /usr/$LIB/libxcb.so.1 /usr/$LIB/libgpg-error.so' taskset -c 0-7 %command%
janne Jun 7, 2018 @ 12:40pm 
The taskset command works for me too, but I also found another fix from reddit;
https://www.reddit.com/r/civ5/comments/5z77jr/game_crashes_randomly_on_linux_amd_ryzen/


There is a line with "MaxSimultaneousThreads = 8" in ~/.local/share/Aspyr/Sid Meier's Civilization 5/config.ini. The fix is to change the number to your number of logical processors, i.e. I use 16 there for Ryzen 2700X. Tested a few hours tonight and seems to work allright. This way you can also launch the game normally from the steam app instead of using terminal.
Fiasco da Gama Jul 29, 2018 @ 8:34am 
The taskset command used to work, but not anymore (idk why, i haven't played the game in a long time). The game can crash in seconds, now:
dmesg | grep segfault
[55003.336739] Civ5XP[7454]: segfault at 14 ip 000000000885bca7 sp 0000000088124090 error 4 in Civ5XP[8048000+22a7000]
[55003.336813] Civ5XP[7455]: segfault at 14 ip 000000000885bca7 sp 0000000068d10090 error 4 in Civ5XP[8048000+22a7000]
[56218.800771] Civ5XP[8278]: segfault at 0 ip 0000000008cd8534 sp 0000000088923fe0 error 4 in Civ5XP[8048000+22a7000]
[56403.439321] Civ5XP[8537]: segfault at 14 ip 000000000885bd5f sp 0000000066b0c080 error 4 in Civ5XP[8048000+22a7000]
[57605.903711] Civ5XP[9090]: segfault at 0 ip 0000000008cd8534 sp 00000000679fefe0 error 4 in Civ5XP[8048000+22a7000]
[57742.749981] Civ5XP[9600]: segfault at 14 ip 000000000885bd5f sp 000000006a9ff080 error 4 in Civ5XP[8048000+22a7000]
[58233.950605] Civ5XP[19487]: segfault at 0 ip 0000000008cd8534 sp 00000000684bdfe0 error 4 in Civ5XP[8048000+22a7000]
[58573.839441] Civ5XP[19871]: segfault at 0 ip 0000000008cd8534 sp 000000006aed1fe0 error 4 in Civ5XP[8048000+22a7000]
< >
Showing 1-15 of 27 comments
Per page: 1530 50

Date Posted: Feb 22, 2018 @ 6:19pm
Posts: 27