Troubleshooting "omd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT"
This article explains how to fix why omd.service may fail with exit codes status=1/FAILURE or status=2/INVALIDARGUMENT.
LAST TESTED ON CHECKMK 2.4.0P9
Problem
Your omd.service fails with exit codes status=1/FAILURE or status=2/INVALIDARGUMENT.
Solution
The exit codes you see are actually Checkmk exit codes, which systemd then tries to interpret.
This means, that for example status=2/INVALIDARGUMENT, the "2" is the actual exit code from Checkmk, while "INVALIDARGUMENT" is an interpretation by systemd, according to the below reference.
From Checkmk, there are three possible exit codes for the omd.service:
0: All sites are started.
1: All sites failed to start.
2: Some sites are started, some are not, or just partially.
The root cause of the exit codes 1 and 2 can be literally anything, so you have to dig into that the usual way. This article aims to provide the necessary context to understand, that the exit codes are not systemd exit codes, but Checkmk exit codes.
Reference: Process Exit Codes