-From c92cea971e210f4acd90675a7473256fd2dcb4be Mon Sep 17 00:00:00 2001
+From 95d5b309830e6f35e7d0b21a7bc2c039b7b41679 Mon Sep 17 00:00:00 2001
 From: Christian Stewart <christian@paral.in>
 Date: Mon, 25 Jan 2021 04:34:09 -0800
 Subject: [PATCH] HACK: WSL2: libcontainer: avoid mount --move

 	if err := unix.Mount("", "/", "", uintptr(flag), ""); err != nil {
 		return err
 	}
@@ -834,6 +849,9 @@ func msMoveRoot(rootfs string) error {
 			}
 		}
 	}
+	// WSL2: mount --move {path} / fails silently.
+	// The chroot() still works (changes dir to ., which is rootfs).
+	// Therefore the container still starts, but "exec" will be in the wrong place.
 	if err := unix.Mount(rootfs, "/", "", unix.MS_MOVE, ""); err != nil {
 		return err
 	}
diff --git a/libcontainer/setns_init_linux.go b/libcontainer/setns_init_linux.go
index 0b9cd885..e391d4bb 100644
--- a/libcontainer/setns_init_linux.go
+++ b/libcontainer/setns_init_linux.go
@@ -32,6 +32,21 @@ func (l *linuxSetnsInit) Init() error {
 	runtime.LockOSThread()
 	defer runtime.UnlockOSThread()
 


Signed-off-by: Christian Stewart <christian@paral.in>
---
 libcontainer/rootfs_linux.go        | 48 ++++++++++++++++++++---------
 libcontainer/setns_init_linux.go    | 15 +++++++++
 libcontainer/standard_init_linux.go |  1 +
 libcontainer/wsl.go                 | 15 +++++++++
 4 files changed, 65 insertions(+), 14 deletions(-)
 create mode 100644 libcontainer/wsl.go

diff --git a/libcontainer/rootfs_linux.go b/libcontainer/rootfs_linux.go
index 411496ab..7605cc7a 100644
--- a/libcontainer/rootfs_linux.go
+++ b/libcontainer/rootfs_linux.go
@@ -44,6 +44,9 @@ func needsSetupDev(config *configs.Config) bool {
 // finalizeRootfs after this function to finish setting up the rootfs.
 func prepareRootfs(pipe io.ReadWriter, iConfig *initConfig) (err error) {
 	config := iConfig.Config
