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

Bug#872577: marked as done (debootstrap: Handle existing /dev)



Your message dated Tue, 17 Apr 2018 02:53:57 +0000
with message-id <E1f8Gkn-000Dlh-51@fasolo.debian.org>
and subject line Bug#872577: fixed in debootstrap 1.0.97
has caused the Debian Bug report #872577,
regarding debootstrap: Handle existing /dev
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
872577: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=872577
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: debootstrap
Version: 1.0.89
Severity: normal
Tags: patch

When devices.tar.gz was being used, the devices would be written into
place with tar. This has the effect that the devices would be merged
into an existing /dev in the target. setup_devices_simple() does not
handle this case and fails when /dev already exists.

Normally, the target would be empty and this wouldn't be an issue.
However, some tools that use debootstrap to initialize a target depended
on the old behavior. In particular, the obs-build package used for OBS
sets up a minimal /dev in the generic prep code before using debootstrap
to install packages needed for building debian packages.

The attached patch fixes this by using tar to emulate the old
behavior. It would be really helpful if this could be applied.

Thanks!

--
Dan Nicholson  |  +1.206.437.0833  |  Endless
From d5b723f800c027e0d377627946bc1d697a5be322 Mon Sep 17 00:00:00 2001
From: Dan Nicholson <nicholson@endlessm.com>
Date: Fri, 18 Aug 2017 13:36:27 -0500
Subject: [PATCH] Merge devices to /dev with tar

When devices.tar.gz was being used, the devices would be written into
place with tar. This has the effect that the devices would be merged
into an existing /dev in the target. setup_devices_simple() does not
handle this case and fails when /dev already exists.

Normally, the target would be empty and this wouldn't be an issue.
However, some tools that use debootstrap to initialize a target depended
on the old behavior. In particular, the obs-build package used for OBS
sets up a minimal /dev in the generic prep code before using debootstrap
to install packages needed for building debian packages.

Emulate the old behavior by creating the devices in a temporary
debootstrap/dev and then use tar to write them into place.
---
 functions | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/functions b/functions
index 3cfa0d4..0d99a95 100644
--- a/functions
+++ b/functions
@@ -1163,24 +1163,30 @@ setup_dynamic_devices () {
 
 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.
-	mknod -m 666 $TARGET/dev/null	c 1 3
-	mknod -m 666 $TARGET/dev/zero	c 1 5
-	mknod -m 666 $TARGET/dev/full	c 1 7
-	mknod -m 666 $TARGET/dev/random	c 1 8
-	mknod -m 666 $TARGET/dev/urandom	c 1 9
-	mknod -m 666 $TARGET/dev/tty	c 5 0
-	mkdir $TARGET/dev/pts/ $TARGET/dev/shm/
+	# src/core/cgroup.c in the systemd source tree. The devices are first
+	# created in a temporary /dev and written into place using tar like
+	# the old devices tarball.
+	mkdir $TARGET/debootstrap/dev
+	mknod -m 666 $TARGET/debootstrap/dev/null	c 1 3
+	mknod -m 666 $TARGET/debootstrap/dev/zero	c 1 5
+	mknod -m 666 $TARGET/debootstrap/dev/full	c 1 7
+	mknod -m 666 $TARGET/debootstrap/dev/random	c 1 8
+	mknod -m 666 $TARGET/debootstrap/dev/urandom	c 1 9
+	mknod -m 666 $TARGET/debootstrap/dev/tty	c 5 0
+	mkdir $TARGET/debootstrap/dev/pts/ $TARGET/debootstrap/dev/shm/
 	# Inside a container, we might not be allowed to create /dev/ptmx.
 	# If not, do the next best thing.
-	if ! mknod -m 666 $TARGET/dev/ptmx c 5 2; then
+	if ! mknod -m 666 $TARGET/debootstrap/dev/ptmx c 5 2; then
 		warning MKNOD "Could not create /dev/ptmx, falling back to symlink. This chroot will require /dev/pts mounted with ptmxmode=666"
-		ln -s pts/ptmx $TARGET/dev/ptmx
+		ln -s pts/ptmx $TARGET/debootstrap/dev/ptmx
 	fi
-	ln -s /proc/self/fd   $TARGET/dev/fd
-	ln -s /proc/self/fd/0 $TARGET/dev/stdin
-	ln -s /proc/self/fd/1 $TARGET/dev/stdout
-	ln -s /proc/self/fd/2 $TARGET/dev/stderr
+	ln -s /proc/self/fd   $TARGET/debootstrap/dev/fd
+	ln -s /proc/self/fd/0 $TARGET/debootstrap/dev/stdin
+	ln -s /proc/self/fd/1 $TARGET/debootstrap/dev/stdout
+	ln -s /proc/self/fd/2 $TARGET/debootstrap/dev/stderr
+
+	# Tar the temporary /dev into place to merge with an existing /dev
+	(cd $TARGET/debootstrap; tar -cf - dev) | (cd $TARGET; tar -xf -)
 }
 
 setup_devices_fakechroot () {
-- 
2.11.0


--- End Message ---
--- Begin Message ---
Source: debootstrap
Source-Version: 1.0.97

We believe that the bug you reported is fixed in the latest version of
debootstrap, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 872577@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Hideki Yamane <henrich@debian.org> (supplier of updated debootstrap package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Tue, 17 Apr 2018 11:06:32 +0900
Source: debootstrap
Binary: debootstrap debootstrap-udeb
Architecture: source all
Version: 1.0.97
Distribution: unstable
Urgency: medium
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Hideki Yamane <henrich@debian.org>
Description:
 debootstrap - Bootstrap a basic Debian system
 debootstrap-udeb - Bootstrap the Debian system (udeb)
Closes: 698677 826709 844118 866401 872059 872577 872948 890419 893954 895466
Changes:
 debootstrap (1.0.97) unstable; urgency=medium
 .
   [ Dan Nicholson ]
   * Handle existing /dev (Closes: #872577)
 .
   [ Hideki Yamane ]
   * Create /dev/console as same as previous (Closes: #872059)
   * Do not ignore HTTPS mirror setting (Closes: #893954)
   * Improve manpage "what is calls a Debian base system" (Closes: #872948)
     Thanks to Emmanuel Kasper <manu@debian.org> for the patch
   * Improve error message when download fails (Closes: #866401)
     Thanks to Raphaël Hertzog <hertzog@debian.org> for the patch
   * Use wget --non-verbose option instead of --quiet
   * Improve error message on Release signed by unknown key (Closes: #698677)
   * Add --cache-dir feature (Closes: #844118)
     It is enabled by default and use /var/cache/apt/archives as default value
 .
   [ Adam Borowski ]
   * Use arch-test if installed to check whether second stage is possible.
     (Closes: #826709)
 .
   [ Lubomir Rintel ]
   * Fix boostrapping libvirt LXC containers (Closes: #890419)
 .
   [ Raphaël Hertzog ]
   * Use "command -v apt-config" to check for apt-config's presence
     (Closes: #895466)
   * Drop default value for --cache-dir parameter
   * Forbid the usage of non-empty directories with --print-debs and
     --make-tarball
   * Do not use HTTPS for Kali bootstrap script
Checksums-Sha1:
 dec58e328c8ca5a62ed929cba1323a21d053c960 1991 debootstrap_1.0.97.dsc
 ff4d6b40efebbbf14c33445419e8e264cf4c04c8 71121 debootstrap_1.0.97.tar.gz
 c2d21436e905fc28eb141fd25542c1d1d748f003 20556 debootstrap-udeb_1.0.97_all.udeb
 5eba09250171942f0b7483759285c85c24e82e74 69060 debootstrap_1.0.97_all.deb
 5cf71f8a36c995632a5d7ae31320941c907b56fa 5766 debootstrap_1.0.97_amd64.buildinfo
Checksums-Sha256:
 9b0dc362f97976833c1f148d00933c85a0095525885ad1a6845e81671d4aabdd 1991 debootstrap_1.0.97.dsc
 d3e6bef403dbabade11d098214030d5063c6b238d3751b159f727af7556c5cf0 71121 debootstrap_1.0.97.tar.gz
 b4f377d7e40b5128271dca859d924e79c36fc7d1c86408f91a474ad2c669f6e9 20556 debootstrap-udeb_1.0.97_all.udeb
 0177ffecea5cc1a42084ae02a44d8e902a086577cefc00194b983fd7f3d802a7 69060 debootstrap_1.0.97_all.deb
 c9d57dd2f298f41fd5d56badca0d88898b8797e7b5755db1b62e7b14cf99af02 5766 debootstrap_1.0.97_amd64.buildinfo
Files:
 355d536a46a764b9f798e977ffdf0acf 1991 admin optional debootstrap_1.0.97.dsc
 856379c44f4cec4be4071a91e061aafd 71121 admin optional debootstrap_1.0.97.tar.gz
 11ae2cd66f0ec42d94edda0a876fcb5a 20556 debian-installer optional debootstrap-udeb_1.0.97_all.udeb
 e1844d1cfb966c00101048bb9285f002 69060 admin optional debootstrap_1.0.97_all.deb
 e1d959b6ca11fbca1d18a15bb9403248 5766 admin optional debootstrap_1.0.97_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJHBAEBCgAxFiEEWOEiL5aWyIWjzRBMXTKNCCqqsUAFAlrVWFQTHGhlbnJpY2hA
ZGViaWFuLm9yZwAKCRBdMo0IKqqxQC1GD/9n8XmploJvPpi6CI0uFgBAwAHXOHZN
VRfdq/LmZBisF1Dw3cg1sPTy3JltrjCQjeVXOdPC5syz0ap5mJVKi6CdO8Yo+21+
dKqvb9WZOCJjQFVRoS7l/Vzto1wXwI80ylH5CNCNOmJnw7WLiKZZ8cKN+mh3CA4S
6iXZymu6Wz7BRaQa2LWVrpq/ygJpmqyt/tdzsFh5s621vEcsTUnxEokHoW9abzVF
FzWt9Dc8Ipn5iv+HeMdsQctwcWIbytfcchHLPlajeVP7alD7vFvQxan7jEFON4Tn
RRzkCfl7UKZHMHwrxYhchGYFg/c9qGM4sNu4wi6Aqo7KfogGhM/yXiSAcm4x6KZh
/nZ88IvuxRbqm7SfUOaw0eTby4d5L01PkMUopwFTLgg1YkaPe3eJhYnmzMHE1yEC
pIo0cwZHB64I5UwK4/1EtG4sy27M4dSVyuHXAMMUKv39AxUiZShAM6kttmGzoDUc
8opGN6Ip1RiX62SExZFEQQUMoA0ByR96U8vZUFAcwHEPyI+iW4nnFkNEhasWtDBY
u9EbhGNmVKUGbywoyuF//FYyrXPF2LuCNHIA/0zwhjd5U8Jytx+U+gfOa8DC6k5O
tpej8BjuI+Ob/8Kr0+dg6uJ0MnU/7gtHjJCMQ+GMwRr8mPT2tsa+rftTOVVShQym
czgQ2K/mIbhlFw==
=caYw
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: