What does INVALIDARGUMENT mean?

Solution 1:

The "INVALIDARGUMENT" name is a "code" for exit status 2.

In systemd source code (looking at v219, which is the version shipped with RHEL 7), there's a constant for it defined in enum ExitStatus:

EXIT_INVALIDARGUMENT = 2,

These constants seem to come from the LSB standard (which tried to standardize init scripts, when init scripts used to be a thing...)

Looking at the relevant section of LSB, there's this table:

1      generic or unspecified error (current practice)
2      invalid or excess argument(s)
3      unimplemented feature (for example, "reload")
4      user had insufficient privilege
5      program is not installed
6      program is not configured
7      program is not running

Which matches the other systemd constants... So it seems systemd tried to use the LSB standard, since there's some small benefit for programs following this standard.

Of course, not all programs follow this standard, so systemd might end up telling what it thinks that error code means, even though program authors might have decided to use exit status 2 (and others through 7) for completely different purposes...