Troubleshooting "KeyError: APACHE_TCP_PORT" error

This article helps troubleshoot errors while restoring a Checkmk backup.

LAST TESTED ON CHECKMK 2.0.0P1

Table of Contents

Problem

When restoring a Checkmk backup, you may face this error:

OMD [mysite]:-# omd restore mysite_backup.tar.gz
Restoring site from mysite_backup.tar.gz.
Traceback (most recent call last):
	File "/usr/bin/omd", line 60, in <module>
	omdlib.main.main ()
	File "/omd/versions/2.0.0.p24.cee/lib/python3/omdlib/main.py", line 4022, in main
	command. handler(version_info, site, global_opts, args, command options)
	File "/omd/versions/2.0.0p24.cee/lib/python3/omdlib/main.py", line 2816, in main_restore
	orig_apache_port = site.conf["APACHE_TCP_PORT]
KeyError: 'APACHE_TCP_PORT.

Solution

You need to run the command with root permissions:

user@mylinuxhost~# sudo omd restore mysite_backup.tar.gz
Restoring site mysite from mysite.tar.gz. . .