A Hat in Time: How to Fix Game Crashes on Linux

Solutions for common crashes you may run into while playing A Hat in Time on a Linux system through Steam Play.

 

Before Following This Guide

If you’re experiencing trouble running the game, you should add

PROTON_LOG=1

to your game’s launch options. This will create a logfile (steam-253230.log) in your home directory, containing everything that the game/Proton is doing while running the game. This should help if the crash is something that doesn’t happen in Windows.

Be sure to take this launch option out if you’re not using it – the log file size can grow quickly while playing.

Also keep in mind:

  • Many of the commands in this guide assume you have root/superuser access to your system.

Crash when using lots of mods, or several large mods

If you are having trouble loading the game or entering a level with certain mods installed, or going over a certain amount of mods, check your logfile for a line like this:

err:virtual:try_map_free_area mmap() error cannot allocate memory, range 0xf4f60000-0x8ad0000, unix_prot 0x3

In this case the range doesn’t matter.

If this shows up a lot in your logs, you may have a low vm.max_map_count.

What is vm.max_map_count?

In Linux, system parameters can control various behaviors of the underlying system, regardless of what distribution you’re running. vm.max_map_count controls OS limits on the maximum number of memory map (mmap) areas a process can have. If a process cannot allocate enough memory map areas, the process may crash.

By default, vm.max_map_count is about 65530 or 65535 in most Linux distributions (1 per 128kb of system memory, or about 8gb of memory by default). The Steam Deck, however, ships with a value of 2147483642 (or, MAX_INT – 5) for maximum compatibility with Windows games, so it shouldn’t run into this issue.

A more sensible value to set it to may be 262144 (32GB).

You can check the current value on your system by running this terminal command (example output included):

sudo sysctl vm.max_map_count
[sudo] password for root:
vm.max_map_count = 65530

Changing vm.max_map_count temporarily

Even if you want to fix it permanently, try this first.

To change the value of vm.max_map_count, run this terminal command, replacing <num> with the number you wish to use.

sudo sysctl -w vm.max_map_count=<num>

This should take effect instantly. Try running A Hat in Time again, and see if it will boot now!

If this didn’t work for you, you can either set the value back yourself, or reboot the system.

Changing vm.max_map_count permanently

Found a value that works for you? Great! Let’s now set it up so your system will apply it automatically on boot.

The place to set this is in /etc/sysctl.conf, but if you have a /etc/sysctl.d folder, it may be preferred to create /etc/sysctl.d/99-steamplay.conf instead.

In whichever file you decide, add the following line, again replacing <num> with your number of choice:

vm.max_map_count=<num>

Be sure to save the file, and when you reboot, the new value should be applied automatically!


Thanks to Splatsune Miku for his excellent guide, all credits belong to his effort. if this guide helps you, please support and rate it via Steam Community. enjoy the game.

About Robins Chew

I'm Robins, who love to play the mobile games from Google Play, I will share the gift codes in this website, if you also love mobile games, come play with me. Besides, I will also play some video games relresed from Steam.

Leave a Comment