Here's a patch for both bugs, just check under /proc.

>From df9ee36d23141a08834c7f4c778e4b01424bbab6 Mon Sep 17 00:00:00 2001
From: Hideki Yamane <henr...@debian.org>
Date: Tue, 17 Apr 2018 23:46:16 +0900
Subject: [PATCH] Fix second-stage failure within systemd-nspawn (Closes:
 #840372)

And it also bring another fix on lxc (Closes: #731802)
---
 functions | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/functions b/functions
index 005b007..eb70d72 100644
--- a/functions
+++ b/functions
@@ -1133,12 +1133,16 @@ setup_proc () {
                umount_on_exit /proc
                umount_on_exit /proc/bus/usb
                umount "$TARGET/proc" 2>/dev/null || true
-               in_target mount -t proc proc /proc
-               if [ -d "$TARGET/sys" ] && \
-                  grep -q '[[:space:]]sysfs' /proc/filesystems 2>/dev/null; 
then
-                       umount_on_exit /sys
-                       umount "$TARGET/sys" 2>/dev/null || true
-                       in_target mount -t sysfs sysfs /sys
+               # if systemd-nspawn is used at second-stage, it already treats 
/proc and so on
+               # and also fix failure on lxc environment
+               if [ ! -n "$(ls -A /proc)" ]; then
+                       in_target mount -t proc proc /proc
+                       if [ -d "$TARGET/sys" ] && \
+                          grep -q '[[:space:]]sysfs' /proc/filesystems 
2>/dev/null; then
+                               umount_on_exit /sys
+                               umount "$TARGET/sys" 2>/dev/null || true
+                               in_target mount -t sysfs sysfs /sys
+                       fi
                fi
                on_exit clear_mtab
                ;;
-- 
2.17.0

Reply via email to