Open alekseysidorov opened 7 months ago
Cant see a reason why it would not be readable
https://github.com/bminor/musl/blob/f314e133929b6379eccc632bef32eaebb66a7335/Makefile#L161-L163
https://github.com/bminor/musl/blob/f314e133929b6379eccc632bef32eaebb66a7335/Makefile#L194-L195
https://github.com/bminor/musl/blob/f314e133929b6379eccc632bef32eaebb66a7335/Makefile#L212-L213
I see similar results on an m3 mac with a fresh nix-darwin install using the same docker.nix
> nix-shell -p nix-info --run "nix-info -m"
- system: `"aarch64-darwin"`
- host os: `Darwin 23.2.0, macOS 14.2.1`
- multi-user?: `yes`
- sandbox: `no`
- version: `nix-env (Nix) 2.18.1`
- channels(root): `"nixpkgs"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
ends up with
...
building '/nix/store/gqhknrkiwdvbrka712hbm5d1zl5jpnap-hello-conf.json.drv'...
{
"architecture": "amd64",
"config": {
"Cmd": [
"hello"
],
"WorkingDir": "/"
},
"os": "linux",
"store_dir": "/nix/store",
"from_image": null,
"store_layers": [
[
"/nix/store/wg3p6wqlkg4nm3pj9mmmp7c8860awqsr-musl-x86_64-unknown-linux-musl-1.2.3"
],
[
"/nix/store/zjnypljflfvfdvn5hlka1ip5w80jkd89-hello-x86_64-unknown-linux-musl-2.12.1"
]
],
"customisation_layer": "/nix/store/wl1g5byz0ajzlhp3x35yq55l0dzx37c5-hello-customisation-layer",
"repo_tag": "hello:y582mjjbsza2136d1hm8d4py9djan9cc",
"created": "1970-01-01T00:00:01+00:00"
}
building '/nix/store/jhxkxrc6jly3z32lqdz7qynqbanij1jz-stream-hello.drv'...
building '/nix/store/5i2bgdkbh1plh88bp2b22kqksl7rwpgw-hello.tar.gz.drv'...
No 'fromImage' provided
Creating layer 1 from paths: ['/nix/store/wg3p6wqlkg4nm3pj9mmmp7c8860awqsr-musl-x86_64-unknown-linux-musl-1.2.3']
Traceback (most recent call last):
File "/nix/store/45kjnc5bdy11p9y5j00a8vjbbknnglnj-stream", line 392, in <module>
main()
File "/nix/store/45kjnc5bdy11p9y5j00a8vjbbknnglnj-stream", line 340, in main
info = add_layer_dir(tar, store_layer, store_dir, mtime=mtime)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/45kjnc5bdy11p9y5j00a8vjbbknnglnj-stream", line 232, in add_layer_dir
archive_paths_to(
File "/nix/store/45kjnc5bdy11p9y5j00a8vjbbknnglnj-stream", line 94, in archive_paths_to
ti = append_root(tar.gettarinfo(filename))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/z0nnwdh4p692yvf3qgwgj3bn78w99q6y-python3-3.11.6/lib/python3.11/tarfile.py", line 2065, in gettarinfo
linkname = os.readlink(name)
^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/nix/store/wg3p6wqlkg4nm3pj9mmmp7c8860awqsr-musl-x86_64-unknown-linux-musl-1.2.3/lib/ld-musl-x86_64.so.1'
error: builder for '/nix/store/5i2bgdkbh1plh88bp2b22kqksl7rwpgw-hello.tar.gz.drv' failed with exit code 1;
last 10 log lines:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "/nix/store/45kjnc5bdy11p9y5j00a8vjbbknnglnj-stream", line 232, in add_layer_dir
> archive_paths_to(
> File "/nix/store/45kjnc5bdy11p9y5j00a8vjbbknnglnj-stream", line 94, in archive_paths_to
> ti = append_root(tar.gettarinfo(filename))
> ^^^^^^^^^^^^^^^^^^^^^^^^
> File "/nix/store/z0nnwdh4p692yvf3qgwgj3bn78w99q6y-python3-3.11.6/lib/python3.11/tarfile.py", line 2065, in gettarinfo
> linkname = os.readlink(name)
> ^^^^^^^^^^^^^^^^^
> PermissionError: [Errno 13] Permission denied: '/nix/store/wg3p6wqlkg4nm3pj9mmmp7c8860awqsr-musl-x86_64-unknown-linux-musl-1.2.3/lib/ld-musl-x86_64.so.1'
For full logs, run 'nix log /nix/store/5i2bgdkbh1plh88bp2b22kqksl7rwpgw-hello.tar.gz.drv'.
(Edit: The slightly different example from nix.dev also fails with the same error, after replacing pkgsLinux.hello
with pkgs.pkgsCross.musl64.hello
)
Here's a great writeup by Tim Cuthbertson including a patch -- essentially, cross-compiling a linux package on darwin means that it uses a darwin filesystem, meaning that symlinks have their own permission modes and are affected by umask
.
Steps To Reproduce
When I try to build a simple Docker image on Apple Silicon hardware I get errors like this.
Here is the
docker.nix
file content which I used to build image.Additional context
I found a patch that fixes my problem, but I have to use the patched nixpkgs to fix dockerTools.
Metadata