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:
[ 1385.777415] 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 16-30 of 31 comments
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]
jqpdev Aug 2, 2018 @ 5:28pm 
Bifitruc:
I took a bit of break from the game on Linux. With my current work schedule and family commitments I won't have the time to test for a bit. However, as soon as I do have the opportunity I'll test and report back. You might also include the distro., distro. version, and some info. about your hardware.
Fiasco da Gama Sep 6, 2018 @ 9:52am 
I modified the file as janne said, and it worked again.
Thadah D. Denyse Nov 22, 2018 @ 7:09am 
The game didn't work for me unless I put

LD_PRELOAD='./libcxxrt.so:/usr/$LIB/libstdc++.so.6:/usr/lib32/libopenal.so.1' %command%

without the taskset, as it wouldn't work if I put it. I also modified the ~/.local/share/Aspyr/Sid Meier's Civilization 5/config.ini file with

MaxSimultaneousThreads = 12

I was using these system settings

Processor: Ryzen 5 1600
OS: Manjaro KDE
Kernel: 4.19.2
NVIDIA Driver version: 410.73

This was done without installing the package steam-native.

Here is the System Information dump:

Computer Information:
Manufacturer: ASUS
Model: ROG Strix B350-F Gaming
Form Factor: Desktop
No Touch Input Detected

Processor Information:
CPU Vendor: AuthenticAMD
CPU Brand: AMD Ryzen 5 1600 Six-Core Processor
CPU Family: 0x17
CPU Model: 0x1
CPU Stepping: 0x1
CPU Type: 0x0
Speed: 3200 Mhz
12 logical processors
6 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:
"Manjaro Linux" (64 bit)
Kernel Name: Linux
Kernel Version: 4.19.2-1-MANJARO
X Server Vendor: The X.Org Foundation
X Server Release: 12003000
X Window Manager: KWin
Steam Runtime Version: steam-runtime-beta-release_2018-10-24

Video Card:
Driver: NVIDIA Corporation GeForce GTX 970/PCIe/SSE2
Driver Version: 4.6.0 NVIDIA 410.73
OpenGL Version: 4.6
Desktop Color Depth: 24 bits per pixel
Monitor Refresh Rate: 144 Hz
VendorID: 0x10de
DeviceID: 0x13c2
Revision Not Detected
Number of Monitors: 2
Number of Logical Video Cards: 1
Primary Display Resolution: 1920 x 1080
Desktop Resolution: 3840 x 1080
Primary Display Size: 20.91" x 11.73" (23.94" diag)
53.1cm x 29.8cm (60.8cm diag)
Primary Bus: PCI Express 16x
Primary VRAM: 4096 MB
Supported MSAA Modes: 2x 4x 8x 16x

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

Memory:
RAM: 7972 Mb[/code]
Last edited by Thadah D. Denyse; Nov 22, 2018 @ 7:11am
ZappeL@BigRed Jan 9, 2019 @ 2:22am 
Hey, the solution is quiet simple.

The issue it self is caused by the BinkPlayer. You just have to disable the loading of the .mov files. This can be done by the following two solutions (no root needed):

0. (changing to the Civ5 directory):
cd "${HOME}/.local/share/Steam/steamapps/common/Sid Meier's Civilization V"

1. (safe - not manipulating the binary):
for m in `find . -name \*.mov -type f`; do mv "$m" "$m"_bak; done

2. (critical, use at own risk - patching the binary):
for b in {5676,5884,6088}; do dd if=/dev/zero of=Civ5XP bs=1 seek=1864$b count=1 conv=notrunc; done

The second issue is the "threading" one, that can be fixed by starting it using 'numactl'
echo 8930 > steam_appid.txt numactl --physcpubind=+0-7 ./Civ5XP

If you're interested in a full solution for patching this you can have a look on https://gist.github.com/aspann/f57a4725d70d8554fa8e3ce266f03585


cheers.
KwaZulu-Natal Feb 8, 2019 @ 4:43pm 
Just wanted so say that
1) I also did have the problem with the seg faults when playing Civ 5 on a Reyzen 5 CPU running Linux Mint 19
2) The solotuion suggested by many peaple here using taskset -c 1-8 steam steam://rungameid/8930 or taskset -c 0-7 steam steam://rungameid/8930 did NOT work for me. The seg faults were exactly the same
3) What did help in my case was setting MaxSimultaneousThreads = 12 in the file .local/share/Aspyr/Sid\ Meier\'s\ Civilization\ 5/config.ini

This was also suggeted already by some in this thread I just wanted to make that it can help even if the other method does not work
Phantom Nov 30, 2019 @ 11:07pm 
I have AMD Ryzen Threadripper 2990WX (32 cores), and no solution works for me.

I tried setting MaxSimultaneousThreads to different values, such as 8, 16, 32, and 64. I also tried the taskset 0-7 approach.

Unfortunately, the game keeps segfaulting very soon after the start. Just for the record, the same happens to Civilization: Beyond Earth.

I use Fedora 30, and my video adapter is NVIDIA GeForce GTX 1050 Ti.
[ZM] | Dr. Dro Dec 1, 2019 @ 3:52am 
Originally posted by Phantom:
I have AMD Ryzen Threadripper 2990WX (32 cores), and no solution works for me.

I tried setting MaxSimultaneousThreads to different values, such as 8, 16, 32, and 64. I also tried the taskset 0-7 approach.

Unfortunately, the game keeps segfaulting very soon after the start. Just for the record, the same happens to Civilization: Beyond Earth.

I use Fedora 30, and my video adapter is NVIDIA GeForce GTX 1050 Ti.

2990WX is multi-NUMA, yes? Maybe it works if you disable all but one node?
Chaotic Harmony Dec 1, 2019 @ 8:01am 
Just want to point out that the 1st generation Ryzen CPUs are known to have a segfault issue in silicon; since you replicated this with other CPUs that can't be the only cause. But I'd grab the kill-ryzen script and test if you're running a Ryzen 1; since AMD may still RMA it.
I tried several things and the game either wouldn't launch or it would only work for 15-40 ish minutes. By doing the two things below, I was able to play over an hour I believe without crashing. I actually exited the game for once.

Since I have an AMD 2700X, I set my thread limit to 16 in the ini file.

Originally posted by ZappeL@BigRed:
Hey, the solution is quiet simple.

The issue it self is caused by the BinkPlayer. You just have to disable the loading of the .mov files. This can be done by the following two solutions (no root needed):

0. (changing to the Civ5 directory):
cd "${HOME}/.local/share/Steam/steamapps/common/Sid Meier's Civilization V"

1. (safe - not manipulating the binary):
for m in `find . -name \*.mov -type f`; do mv "$m" "$m"_bak; done

cheers.


Originally posted by Thadah D. Denyse:

without the taskset, as it wouldn't work if I put it. I also modified the ~/.local/share/Aspyr/Sid Meier's Civilization 5/config.ini file with

MaxSimultaneousThreads = 12
yugami Mar 17 @ 2:27pm 
I just wanted to throw in that I tried a bunch of solutions and what worked was dialing tasksel back from 0-7 to 0-3. I could barely make it past the launching a new game and now I just played for a couple hours.

https://wiki.gentoo.org/wiki/Steam/Games_troubleshooting
Last edited by yugami; Mar 17 @ 2:31pm
< >
Showing 16-30 of 31 comments
Per page: 15 30 50