Skip to content

Commit

Permalink
Merge pull request fireice-uk#1830 from Spudz76/dev-faqupdate
Browse files Browse the repository at this point in the history
Update `doc/FAQ.md` with unified proper methods for Linux limits
  • Loading branch information
fireice-uk authored Sep 16, 2018
2 parents b5d3890 + c5ac310 commit 0f1a827
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions doc/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0f1a827

Please sign in to comment.