Skip to content
Snippets Groups Projects
Commit c5ac310a authored by Tony Butler's avatar Tony Butler
Browse files

Update `doc/FAQ.md` with unified proper methods for Linux limits

parent b5d38909
No related branches found
No related tags found
No related merge requests found
......@@ -45,20 +45,35 @@ Download and install this [runtime package](https://go.microsoft.com/fwlink/?Lin
## Error: MEMORY ALLOC FAILED: mmap failed
On Linux you will need to configure large page support and increase your ulimit -l.
On Linux you will need to configure large page support and increase your memlock limit (`ulimit -l`).
To set large page support, add the following lines to `/etc/sysctl.conf` (`/etc/sysctl.d/xmr-stak.conf` for [Arch Linux](https://www.archlinux.org/news/deprecation-of-etcsysctlconf/) and its derivatives):
Never put settings directly into `/etc/sysctl.conf` or `/etc/security/limits.conf` as those are system defaults and can be replaced in upgrades, and custom settings in that file are deprecated in all distros since at least wheezy/trusty (has been illegal in RedHat based distros for longer than that), and will be even more deprecated with systemd (it no longer even reads sysctl.conf, ONLY sysctl.d files, for example - there is a link to the old `/etc/sysctl.conf` for backward compatibility but that can go away at any time). Also adding to `/etc/rc.local` is extra incorrect, systemd does not even use that file anymore (once the sysvinit compatibility layer is gone, rc.local will no longer work).
To check current settings, run `/sbin/sysctl vm.nr_hugepages ; ulimit -l` as whatever user you will run `xmr-stak` as (example shows bad/low sample defaults):
$ /sbin/sysctl vm.nr_hugepages ; ulimit -l
vm.nr_hugepages = 0
16
To set large page support, add the following lines to `/etc/sysctl.d/60-hugepages.conf`:
vm.nr_hugepages=128
To increase the ulimit, add following lines to `/etc/security/limits.conf`:
You WILL need to run `sudo sysctl --system` for these settings to take effect on your system (or reboot). In some cases (many threads, very large CPU, etc) you may need more than 128 (try 256 if there are still complaints from thread inits)
* soft memlock 262144
* hard memlock 262144
To increase the memlock (ulimit -l), add following lines to `/etc/security/limits.d/60-memlock.conf`:
* - memlock 262144
root - memlock 262144
You WILL need to log out and log back in for these settings to take effect on your user (no need to reboot, just relogin in your session).
Recheck after completing these steps to validate:
$ /sbin/sysctl vm.nr_hugepages ; ulimit -l
vm.nr_hugepages = 128
262144
You can also do it Windows-style and simply run-as-root, but this is NOT recommended for security reasons.
You can also do it Windows-style and simply run-as-root, but this is NOT recommended for security reasons. Also running as root does not properly get around the `ulimit -l` being large enough (and limits `*` does not apply to `root` either, it must be specified explicitly).
## Illegal Instruction
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment