[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#710709: debootstrap: consider creating (dangling) /etc/mtab symlink



control: tags -1 +patch

revised patch

>From 55c21c166959a93b961c572d5f366d35d054ce24 Mon Sep 17 00:00:00 2001
From: Hideki Yamane <henrich@debian.org>
Date: Wed, 1 May 2019 04:24:43 +0900
Subject: [PATCH] create symlink from /proc/self/mounts to /etc/mtab

With old kernel version, there is /proc/mounts instead of
/proc/self/mounts, so check whether /proc/self exists
---
 functions | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/functions b/functions
index 24f0357..46ebceb 100644
--- a/functions
+++ b/functions
@@ -1176,6 +1176,13 @@ setup_proc () {
 			in_target mount -t sysfs sysfs /sys || true
 			umount_on_exit /sys
 		fi
+		if [ ! -f "$TARGET/etc/mtab" ]; then
+			if [ -L "$TARGET/proc/self" ]; then
+				cd "$TARGET/etc" && ln -s ../proc/self/mounts mtab
+			elif [ -f "$TARGET/proc/mounts" ]; then
+				cd "$TARGET/etc" && ln -s ../proc/mounts mtab
+			fi
+		fi
 		on_exit clear_mtab
 		;;
 	esac
-- 
2.20.1


Reply to: