Linux seems to have a default limit of 128KiB (131072) on the length of any single environment variable -- any attempt to set an envvar longer than this and then run any program will result in an 'Argument list too long' error.

This seems like it should be a configuration parameter, but I've been unable to find any way to raise it. Is there any way to increase it?

It is problematic for tools like "automake" which try to pull together long lists of files or tests in an environment variable as part of their building and testing process.

  • Take a look here: ARG_MAX, maximum length of arguments for a new process
    – NarūnasK
    Jan 12, 2017 at 17:52
  • @NarūnasK: Not terribly helpful as that only talks about the limit on the total of all arguments and envvars, not the limit on each envvar.
    – Chris Dodd
    Jan 12, 2017 at 17:56
  • Did you check section: Number of arguments and maximum length of one argument? There's a hint about MAX_ARG_STRLEN (131072)
    – NarūnasK
    Jan 12, 2017 at 18:20
  • 2
    Also take a look here. It discusses your exact same problem.
    – NarūnasK
    Jan 12, 2017 at 18:25

1 Answer 1


MAX_ARG_STRLEN is a constant defined as PAGESIZE*32 in include/uapi/linux/binfmts.h. Its value cannot be changed without recompiling the kernel.

 * These are the maximum length and maximum number of strings passed to the
 * execve() system call.  MAX_ARG_STRLEN is essentially random but serves to
 * prevent the kernel from being unduly impacted by misaddressed pointers.
 * MAX_ARG_STRINGS is chosen to fit in a signed 32-bit integer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.