Unable to apt-get install from hook? #39
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I have had issues with running native
apt-get
to install packages from hooks, and I have workarounded it by runningapt-get
fromchroot
. However, I just found out that Debian 11 essential rootfs cannot handle https apt repos. This results in a build failure, and the necessary package (ca-certificates
) now has to be installed from outside.Here is what I defined in my jsonnet template:
which got garbled by bdebstrap as:
The resulting execution makes me feel like it is trying to install to my Ubuntu host environment:
My host arch is x86-64, and I'm trying to build for arm64, which might be why dpkg is not providing very helpful error messages. Usually it will tell you the reason for "dependency problems prevent configuration".
I have configured binfmt to run cross platform binaries, and mmdebstrap worked for all other tasks (including cross compiling dkms modules using native arm64 gcc), so I'm really out of idea why this happens.
Uff... there are multiple things to unpack here...
apt-transport-https
as that is provided byapt
since apt 1.5, so this is even unnecessary in old-old-stable (buster)--include
option? The mmdebstrap man page says this:Thanks for your prompt reply. It was pretty late last night so I figure I would just describe my immediate symptom first (unable to apt-get from hook) in case I missed something obvious.
Fair point. But in this case I think bdebstrap correctly transformed my input to mmdebstrap command invocation, The log output from mmdebstrap also looks like it is trying to do what I specified, but failed unexpectedly.
This is a leftover from our previous source code. I double checked the oldest Ubuntu release we might need to support and it is not needed anymore. Thanks.
Yes I am. I also plan to package mmdebstrap for NixOS which the last time I tried I can only get root mode working, so this is what I'm sticking with for now. Ultimate plan is to support our system builder running on NixOS natively.
Understand. We just have to use it to install stupid Ubuntu zstd packages. I saw in another issue that a user has a wrapper for this, so we might reconsider this when we encounter other Ubuntu induced issues.
It was late so I only had the relevant code snippets around the apt-get invocation. I'll try prepare something for you today on Debian.
bdepstrap generated YAML is in my opinion formatted in the wrong style. The resulting file is hard to read which is why I did not include it. I plan to make a PR with them today.
Here is the generated config.yaml in case you want to know how bad it is. I do not expect you to troubleshoot this file though.
We have our dkms source packaged as debs. Our current issue is that they are not installed directly but as Recommends of another metapackages, and installation is controlled by
--no-install-recommends
|--install-recommends
from mmdebstrap hooks. But as we cannot run apt-get the normal way (the reason we opened this issue), we have to chroot to install in slow mode.It is slow but it is not blocking, since we currently use go-debos and I believe that's the only way for it to build dkms. I'm not touching that package dependency for now since our existing code is still using it. In the future once we fully switch to mmdebstrap (via bdebsrap) we will definitely check if we can just
--include
them in a separate package to get additional build speed increase.bdebstrap does translate that into
--include
. The issue is that it is not an essential package, and I want to use apt-get in essential-hooks. We use apt variant, so apt-get is available at that stage, but not ca-certificates.I'll check if I can get some reproducible demo for you today. It is my last work day before Chinese New Year though, so if I can't get it done today I will be back in 2 weeks.
Well... in your initial report you also did not state which version of mmdebstrap you are working with. This is rather essential for a bug report, no? If your version of mmdebstrap is older than 1.4.1, then you also need to include this apt option when trying to run apt from outside the chroot:
-oDPkg::Chroot-Directory="$1"
so the complete call looks like this:There is a test-case which runs this, so this is supposed to work and tested to work.
I'm not sure whether this can work.
mmdebstrap
is not designed on distributions that do not use apt as their package manager. But maybe it will work with only minimal changes. Please open an issue if you run into problems.Reading the diff it strikes me as odd that you tried fakechroot mode? I don't think this can ever work on nixos as the libraries used outside and inside the chroot (first and foremost glibc itself) will be utterly incompatible.
I would also like to discourage you from using root mode. The code that is run as part of the creation of a chroot can be utterly dangerous for your host system. There are debootstrap bugs where users got their whole $HOME wiped when running it. One of the main reasons for using mmdebstrap over debootstrap is that the former does not require superuser privileges. Please have a look at the unshare mode which uses linux user namespaces to avoid ever becoming the superuser. This will make sure that it does not damage your system. Even fakechroot mode can wipe your $HOME. Unshare mode cannot. Please try and see if you can make that work on NixOS.
The latest Ubuntu induced issue is, that they removed the usrmerge package so by default, Ubuntu chroots are now not using merged-/usr again. This is a bug in Ubuntu that mmdebstrap cannot fix and it's not the first such bug. The zstd mess is another example. I'd recommend against using Ubuntu with mmdebstrap.
I have a couple of comments for that one. Are you doing this work for your work at a company or as your hobby in your free time?
In that case: happy new year celebration! I'm looking forward to your reply.
Thanks. This is exactly the issue.
FYI this is the mmdebstrap version some common distros are shipping:
So some clarification might be helpful to discover this (common?) usage, since most of users are likely on outdated versions for quite some time.
The hint I was getting is from the man's OPERATION section, where apt-get seemingly works with only APT_CONFIG exported and no magic arguments is needed.
It is my fault to assume a download-only apt-get call works the same for one that needs to also configure the package, but I hope you can see why I was confused when I was expecting the command to just work.
There are some standing issues with running apt on NixOS that I fixed on that PR.
I basically tested all supported modes since I really don't want to use the root mode for obvious reasons.
I do intend to get unshare to work eventually, but getting root mode to work at least clears me to package bdebstrap for NixOS, and run our system builder on it.
Do you mean the generated rootfs for Ubuntu is broken due to missing usrmerge right? I don't quite understand how Ubuntu host will have impact in a Debian chroot environment.
Yes this is for a work project. I want to use jsonnet+bdebstrap+mmdebstrap & libguestfs to replace our current go-debos based solution.
The main reason is that go-debos does not fully support ARM64 due to its fakemachine dependency, while we produce primarily ARM64 products, and customers want to build systems natively.
We also look to support RISC-V systems in the future, and Debian Wiki recommends this project, which is why I did not go straight with debootstrap (which I have considered quite a few times when working with go-debos).
Right now the new project is not announced, and is aiming to be a direct translation of the old project, which is a big hack by itself. If you have any suggestions I'm more than happy to hear it.
You can contact me directly via yt@radxa.com if here is not an appropriate place for that kind of discussion. GitHub issues within our repos are also welcome if you want to keep it open.
As the original issue is now resolved (due to missing argument). I'll also close this issue to reduce the noise from issue list.