Restoring backup to Docker container

Version 2.0.0p17.cre
Ubuntu 20.04.3 LTS
Docker 20.10.7

I have a instance of Check_MK raw running and I want to migrate it to a container.
I have performed a backup of my current site.
I have spun up a docker container of the same version.
When I try the restore on the website I get this:

2022-01-18 23:34:26 --- Starting restore (bkup) ---
2022-01-18 23:34:37 Error while sending data to restore process: [Errno 32] Broken pipe
2022-01-18 23:34:37 Traceback (most recent call last):
  File "/omd/sites/cmk/bin/omd", line 60, in <module>
    omdlib.main.main()
  File "/omd/versions/2.0.0p17.cre/lib/python3/omdlib/main.py", line 4009, in main
    command.handler(version_info, site, global_opts, args, command_options)
  File "/omd/versions/2.0.0p17.cre/lib/python3/omdlib/main.py", line 2814, in main_restore
    prepare_restore_as_site_user(site, global_opts, options)
  File "/omd/versions/2.0.0p17.cre/lib/python3/omdlib/main.py", line 2911, in prepare_restore_as_site_user
    shutil.rmtree(path)
  File "/omd/versions/2.0.0p17.cre/lib/python3.8/shutil.py", line 722, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/omd/versions/2.0.0p17.cre/lib/python3.8/shutil.py", line 720, in rmtree
    os.rmdir(path)
OSError: [Errno 16] Device or resource busy: '/omd/sites/cmk/tmp'

Site restore failed

When I log in to the container and try the restore with the OMD site user it also fails.

OMD[cmk]:/home/bkup$ omd restore site-cmk.tar.gz
Restoring site from site-cmk.tar.gz...
Stopping site processes...
Removing Crontab...no crontab for cmk
Stopping redis...Not running.
Stopping apache...(not running)...OK
Stopping nagios...not running...OK
npcd was not running... could not stop
Stopping rrdcached...not running.
Stopping mkeventd...Not running.
OK
Saving temporary filesystem contents...OK
Cleaning up tmp directory...OK
Deleting existing site data...Traceback (most recent call last):
  File "/omd/sites/cmk/bin/omd", line 60, in <module>
    omdlib.main.main()
  File "/omd/versions/2.0.0p17.cre/lib/python3/omdlib/main.py", line 4009, in main
    command.handler(version_info, site, global_opts, args, command_options)
  File "/omd/versions/2.0.0p17.cre/lib/python3/omdlib/main.py", line 2814, in main_restore
    prepare_restore_as_site_user(site, global_opts, options)
  File "/omd/versions/2.0.0p17.cre/lib/python3/omdlib/main.py", line 2911, in prepare_restore_as_site_user
    shutil.rmtree(path)
  File "/omd/versions/2.0.0p17.cre/lib/python3.8/shutil.py", line 722, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/omd/versions/2.0.0p17.cre/lib/python3.8/shutil.py", line 720, in rmtree
    os.rmdir(path)
OSError: [Errno 16] Device or resource busy: '/omd/sites/cmk/tmp'

I have used the same docker run command that is in the documentation.

I tried this with setting the tmpfs setting on and off in the omd config. No change.

What am I missing?

Thanks,

C

1 Like

Your post may be duplicate, have a look here: Probleme mit der Migration zu Docker

Also: Why do you want to use Docker? Is there a real use case, or is it just fancy? :wink:

I tried what the link mentioned.

Turned of the tmpfs on the full cmk server
Ran a backup.
Turned off the tmpfs on the docker container.
tried to run the restore from the web interface. Got the following error.

2022-01-27 17:14:18 --- Starting restore (bkup) ---
2022-01-27 17:14:28 Error while sending data to restore process: [Errno 32] Broken pipe
2022-01-27 17:14:28 Traceback (most recent call last):
  File "/omd/sites/cmk/bin/omd", line 60, in <module>
    omdlib.main.main()
  File "/omd/versions/2.0.0p17.cre/lib/python3/omdlib/main.py", line 4009, in main
    command.handler(version_info, site, global_opts, args, command_options)
  File "/omd/versions/2.0.0p17.cre/lib/python3/omdlib/main.py", line 2814, in main_restore
    prepare_restore_as_site_user(site, global_opts, options)
  File "/omd/versions/2.0.0p17.cre/lib/python3/omdlib/main.py", line 2911, in prepare_restore_as_site_user
    shutil.rmtree(path)
  File "/omd/versions/2.0.0p17.cre/lib/python3.8/shutil.py", line 722, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/omd/versions/2.0.0p17.cre/lib/python3.8/shutil.py", line 720, in rmtree
    os.rmdir(path)
OSError: [Errno 16] Device or resource busy: '/omd/sites/cmk/tmp'

Site restore failed

I tried to run the restore from the command line inside the docker container.
Got the following failure.

Deleting existing site data...Traceback (most recent call last):
  File "/omd/sites/cmk/bin/omd", line 60, in <module>
    omdlib.main.main()
  File "/omd/versions/2.0.0p17.cre/lib/python3/omdlib/main.py", line 4009, in main
    command.handler(version_info, site, global_opts, args, command_options)
  File "/omd/versions/2.0.0p17.cre/lib/python3/omdlib/main.py", line 2814, in main_restore
    prepare_restore_as_site_user(site, global_opts, options)
  File "/omd/versions/2.0.0p17.cre/lib/python3/omdlib/main.py", line 2911, in prepare_restore_as_site_user
    shutil.rmtree(path)
  File "/omd/versions/2.0.0p17.cre/lib/python3.8/shutil.py", line 722, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/omd/versions/2.0.0p17.cre/lib/python3.8/shutil.py", line 720, in rmtree
    os.rmdir(path)
OSError: [Errno 16] Device or resource busy: '/omd/sites/cmk/tmp'

The reason I am using docker is that I have multiple small linux web apps that I want to run. Currently I only have physical resources to run a single Linux VM (Very small IT shop). I want to keep the apps operating as independent as I can while operating on a single Linux VM.

Is it possible to restore a full install backup to docker container?

1 Like

I think there are limitations, but that is really not my topic.
Personally I can only suggest installing Checkmk directly into your Ubuntu host.
But this is all just my opinion, maybe someone else can provide more profound technical insight.

I’m facing same issue.

@tolclayton did you managed to restore your site into docker?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.