[Home]History of RtaiSteps

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Revision 3 . . November 3, 2007 2:34 am by Lomarcan [Added section about locked memory limit]
Revision 2 . . (edit) December 15, 2005 2:44 pm by Paul C [Update with current RTAI info.]
  

Difference (from prior major revision) (no other diffs)

Added: 199a200,222

Check your locked memory limit




This is not strictly related to RTAI, but it's needed if you want to use EMC2 with a non-root user. Since the various parts of EMC2 communicates using shared memory, and since that's realtime shared memory it needs to be locked in ram (so that it will be NEVER swapped out by the system). Of course, real RAM is a precious resource (and locking memory uses it permanently) so there is a limit on how much of it a user can allocate.

The default on a bare system is 32 KB, a little on the low side... you can check the amount available using the limit command (by the way EMC2 usually needs about 1.1MB to work).

The symptom is an error during emc startup (as a common user) stating that it couldn't access shared memory (and to check if rtapi is loaded). During a strace it's identified by mmap2 returning EAGAIN (limits are the only way a mmap can fail with EAGAIN, so it is a definitive diagnosis).

On a PAM-based system you can fix this configuring a new limit for locked memory (without PAM it could be a LOT more difficult, depending on your login method):

First of all, check that you PAM config for your login method (usually in /etc/pam.d, it could be login, xdm, gdm or some other file - Debian for example keep a common file included by the other ones) contains a

session required pam_limits.so

that should be the default, but for a system built from the ground up who knows!

Then edit the configuration file proper, /etc/security/limits.conf. It's well commented but anyway what you need are two lines in it:

* soft memlock 10240
* hard memlock 10240

... which more or less says 'allows any user to lock in ram 10MB of memory'. After a new logon you should see (using limit) the new limit. If not, re-check the /etc/pam.d files to ensure that pam_limits is being used!

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
Search:
Published under a Creative Commons License