Hi Santiago, Quoting Santiago Vila (2025-03-16 14:27:38) > Hi. When building packages for bookworm I see this in the build log, which > was not shown before: > > E: Failed to execute “dpkg-buildtree”: No such file or directory > > Then there is a step called "Install fakeroot" which does nothing > because I already had fakeroot installed. > > Apparently dpkg-buildtree is tried first and then fakeroot is installed after > checking that it was not available, so it would seem that the error message > is not a "real" error. I wonder if it would be possible to check for > “dpkg-buildtree” in a more silent way. > > Or maybe such new algorithm could be applied only if dpkg >= some-version. > > (Manpage says dpkg-buildtree was introduced in dpkg 1.22.3 and is-rootless > was introduced in dpkg 1.22.1).
I agree with your analysis. In 8b576d787da20e153a87714f82be811984ea317f (since sbuild 0.88.3), Jochen added get_dpkg_version() which we can use for this. In 08b79ae42305366e61daa18300a9adc96bcc95fe (since sbuild 0.88.4), Jochen added another invocation of "dpkg-buildtree is-rootless" but guarded it by a version check and only executes it for dpkg >= 1.22.12. We can do the same for the other invocation of "dpkg-buildtree is-rootless" to avoid this confusing line in the log. > While we are at it: Given that sbuild now seems to install fakeroot when it's > required to build the package (i.e. I guess that when the package has > "rules-requires-root: binary-targets"), can I consider a serious bug if the > package tries to use fakeroot explicitly without a build-depends? I think it depends. If we have a package that R³:binary-targets then it declares that it has to be built as the root user to produce valid artifacts. sbuild does not build packages as root. To still produce correct output, in the past it always and unconditionally installed the fakeroot package and then ran the build inside fakeroot. The installation of fakeroot is a requirement that comes from how sbuild builds packages: as the non-root user. If sbuild were building packages as the root user, it would not need to install fakeroot. With that argument, adding fakeroot to the Build-Depends does not make sense (and its absence is not an RC bug) because the package can be built just fine without fakeroot: you just have to become the (possibly unshared) root user. The absence of fakeroot as a proper build dependency causes problems for the reproducible-builds project. We want to be able to reproduce packages from the past but we cannot really reproduce the build environment because the version of fakeroot that got installed by sbuild does not end up in the buildinfo file. This means, that packages that need root privileges and without R³:binary-targets (as it was in the past) will fail to reproduce. We discussed with Guillem whether it would make sense to add fakeroot to the buildinfo file to make reproducing packages easier. We decided against doing that because we already switched the R³ default in dpkg and Niels filed all bugs for packages that do not R³:binary-targets and is actively working on reducing the number of R³:binary-targets packages, for example through his work on debputy. So hopefully with Forky we will reach a state where fakeroot becomes a thing of the past for good. We still have the problem of reproducing packages from the past though as we do not know the fakeroot version that was used. In commit 08b79ae42305366e61daa18300a9adc96bcc95fe (since sbuild 0.88.4) Jochen implemented the BUILD_AS_ROOT_WHEN_NEEDED option for sbuild. That option is 0 by default but if you set it to 1 (as it is done by debrebuild) then sbuild will run the build as root if necessary and thus avoid the need for fakeroot. I hope this answers your questions? Thanks! cheers, josch
signature.asc
Description: signature