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

Bug#741964: debootstrap: --variant=fakechroot and --foreign



Package: debootstrap
Version: 1.0.59
Severity: minor
Tags: patch

Dear Maintainer,

Using option foreign with the variant fakechroot fails at the second stage with an error :
$ fakechroot fakeroot -s .fakeroot.state debootstrap --variant=fakechroot --foreign jessie my_chroot
$ fakechroot fakeroot -i .fakeroot.state -s .fakeroot.state chroot my_chroot /debootstrap/debootstrap --second-stage
$ echo $?
1
$ cat my_chroot/debootstrap/debootstrap.log
gpgv: Signature made Sat Mar 15 08:55:54 2014 UTC using RSA key ID 46925553
gpgv: Good signature from "Debian Archive Automatic Signing Key (7.0/wheezy) <ftpmaster@debian.org>"
ln: failed to create symbolic link '/dev': File exists

>From the error message : the unpriviledged user is not allowed to replace /proc or /dev. After a chroot
command, fakechroot diverts access to /dev, /proc or /sys to the corresponding directories under the real root
(ie /dev, /sys and /proc on the host). The error occurs at second_stage_install in functions setup_devices and
setup_proc_fakechroot (file /usr/share/debootstrap/scripts/sid lines 61 and 69, and file
/usr/share/debootstrap/functions lines 913 and 949)

In this case, it would be better to set up proc and the devices before invoking chroot ie at the first stage.

The following patch partially revert commit d3518b9c7e4f693562d99ec4c15bb009b456603b in version 1.0.34 (see also [1]). Then
fakechroot fakeroot -s .fakeroot.state debootstrap --variant=fakechroot --foreign jessie my_chroot
fakechroot fakeroot -i .fakeroot.state -s .fakeroot.state chroot my_chroot /debootstrap/debootstrap --second-stage
...
I: Base system installed successfully.
moi@debirf-dominicain:~$ echo $?
0

Thank you for your comments or corrections !

Regards,
JH Chatenet

[1] : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=498731#25

*** rustine-second-stage.patch
diff -Naur a/usr/share/debootstrap/scripts/sid b/usr/share/debootstrap/scripts/sid
--- a/usr/share/debootstrap/scripts/sid 2014-03-13 20:30:32.000000000 +0100
+++ b/usr/share/debootstrap/scripts/sid 2014-03-13 21:19:21.000000000 +0100
@@ -70,10 +70,17 @@
        }
 
        x_feign_install dpkg
+
+       if doing_variant fakechroot; then
+               setup_proc_fakechroot
+               setup_devices_fakechroot
+       fi
 }
 
 second_stage_install () {
-       setup_devices
+       if ! doing_variant fakechroot; then
+               setup_devices
+       fi
 
        x_core_install () {
                smallyes '' | in_target dpkg --force-depends --install $(debfor "$@")
@@ -84,7 +91,7 @@
        }
 
        if doing_variant fakechroot; then
-               setup_proc_fakechroot
+               true
        elif doing_variant scratchbox; then
                true
        else

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages debootstrap depends on:
ii  wget  1.15-1

Versions of packages debootstrap recommends:
ii  debian-archive-keyring  2012.4
ii  gnupg                   1.4.16-1.1

debootstrap suggests no packages.

-- no debconf information


Reply to: