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

Bug#813232: debootstrap: Two-staged bootstrapping with --second-stage broken



On Feb 01, Marco d'Itri <md@Linux.IT> wrote:

> Since the content of /dev is architecture independent, a possible fix 
> would be to move the call to setup_devices() in every release script 
> from the very beginning of the second stage to the very end of the first 
> stage.
The attached untested patch attempts to do this.
I did not bother adding calls to setup_devices2 to the Ubuntu scripts 
since it is only used by the Hurd and *freebsd targets.

-- 
ciao,
Marco
diff --git a/functions b/functions
index be4919f..64d470b 100644
--- a/functions
+++ b/functions
@@ -1046,7 +1046,8 @@ setup_proc_fakechroot () {
 	ln -s /proc "$TARGET"
 }
 
-setup_devices () {
+# create the static device nodes
+setup_devices1 () {
 	if doing_variant fakechroot; then
 		setup_devices_fakechroot
 		return 0
@@ -1054,11 +1055,11 @@ setup_devices () {
 
 	case "$HOST_OS" in
 	    kfreebsd*)
-		in_target mount -t devfs devfs /dev ;;
+		;;
 	    freebsd)
-		mount -t devfs devfs $TARGET/dev ;;
+		;;
 	    hurd*)
-		setup_devices_hurd ;;
+		;;
 	    *)
 		if true; then
 			setup_devices_simple
@@ -1071,6 +1072,22 @@ setup_devices () {
 	esac
 }
 
+# enable the dynamic device nodes
+setup_devices2 () {
+	if doing_variant fakechroot; then
+		return 0
+	fi
+
+	case "$HOST_OS" in
+	    kfreebsd*)
+		in_target mount -t devfs devfs /dev ;;
+	    freebsd)
+		mount -t devfs devfs $TARGET/dev ;;
+	    hurd*)
+		setup_devices_hurd ;;
+	esac
+}
+
 setup_devices_simple () {
 	# The list of devices that can be created in a container comes from
 	# src/core/cgroup.c in the systemd source tree.
diff --git a/scripts/aequorea b/scripts/aequorea
index fddd777..3aa9b27 100644
--- a/scripts/aequorea
+++ b/scripts/aequorea
@@ -57,6 +57,8 @@ first_stage_install () {
 		chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
 	fi
 
+	setup_devices1
+
 	x_feign_install () {
 		local pkg="$1"
 		local deb="$(debfor $pkg)"
@@ -77,7 +79,7 @@ Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
 }
 
 second_stage_install () {
-	setup_devices
+	setup_devices2
 
 	x_core_install () {
 		smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
diff --git a/scripts/breezy b/scripts/breezy
index e0f0de1..9f36974 100644
--- a/scripts/breezy
+++ b/scripts/breezy
@@ -44,6 +44,8 @@ first_stage_install () {
         chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
     fi
 
+    setup_devices1
+
     x_feign_install () {
         local pkg="$1"
         local deb="$(debfor $pkg)"
@@ -71,7 +73,6 @@ second_stage_install () {
 	baseprog="$(($baseprog + ${1:-1}))"
     }
 
-    setup_devices
     setup_proc
     umount_on_exit /dev/.static/dev
     umount_on_exit /dev
diff --git a/scripts/dapper b/scripts/dapper
index 4755240..2f2d43a 100644
--- a/scripts/dapper
+++ b/scripts/dapper
@@ -51,6 +51,8 @@ first_stage_install () {
         chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
     fi
 
+    setup_devices1
+
     x_feign_install () {
         local pkg="$1"
         local deb="$(debfor $pkg)"
@@ -78,7 +80,6 @@ second_stage_install () {
 	baseprog="$(($baseprog + ${1:-1}))"
     }
 
-    setup_devices
     setup_proc
     in_target /sbin/ldconfig
 
diff --git a/scripts/edgy b/scripts/edgy
index 8175a0a..eb50099 100644
--- a/scripts/edgy
+++ b/scripts/edgy
@@ -57,6 +57,8 @@ first_stage_install () {
         chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
     fi
 
+    setup_devices1
+
     x_feign_install () {
         local pkg="$1"
         local deb="$(debfor $pkg)"
@@ -84,8 +86,6 @@ second_stage_install () {
 	baseprog="$(($baseprog + ${1:-1}))"
     }
 
-    setup_devices
-
     if doing_variant fakechroot; then
 	setup_proc_fakechroot
     else
diff --git a/scripts/feisty b/scripts/feisty
index b97b440..66286a5 100644
--- a/scripts/feisty
+++ b/scripts/feisty
@@ -57,6 +57,8 @@ first_stage_install () {
         chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
     fi
 
+    setup_devices1
+
     x_feign_install () {
         local pkg="$1"
         local deb="$(debfor $pkg)"
@@ -84,8 +86,6 @@ second_stage_install () {
 	baseprog="$(($baseprog + ${1:-1}))"
     }
 
-    setup_devices
-
     if doing_variant fakechroot; then
 	setup_proc_fakechroot
     else
diff --git a/scripts/gutsy b/scripts/gutsy
index bb39bf5..92448e3 100644
--- a/scripts/gutsy
+++ b/scripts/gutsy
@@ -64,6 +64,8 @@ first_stage_install () {
 		chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
 	fi
 
+	setup_devices1
+
 	x_feign_install () {
 		local pkg="$1"
 		local deb="$(debfor $pkg)"
@@ -91,8 +93,6 @@ second_stage_install () {
 		baseprog="$(($baseprog + ${1:-1}))"
 	}
 
-    setup_devices
-
 	if doing_variant fakechroot; then
 		setup_proc_fakechroot
 	else
diff --git a/scripts/hoary b/scripts/hoary
index 985ace5..a1f48b3 100644
--- a/scripts/hoary
+++ b/scripts/hoary
@@ -65,6 +65,8 @@ first_stage_install () {
         chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
     fi
 
+    setup_devices1
+
     x_feign_install () {
         local pkg="$1"
         local deb="$(debfor $pkg)"
@@ -98,7 +100,6 @@ second_stage_install () {
     baseprog=0
     bases=7
 
-    setup_devices
     setup_proc
     umount_on_exit /.dev
     umount_on_exit /dev
diff --git a/scripts/hoary.buildd b/scripts/hoary.buildd
index f553963..8dd4a02 100644
--- a/scripts/hoary.buildd
+++ b/scripts/hoary.buildd
@@ -61,6 +61,8 @@ first_stage_install () {
         chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
     fi
 
+    setup_devices1
+
     x_feign_install () {
         local pkg="$1"
         local deb="$(debfor $pkg)"
@@ -93,7 +95,6 @@ second_stage_install () {
     baseprog=0
     bases=40
 
-    setup_devices
     setup_proc
     in_target /sbin/ldconfig
 
diff --git a/scripts/potato b/scripts/potato
index d187100..557eadb 100644
--- a/scripts/potato
+++ b/scripts/potato
@@ -54,6 +54,8 @@ Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
         touch "$TARGET/var/lib/dpkg/info/${pkg}.list"
     }
 
+    setup_devices1
+
     x_feign_install dpkg
 
     if [ -e "$TARGET/usr/bin/perl-5.005.dist" ]; then
@@ -71,7 +73,6 @@ second_stage_install () {
 
     export DEBIAN_FRONTEND=Noninteractive
 
-    setup_devices
     setup_proc
     ln "$TARGET/sbin/ldconfig.new" "$TARGET/sbin/ldconfig"
     in_target /sbin/ldconfig
diff --git a/scripts/sarge b/scripts/sarge
index 719543f..84d0b39 100644
--- a/scripts/sarge
+++ b/scripts/sarge
@@ -107,6 +107,8 @@ first_stage_install () {
         chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
     fi
 
+    setup_devices1
+
     x_feign_install () {
         local pkg="$1"
         local deb="$(debfor $pkg)"
@@ -134,7 +136,6 @@ second_stage_install () {
 	baseprog="$(($baseprog + ${1:-1}))"
     }
 
-    setup_devices
     setup_proc
     in_target /sbin/ldconfig
 
diff --git a/scripts/sarge.buildd b/scripts/sarge.buildd
index bc8be10..3142ef1 100644
--- a/scripts/sarge.buildd
+++ b/scripts/sarge.buildd
@@ -68,6 +68,8 @@ first_stage_install () {
         chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
     fi
 
+    setup_devices1
+
     x_feign_install () {
         local pkg="$1"
         local deb="$(debfor $pkg)"
@@ -95,7 +97,6 @@ second_stage_install () {
 	baseprog="$(($baseprog + ${1:-1}))"
     }
 
-    setup_devices
     setup_proc
     in_target /sbin/ldconfig
 
diff --git a/scripts/sid b/scripts/sid
index bf3404f..7da5a44 100644
--- a/scripts/sid
+++ b/scripts/sid
@@ -53,6 +53,8 @@ first_stage_install () {
 		chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
 	fi
 
+	setup_devices1
+
 	x_feign_install () {
 		local pkg="$1"
 		local deb="$(debfor $pkg)"
@@ -73,7 +75,7 @@ Status: install ok installed" >> "$TARGET/var/lib/dpkg/status"
 }
 
 second_stage_install () {
-	setup_devices
+	setup_devices2
 
 	x_core_install () {
 		smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
diff --git a/scripts/warty b/scripts/warty
index d774871..0603d0a 100644
--- a/scripts/warty
+++ b/scripts/warty
@@ -53,6 +53,8 @@ first_stage_install () {
         chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
     fi
 
+    setup_devices1
+
     x_feign_install () {
         local pkg="$1"
         local deb="$(debfor $pkg)"
@@ -84,7 +86,6 @@ second_stage_install () {
     DEBCONF_NONINTERACTIVE_SEEN=true
     export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
 
-    setup_devices
     setup_proc
     in_target /sbin/ldconfig
 
diff --git a/scripts/warty.buildd b/scripts/warty.buildd
index 7e2fe74..f7d8ef0 100644
--- a/scripts/warty.buildd
+++ b/scripts/warty.buildd
@@ -61,6 +61,8 @@ first_stage_install () {
         chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
     fi
 
+    setup_devices1
+
     x_feign_install () {
         local pkg="$1"
         local deb="$(debfor $pkg)"
@@ -93,7 +95,6 @@ second_stage_install () {
     baseprog=0
     bases=40
 
-    setup_devices
     setup_proc
     in_target /sbin/ldconfig
 
diff --git a/scripts/woody b/scripts/woody
index d1b326f..a327caf 100644
--- a/scripts/woody
+++ b/scripts/woody
@@ -93,6 +93,8 @@ first_stage_install () {
         chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
     fi
 
+    setup_devices1
+
     x_feign_install () {
         local pkg="$1"
         local deb="$(debfor $pkg)"
@@ -120,7 +122,6 @@ second_stage_install () {
 	baseprog="$(($baseprog + ${1:-1}))"
     }
 
-    setup_devices
     setup_proc
     in_target /sbin/ldconfig
 
diff --git a/scripts/woody.buildd b/scripts/woody.buildd
index 094fc9a..b9c089e 100644
--- a/scripts/woody.buildd
+++ b/scripts/woody.buildd
@@ -68,6 +68,8 @@ first_stage_install () {
         chown 0:0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab"
     fi
 
+    setup_devices1
+
     x_feign_install () {
         local pkg="$1"
         local deb="$(debfor $pkg)"
@@ -95,7 +97,6 @@ second_stage_install () {
 	baseprog="$(($baseprog + ${1:-1}))"
     }
 
-    setup_devices
     setup_proc
     in_target /sbin/ldconfig
 

Attachment: signature.asc
Description: PGP signature


Reply to: