0

I am developing a .service file so that systemd can manage an app as a service on Amazon Linux 2. But when I type systemctl start my-new-service, the following error is reported in the logs:

Mar 24 hh:mm:ss the.host.name systemd[1]: my-new-service.service: main process exited, code=exited, status=10/n/a  

What does status=10/n/a refer to in this error message?

Please explain how to interpret the various possible status codes, perhaps with a link to a thorough explanation if the summary would be too long for this forum.

CodeMed
  • 5,199
  • @JdeBP No it does not because the links you sent do not explain code 10/n/a which is the basis of this current question. Until 10/n/a is explicitly explained here, any attempt to mark this as already answered will be a disservice to the community. Not meaning to be ungrateful to you, but someone tried to mark this as a duplicate when so far there is no evidence that this is a duplicate. – CodeMed Mar 24 '20 at 20:40
  • @telcoM Future visitors to this post will need to read your comment. Therefore, let's highlight it. If you post your comment as a full-on answer, I will be happy to mark it as accepted so that it gets read by others who encounter the same problem. – CodeMed Mar 27 '20 at 00:26
  • I turned my comment into an answer, and added a few links in case someone has a similar but not quite the same problem. – telcoM Mar 27 '20 at 08:10

2 Answers2

4

The message means that the app your .service file started with ExecStart= exited and set the return code to 10 when it did so.

There is no single uniform standard (although there are several partial standards and conventions) on result codes, so the only way to find out what the code 10 means is reading the documentation of that specific app... or its source code, if the documentation does not specify it.

So systemd does not know what code 10 means, so it adds n/a to indicate that no verbal description is available from systemd. You've not told us what the app in question is, so we cannot look up result code 10 for you any further than this.

In the documentation of systemd, there are several tables of result code conventions. To summarize:

  • the C library basically defines just 0 for OK and 1 (or any non-zero value) for failure
  • the Linux Standards Base (LSB) has definitions for codes 2...7, for things designed to be used as services (or originally for SysVinit-style service startup scripts)
  • the LSB specification suggests that codes 200 and above would be implementation-specific, and so systemd defines a set of codes in that range for errors generated by systemd itself.

  • the BSD operating systems define a group of generically useable exit codes in range 64..78. The definition for these codes is typically available on Linux systems too, in file /usr/include/sysexits.h, if the C development packages have been installed on the system.

But none of these are saying anything about code 10, so no guesses can be made without knowing the application in question.

telcoM
  • 96,466
1

10 is the return value of the main process. By convention every non-zero exit code is considered a failure, where the number should ideally indicate what went wrong.

n/a stands for not applicable or available (Cf. https://en.wikipedia.org/wiki/N/a) and it means there is no symbolic name for the exit code 10 defined, so it does not indicate what went wrong.

In short, something went wrong (or your script/program returns 10 erroneously).

stefan0xC
  • 1,548
  • What does exit code 10 mean? Your answer says that any nonzero exit code is a failure, but your answer does not indicate how 10 is any different than any other number, and your links do not contain reference to 10 specifically. – CodeMed Mar 24 '20 at 21:07
  • 3
    It might not mean anything. You would have to look at the script/program that returns 10 where and why it returned 10. – stefan0xC Mar 24 '20 at 21:15