The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3376

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Move the content of rootfs inside OCI package to rootfs instead of replacing it, as the directory is used as the mountpoint.

Tested with directory and loop backingstore.

Noticed this on Debian, where the error message was `rmdir: failed to remove '/usr/lib/x86_64-linux-gnu/lxc/rootfs': Device or resource busy` when running 

    lxc-create -n test -t oci -B loop -- -u docker://centos:latest
From bbd84ff1a7254b302ad7b67bd6395641eb1e0727 Mon Sep 17 00:00:00 2001
From: Toni Ylenius <toni.ylen...@iki.fi>
Date: Sun, 12 Apr 2020 22:28:24 +0300
Subject: [PATCH] Fix lxc-oci template with loop backingstore

Move the content of rootfs inside OCI package to rootfs instead of
replacing it, as the directory is used as the mountpoint.

Tested with directory and loop backingstore.

Signed-off-by: Toni Ylenius <toni.ylen...@iki.fi>
---
 templates/lxc-oci.in | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/templates/lxc-oci.in b/templates/lxc-oci.in
index 8017c38c1e..dab077191b 100644
--- a/templates/lxc-oci.in
+++ b/templates/lxc-oci.in
@@ -348,8 +348,7 @@ fi
 # shellcheck disable=SC2039
 # shellcheck disable=SC2068
 umoci --log=error unpack ${umoci_args[@]} --image "${DOWNLOAD_TEMP}:latest" 
"${LXC_ROOTFS}.tmp"
-rmdir "${LXC_ROOTFS}"
-mv "${LXC_ROOTFS}.tmp/rootfs" "${LXC_ROOTFS}"
+find "${LXC_ROOTFS}.tmp/rootfs" -mindepth 1 -maxdepth 1 -exec mv '{}' 
"${LXC_ROOTFS}/" \;
 
 OCI_CONF_FILE=$(getconfigpath "${DOWNLOAD_TEMP}" latest)
 LXC_CONF_FILE="${LXC_PATH}/config"
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to