container-storage-setup icon indicating copy to clipboard operation
container-storage-setup copied to clipboard

"atomic storage reset" fails if /var/lib/docker is mounted

Open mbarnes opened this issue 8 years ago • 6 comments

Following the RHEL documentation for setting up the overlay2 graph driver, which recommends:

CONTAINER_ROOT_LV_MOUNT_PATH=/var/lib/docker

atomic storage reset subsequently fails with

rm: cannot remove ‘/var/lib/docker’: Device or resource busy

because the LV is still mounted there.

mbarnes avatar Aug 30 '17 19:08 mbarnes

You should do

systemctl stop docker
atomic storage reset
atomic storage modify --storage=overlay2
systemctl start docker

rhatdan avatar Aug 30 '17 19:08 rhatdan

I should have emphasized this is when running atomic storage reset again after all that.

Observed this while working on a devicemapper-to-overlay2 playbook (based on yours) and trying to reset the state back to devicemapper (see https://github.com/openshift/openshift-ansible/pull/5216).

mbarnes avatar Aug 30 '17 19:08 mbarnes

@rhvgoyal Ideas?

rhatdan avatar Aug 30 '17 19:08 rhatdan

What about just:

diff --git a/Atomic/storage.py b/Atomic/storage.py
index 77c1cbb..6e02256 100644
--- a/Atomic/storage.py
+++ b/Atomic/storage.py
@@ -160,6 +160,7 @@ class Storage(Atomic):
         util.call(["umount", root + "/devicemapper"], stderr=DEVNULL)
         util.call(["umount", root + "/overlay"], stderr=DEVNULL)
         util.call(["umount", root + "/overlay2"], stderr=DEVNULL)
+        util.call(["umount", root], stderr=DEVNULL)
         shutil.rmtree(root)
         os.mkdir(root)
         try:

And let it silently fail if there's nothing mounted there?

mbarnes avatar Aug 30 '17 19:08 mbarnes

If that works, open a pull request with atomic.

rhatdan avatar Aug 30 '17 19:08 rhatdan

Gah, just realized I filed this issue against the wrong project. Sorry about that. 😖

mbarnes avatar Aug 30 '17 19:08 mbarnes