packages icon indicating copy to clipboard operation
packages copied to clipboard

dockerd: build failed

Open Signout-123 opened this issue 3 months ago • 10 comments

Package Name

dockerd

Maintainer

@G-M0N3Y-2503

OpenWrt Version

25.12

OpenWrt Target/Subtarget

x86_64

Steps to Reproduce

build dockerd

Actual Behaviour

error log:

Building static bundles/binary-daemon/dockerd (linux/amd64)...
Created binary: bundles/binary-daemon/dockerd
Copying nested executables into bundles/binary-daemon
cp: cannot stat '': No such file or directory
make[3]: *** [Makefile:195: /home/ubuntu/openwrt/build_dir/target-x86_64_musl/dockerd-29.6.1/.built] Error 1
ERROR: package/feeds/packages/utils/dockerd failed to build.

Confirmation Checklist

  • [x] The package is maintained in this repository.
  • [x] I understand that issues related to the base OpenWrt repository or LuCI repository will be closed.
  • [x] I am reporting an issue for OpenWrt, not an unsupported fork.

Signout-123 avatar Aug 22 '26 05:08 Signout-123

This PR https://github.com/openwrt/packages/pull/30288 fixed, but why closed?

Signout-123 avatar Aug 22 '26 05:08 Signout-123

Very good question. As for why it was closed, since you mentioned the link to the closed pull request, I think you can also find the relevant information there explaining what happened and why. In any case, as was mentioned there, more details need to be provided. Thanks for your cooperation.

BKPepe avatar Aug 22 '26 06:08 BKPepe

I referenced https://github.com/openwrt/packages/pull/30288#issuecomment-5369613597, and after running "mv /usr/local/bin/runc /usr/local/bin/runc.bak" and then rebuilding, everything worked fine. It's clear that there's an issue in https://github.com/moby/moby/blob/b612274c5489b546ff8b4a4f93f25a0b8952713a/hack/make/binary-daemon#L13-L19, and this patch clearly resolves the issue effectively.

The issue clearly only occurs when "/usr/local/bin/runc" exists and is executable, because the subsequent "command -v" fails to find those files that OpenWrt doesn't actually need, causing the error.

Since that PR was closed, is there a better way to solve this issue?

Signout-123 avatar Aug 22 '26 06:08 Signout-123

I think you incorrectly closed a PR that correctly fixes this error. As @G-M0N3Y-2503 said in https://github.com/openwrt/packages/pull/30288#issuecomment-5369938235, this is the way to solve it. Also, I looked at the history of binary-daemon, and it's clearly a file that gets updated very infrequently (the last change was 4 months ago), so the so-called maintenance cost is almost nonexistent.

Signout-123 avatar Aug 22 '26 07:08 Signout-123

For some reason beyond me these programs should be in the PATH, I'm guessing the go build system promotes the built binaries to the PATH. However, the package depends on runc so this shouldn't be a problem if that's the case. So the best questions is why is it a problem? The question that PR answers is how can we avoid that question with the least collateral.

G-M0N3Y-2503 avatar Aug 23 '26 04:08 G-M0N3Y-2503

Your understanding is incorrect. It is clear that "binary-daemon" is attempting to copy these files from the system PATH (like "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"). For instance, containerd is a standalone file unrelated to the dockerd package and cannot possibly be generated when compiling dockerd.

Ref https://github.com/moby/moby/blob/b985e2313a8676e18072b442911fc8f64f17d440/hack/make/binary-daemon#L7-L9 This also indicates that copying is only executed when the native OS/ARCH matches the OS/ARCH of the build target, meaning these are definitely not files generated by golang.

Due to flaws in the binary-daemon code, the author assumed that as long as "/usr/local/bin/runc" exists and is executable, those files ("containerd containerd-shim-runc-v2 ctr runc docker-init rootlesskit dockerd-rootless.sh dockerd-rootless-setuptool.sh") must also exist on the system. The code fails to account for the possibility that cp might throw an error if one or more of these files cannot be found.

Signout-123 avatar Aug 23 '26 06:08 Signout-123

I reproduced this separately, and what @Signout-123 described matches the code path.

The dockerd binary is built successfully. The failure happens afterward, when Moby's hack/make/binary-daemon script tries to copy additional executables from the build host into the output directory.

openwrt package dependencies such as containerd and runc are built for the target device. They do not make those commands available in the build host's $PATH.

The failure happens when the host and target architectures match, /usr/local/bin/runc exists, and at least one of the other executables expected by Moby is missing. The script receives an empty path from command -v and passes it to cp.

I opened an upstream Moby issue:

https://github.com/moby/moby/issues/53442

While this is being handled upstream, I think a small downstream patch could still be useful (what do maintainers think?) . It could verify that all the expected executables are available before starting the optional copy step. If the set is incomplete, the script could skip that step with a useful message.

the patch could be removed after we get a new fix from upstream.

dhrm1k avatar Aug 23 '26 07:08 dhrm1k

Just use https://github.com/openwrt/packages/pull/30288 directly. These copied files aren't needed by OpenWrt anyway. Once upstream updates then remove the patch.

Signout-123 avatar Aug 23 '26 07:08 Signout-123

@BKPepe @G-M0N3Y-2503 So, before this error is fixed upstream, could add a patch to fix it?

Signout-123 avatar Aug 29 '26 09:08 Signout-123

If there is a patch submitted upstream, it has been allowed before while it is in review, I'm not sure if that is still the case. I think the idea was that when it is merged or rejected it's removed from this repo. The patch would be referenced by a URL at that point though, not a file in this repo.

G-M0N3Y-2503 avatar Sep 06 '26 00:09 G-M0N3Y-2503