Package: lxc
Version: 0.8.0~rc1-9
Severity: important
Tags: patch

When lxc detects that the lxc directory is on a btrfs filesystem it will create
a separate subvolume for the rootfs. However, the lxc-debconf template does not
expect the rootfs directory to exist, and simply copies the cache directory to
the rootfs path, expecting to create it, but in fact creating a subdirectory
with the rootfs content.

The attached patch to lxc-debconf fixes this by creating the rootfs directory
if it does not exist, and then copying the content of the cache directory,
rather than the cache directory itself, into the rootfs directory.

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing'), (400, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.5-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=sv_SE.UTF-8, LC_CTYPE=sv_SE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages lxc depends on:
ii  debconf [debconf-2.0]  1.5.44
ii  libc6                  2.13-33
ii  libcap2                1:2.22-1.1
ii  multiarch-support      2.13-33

Versions of packages lxc recommends:
ii  debootstrap  1.0.42
pn  libcap2-bin  <none>

Versions of packages lxc suggests:
pn  lxctl  <none>

-- debconf information:
* lxc/shutdown: /usr/bin/lxc-halt
  lxc/directory: /var/lib/lxc
  lxc/title:
  lxc/auto: true
--- /usr/share/lxc/templates/lxc-debconf.distrib	2012-08-04 14:46:16.000000000 +0200
+++ /usr/share/lxc/templates/lxc-debconf	2012-08-04 17:38:10.703390765 +0200
@@ -454,7 +454,8 @@
 	then
 		# system cache in the form of a directory
 		echo -n "Copying system cache to ${_ROOTFS}..."
-		cp -a "/usr/share/lxc/cache/${_MODE}/${_DISTRIBUTION}_${_ARCHITECTURE}" "${_ROOTFS}" || return 1
+		[ -e "${_ROOTFS}" ] || mkdir -p "${_ROOTFS}"
+		cp -a "/usr/share/lxc/cache/${_MODE}/${_DISTRIBUTION}_${_ARCHITECTURE}"/* "${_ROOTFS}" || return 1
 	elif ls "/usr/share/lxc/cache/${_MODE}/${_DISTRIBUTION}_${_ARCHITECTURE}".* > /dev/null 2>&1
 	then
 		# system cache in the form of a tarball
@@ -463,8 +464,7 @@
 			if [ -e "/usr/share/lxc/cache/${_MODE}/${_DISTRIBUTION}_${_ARCHITECTURE}.${_FORMAT}" ]
 			then
 				echo -n "Extracting system cache to ${_ROOTFS}..."
-
-				mkdir -p "${_ROOTFS}"
+				[ -e "${_ROOTFS}" ] || mkdir -p "${_ROOTFS}"
 				tar xf "/usr/share/lxc/cache/${_MODE}/${_DISTRIBUTION}_${_ARCHITECTURE}.${_FORMAT}" -C "${_ROOTFS}" || return 1
 				break
 			fi
@@ -478,7 +478,8 @@
 
 		# make a local copy of the minimal system
 		echo -n "Copying local cache to ${_ROOTFS}..."
-		cp -a "${_CACHE}/${_DISTRIBUTION}_${_ARCHITECTURE}" "${_ROOTFS}" || return 1
+		[ -e "${_ROOTFS}" ] || mkdir -p "${_ROOTFS}"
+		cp -a "${_CACHE}/${_DISTRIBUTION}_${_ARCHITECTURE}"/* "${_ROOTFS}" || return 1
 	fi
 
 	# Add local repositories configured from preseed file

Reply via email to