Using the --foreign option with the debootstrap script should install several architecture specific files into /TARGETDIR/debootstrap, but it does not. The reason is, that the script tries to copy a file called devices.tar.gz from /usr/local/share/debootstrap, which does not exist. Since the script uses "set -e", at this point it silently fails. The next part (chroot into /TARGETDIR and calling /debootstrap/debootstrap --second-stage) FAILS because of missing files. Note that while a broken --foreign/--second-stage installation in a chroot itself does not necessarily qualify as a critical bug, currently and unrelated to this report and patch, the 'normal' installation is broken as well right now, so that --foreign/--second-stage installations are the only way to install a debian chroot... Right now, as is in ports, debootstrap is of little use. Also the fix just removes the line which tries to copy the devices.tar.gz file. This is a freebsd specific patch not made to go upstream. If upstream wants to fix the issue, one would have to find our which architectures besides Linux need devices.tar.gz (hurd?) and wrap the copying in a conditional. Fix: Apply patch to ports svn checkout (in directory: sysutils/debootstrap). root$ cd /usr/ports/sysutils/debootstrap root$ make deinstall reinstall clean Patch attached with submission follows: How-To-Repeat: root$ kldload tmpfs root$ mkdir /debian root$ debootstrap --foreign wheezy http://cdn.debian.net/debian root$ echo $? # note the erro code 1 ! root$ mount -t devfs devfs /debian/dev root$ mount -t linprocfs linprocfs /debian/proc root$ mount -t linsysfs linsysfs /debian/sys root$ chroot /debian /bin/bash root$ /debootstrap/debootstrap --second-stage # fails due to missing files
Responsible Changed From-To: freebsd-ports-bugs->mm Over to maintainer (via the GNATS Auto Assign Tool)
Created attachment 145489 [details] debootstrap - fix --foreign and add Perl dependency Please use this patch instead.
I'm the maintainer for sysutils/debootstrap now. Please use this patch: it fixes --foreign as proposed by the originator, rebased on the latest port version, and adds an easy to miss Perl runtime dependency (debootstrap uses Perl to process package lists) to spare an extra revision bump. I can't reproduce the native bootstrap not working. Can you try it again with the latest port version or provide steps to reproduce?
Created attachment 145496 [details] debootstrap fixes Please use this patch instead. In addition to the previous one, it fixes HOST_ARCH detection if dpkg is installed. This was pointed out by Andrzej Tobola in a private email.
Created attachment 145497 [details] debootstrap fixes On a second thought, since some scripts require dpkg, just depend on it. sysutils/debootstrap should have depended on it all along. So, issues addressed so far: o Add a runtime dependency on Perl o Fix --foreign bootstrap o Fix HOST_ARCH detection with dpkg o Add a runtime dependency on dpkg
A commit references this bug: Author: wg Date: Fri Aug 8 01:26:32 UTC 2014 New revision: 364336 URL: http://svnweb.freebsd.org/changeset/ports/364336 Log: sysutils/debootstrap: runtime fixes - Add a runtime dependency on Perl - Fix --foreign bootstrap - Fix HOST_ARCH detection with dpkg - Add a runtime dependency on dpkg PR: 179766 Submitted by: maintainer Changes: head/sysutils/debootstrap/Makefile head/sysutils/debootstrap/files/patch-debootstrap
Still two minor corrections are necessary for a simple usage test case: sudo debootstrap wheezy /tmp/debian and not anylyzing it deeply: % diff debootstrap* 402c402 < HOST_ARCH=`/usr/bin/dpkg --print-architecture` --- > HOST_ARCH=k`/usr/local/bin/dpkg --print-architecture` # freebsd -> kfreebsd % diff /usr/local/share/debootstrap/functions* 83c83 < wget $QSWITCH "$@" --- > wget --no-check-certificate $QSWITCH "$@" -a
Are a new Ubuntu wariants expected to work ? % sudo debootstrap trusty /tmp/trusty I: Keyring file not available at /usr/share/keyrings/ubuntu-archive-keyring.gpg; switching to https mirror https://mirrors.kernel.org/debian I: Retrieving Release E: Failed getting release file https://mirrors.kernel.org/debian/dists/trusty/Release (1) % sudo debootstrap utopic /tmp/trusty I: Keyring file not available at /usr/share/keyrings/ubuntu-archive-keyring.gpg; switching to https mirror https://mirrors.kernel.org/debian I: Retrieving Release E: Failed getting release file https://mirrors.kernel.org/debian/dists/utopic/Release (1) -a
I'd rather not force wget to ignore certificates. The user should teach wget to validate certificates or use http:// URIs. Debootstrap program prefers https:// on default and expects wget to be configured to work with it. To debootstrap wheezy (native kfreebsd, works well): # debootstrap wheezy ./wheezy http://ftp.us.debian.org/debian Ubuntu doesn't have a kfreebsd version (and doesn't live on Debian mirrors). You can do the first stage of a foreign bootstrap for this, but you will need to boot an actual Linux kernel to finish the installation. You won't be able to use the Linux emulation layer to finish something like this: # debootstrap --foreign --arch=i386 trusty ./trusty http://archive.ubuntu.com/ubuntu
To configure wget to handle https://, first install ca_root_nss package, and then add ca_certificate=/usr/local/share/certs/ca-root-nss.crt to your .wgetrc.