Bug 1654765

Summary: chroot: failed to run command './debootstrap/debootstrap': No such file or directory
Product: [Fedora] Fedora Reporter: Laurent Vivier <laurent>
Component: debootstrapAssignee: Sergio Basto <sergio>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 32CC: lkundrak, oron, sergio
Target Milestone: ---Keywords: Patch, Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: debootstrap-1.0.109-3.fc29 debootstrap-1.0.109-3.fc28 debootstrap-1.0.123-1.fc32 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-06-01 01:23:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Laurent Vivier 2018-11-29 15:56:35 UTC
Description of problem:

"debootstrap --second-stage" cannot start because deboostrap shebang "#!/bin/sh" has been changed to "#!/usr/bin/sh" and this path is not valid inside the chroot previously installed by "debootstrap --foreign".

Version-Release number of selected component (if applicable):

debootstrap-1.0.109-2.fc29.noarch

How reproducible:

100%

Steps to Reproduce:
1. sudo debootstrap --arch=i386 --foreign --variant=minbase --no-check-gpg \
                    stretch i386-base
2. sudo chroot i386-base debootstrap/debootstrap --second-stage

Actual results:

chroot: failed to run command 'debootstrap/debootstrap': No such file or directory

Expected results:

I: Installing core packages...
I: Unpacking required packages...
I: Unpacking libacl1:i386...
I: Unpacking libattr1:i386...
I: Unpacking libaudit-common...
I: Unpacking libaudit1:i386...
I: Unpacking base-files...
I: Unpacking base-passwd...
I: Unpacking bash...
I: Unpacking libbz2-1.0:i386...
I: Unpacking libdebconfclient0:i386...
...
I: Configuring the base system...
I: Configuring gpgv...
I: Configuring debian-archive-keyring...
I: Configuring libstdc++6:i386...
I: Configuring adduser...
I: Configuring libapt-pkg5.0:i386...
I: Configuring apt...
I: Configuring libc-bin...
I: Base system installed successfully.

Additional info:

if I edit i386-base/debootstrap/debootstrap to replace "#!/usr/bin/sh" by "#!/bin/sh" it works.

I've checked the content of debootstrap_1.0.109.tar.gz and debootstrap uses the good shebang.

The path is changed during the rpmbuild install phase:

Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.OcJ9Al
...
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
mangling shebang in /usr/sbin/debootstrap from /bin/sh to #!/usr/bin/sh
Processing files: debootstrap-1.0.109-2.fc29.noarch

Comment 1 Laurent Vivier 2018-11-29 16:03:48 UTC
This patch fixes the problem:

diff --git a/debootstrap.spec b/debootstrap.spec
index 3b5ebfd..324a327 100644
--- a/debootstrap.spec
+++ b/debootstrap.spec
@@ -23,6 +23,8 @@ Recommends:     ubu-keyring
 Recommends:     debian-keyring
 %endif

+%global __brp_mangle_shebangs_exclude /bin/sh
+
 %description
 debootstrap is used to create a Debian base system from scratch, without
 requiring the availability of dpkg or apt.  It does this by downloading

Comment 2 Sergio Basto 2018-11-29 16:07:44 UTC
(In reply to Laurent Vivier from comment #1)
> This patch fixes the problem:
> 
> diff --git a/debootstrap.spec b/debootstrap.spec
> index 3b5ebfd..324a327 100644
> --- a/debootstrap.spec
> +++ b/debootstrap.spec
> @@ -23,6 +23,8 @@ Recommends:     ubu-keyring
>  Recommends:     debian-keyring
>  %endif
> 
> +%global __brp_mangle_shebangs_exclude /bin/sh
> +
>  %description
>  debootstrap is used to create a Debian base system from scratch, without
>  requiring the availability of dpkg or apt.  It does this by downloading

Thanks for the patch , that is what I need . 
I will apply it soon as possible (maybe this weekend) 

Thanks for the report also :)

Comment 3 Fedora Update System 2018-12-01 22:36:44 UTC
debootstrap-1.0.109-3.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-2dee2f3447

Comment 4 Fedora Update System 2018-12-01 22:37:17 UTC
debootstrap-1.0.109-3.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-6906464d45

Comment 5 Fedora Update System 2018-12-02 07:54:36 UTC
debootstrap-1.0.109-3.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-6906464d45

Comment 6 Fedora Update System 2018-12-02 10:10:27 UTC
debootstrap-1.0.109-3.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-2dee2f3447

Comment 7 Laurent Vivier 2018-12-02 11:39:19 UTC
I've tested the package from koji and it works fine for me.

https://koji.fedoraproject.org/koji/buildinfo?buildID=1168303

Comment 8 Fedora Update System 2018-12-21 19:39:16 UTC
debootstrap-1.0.109-3.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2018-12-27 01:50:46 UTC
debootstrap-1.0.109-3.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Laurent Vivier 2020-05-02 15:42:55 UTC
This was fixed in Fedora 31, but happens again in Fedora 32 (1.0.119-1.fc32)

Comment 11 Fedora Update System 2020-05-23 03:31:23 UTC
FEDORA-2020-1afb7f4ed5 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-1afb7f4ed5

Comment 12 Fedora Update System 2020-05-24 04:48:56 UTC
FEDORA-2020-1afb7f4ed5 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-1afb7f4ed5`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-1afb7f4ed5

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2020-06-01 01:23:53 UTC
FEDORA-2020-1afb7f4ed5 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.