Skip to content

Conversation

@imjasonh
Copy link
Member

The changes to MELANGE and MELANGE_DIR are almost certainly incorrect, but they unblocked me from getting a build going.

That build still fails with a bwrap error though, so there's probably more left to do.

Feel free to ignore this until after any large higher-priority events are behind us. 😄

@imjasonh imjasonh requested a review from kaniini September 21, 2022 20:30
MELANGE_DIR ?= ../melange
MELANGE ?= ${MELANGE_DIR}/melange
MELANGE ?= $(shell which melange)
MELANGE_DIR ?= /usr/share/melange
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probe for this, because on my desktop setup, it really is ../melange.

--workdir=/work \
--rm -it \
--entrypoint=sh \
--platform=linux/amd64 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW I was getting a bwrap error too, bwrap: Creating new namespace failed: Invalid argument

With the help of @amouat we figured I needed to use --platform linux/arm64. Not sure if that's the same issue you had.

Maybe we could use --platform=linux/${ARCH} ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm on an M1 mac (it sounds like you are too?).

If I run this with --platform=linux/arm64 I get:

Sep 23 12:43:17.010 [DEBUG] [arch:aarch64] [cmd:apk] [use-proot:false] [use-qemu:] fetch https://packages.wolfi.dev/bootstrap/stage3/aarch64/APKINDEX.tar.gz
Sep 23 12:43:17.201 [DEBUG] [arch:aarch64] [cmd:apk] [use-proot:false] [use-qemu:] WARNING: Ignoring https://packages.wolfi.dev/bootstrap/stage3: No such file or directory

Because Wolfi packages aren't currently built for arm64 yet.

If I run this with --platform=linux/amd64 I get further, but fail with bwrap:

2022/09/23 12:48:25 melange (gmp/x86_64): bwrap: Creating new namespace failed: Invalid argument

If I use an x86_64 machine and --platform=linux/amd64 I get past the bwrap error and can actually build, so I think it's an issue with using Docker-for-M1's emulation layer.

If a generalized dev container isn't possible, we should document what's necessary (an x86_64 machine, what tools, etc.), and I'll get one of those instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is a pain.

I'm pretty sure it is an emulation thing. I'm not sure if it's 2x QEMU or rosetta & QEMU, but running the x86_64 image on m1 does seem to fail with bwrap.

I suspect what will work is running in a full blown Alpine VM on a Mac. Has anyone tried with Lima? https://github.com/chainguard-dev/apko/blob/main/mac/README.md

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm on an M1 mac (it sounds like you are too?).

Ah sorry, yes and building x86_64

@jdolitsky
Copy link
Member

There is now a wolfi-based sdk image we can use:

cgr.dev/chainguard/sdk:latest-glibc

However, on M1 mac, it still fails builds with:

bwrap: Creating new namespace failed: Invalid argument

To reproduce this:

  1. Get the Wolfi sources:
git clone https://github.com/wolfi-dev/os.git && cd os/
  1. Open a shell in the SDK environment:
docker run --platform linux/amd64 --privileged --rm -it -v "${PWD}:${PWD}" -w "${PWD}" cgr.dev/chainguard/sdk:latest-glibc
  1. Try building a package (e.g. Grype):
melange build --empty-workspace --arch x86_64 grype.yaml

@rawlingsj
Copy link
Member

@imjasonh is this work being done as part of apko + melanage on Mac? Maybe we can close?

@imjasonh imjasonh closed this Dec 13, 2022
achraf-mer pushed a commit to achraf-mer/wolfi-os that referenced this pull request Jul 24, 2024
* Fixed installing binaries and libs into package
maxgio92 added a commit to maxgio92/wolfi-os that referenced this pull request Feb 7, 2025
Samba needs to be rebuilt from the rebuilt py3-event version to solve
build-time and runtime issues.

The current published py3-tevent content differs from the
one generated from current builds. With the published version
samba fails to build with the error:
2025/02/07 11:01:33 ERRO failed to build package: unable to build guest:
unable to generate image: installing apk packages: installing packages:
installing py3-tevent (ver:0.16.2-r0 arch:x86_64): unable to install
files for pkg py3-tevent: unable to install file over existing one,
different contents:
usr/lib/python3.13/site-packages/talloc.cpython-313-x86_64-linux-gnu.so

Also, at runtime samba-client panics with:
$ apk add --no-cache samba-client >/dev/null && smbclient -L 127.0.0.1

Can't load /etc/samba/smb.conf - run testparm to debug it
Bad talloc magic value - unknown value
===============================================================
INTERNAL ERROR: Bad talloc magic value - unknown value in smbclient ()
() pid 1 (4.21.3)
If you are running a recent Samba version, and if you think this problem
is not yet fixed in the latest versions, please consider reporting this
bug, see https://wiki.samba.org/index.php/Bug_Reporting
===============================================================
PANIC (pid 1): Bad talloc magic value - unknown value in 4.21.3
BACKTRACE: 14 stack frames:
 #0 /usr/lib/samba/libgenrand-private-samba.so(log_stack_trace+0x44)
[0x7fe75f5bf814]
 wolfi-dev#1 /usr/lib/samba/libgenrand-private-samba.so(smb_panic+0x15)
[0x7fe75f5bfab5]
 wolfi-dev#2 /usr/lib/libtalloc.so.2(+0x5a08) [0x7fe75f5a3a08]
 wolfi-dev#3 /usr/lib/libtalloc.so.2(talloc_named_const+0x30) [0x7fe75f5a4260]
 wolfi-dev#4 /usr/lib/samba/libgse-private-samba.so(resolve_name_list+0x6b)
[0x7fe75eb5b38b]
 wolfi-dev#5 /usr/lib/samba/liblibsmb-private-samba.so(+0x1805e) [0x7fe75f9fd05e]
 wolfi-dev#6 /usr/lib/samba/liblibsmb-private-samba.so(cli_connect_nb+0x7c)
[0x7fe75fa00f5c]
 wolfi-dev#7 /usr/lib/samba/liblibsmb-private-samba.so(+0x396f4) [0x7fe75fa1e6f4]
 wolfi-dev#8 /usr/lib/samba/liblibsmb-private-samba.so(+0x39d67) [0x7fe75fa1ed67]
 wolfi-dev#9 /usr/lib/samba/liblibsmb-private-samba.so(cli_cm_open+0xa7)
[0x7fe75fa1ef17]
 wolfi-dev#10 smbclient(main+0xb9d) [0x5572699730dd]
 wolfi-dev#11 /lib/libc.so.6(+0x26188) [0x7fe75f300188]
 wolfi-dev#12 /lib/libc.so.6(__libc_start_main+0x8b) [0x7fe75f30024b]
 wolfi-dev#13 smbclient(_start+0x25) [0x557269973d65]
Can not dump core: corepath not set up

Signed-off-by: Massimiliano Giovagnoli <massimiliano.giovagnoli@chainguard.dev>
maxgio92 added a commit to maxgio92/wolfi-os that referenced this pull request Feb 7, 2025
Samba needs to be rebuilt from the rebuilt py3-event version to solve
build-time and runtime issues.

Furhtermore a new test for samba-client has been added with this commit.

The current published py3-tevent content differs from the
one generated from current builds. With the published version
samba fails to build with the error:
2025/02/07 11:01:33 ERRO failed to build package: unable to build guest:
unable to generate image: installing apk packages: installing packages:
installing py3-tevent (ver:0.16.2-r0 arch:x86_64): unable to install
files for pkg py3-tevent: unable to install file over existing one,
different contents:
usr/lib/python3.13/site-packages/talloc.cpython-313-x86_64-linux-gnu.so

Also, at runtime samba-client panics with:
$ apk add --no-cache samba-client >/dev/null && smbclient -L 127.0.0.1

Can't load /etc/samba/smb.conf - run testparm to debug it
Bad talloc magic value - unknown value
===============================================================
INTERNAL ERROR: Bad talloc magic value - unknown value in smbclient ()
() pid 1 (4.21.3)
If you are running a recent Samba version, and if you think this problem
is not yet fixed in the latest versions, please consider reporting this
bug, see https://wiki.samba.org/index.php/Bug_Reporting
===============================================================
PANIC (pid 1): Bad talloc magic value - unknown value in 4.21.3
BACKTRACE: 14 stack frames:
 #0 /usr/lib/samba/libgenrand-private-samba.so(log_stack_trace+0x44)
[0x7fe75f5bf814]
 wolfi-dev#1 /usr/lib/samba/libgenrand-private-samba.so(smb_panic+0x15)
[0x7fe75f5bfab5]
 wolfi-dev#2 /usr/lib/libtalloc.so.2(+0x5a08) [0x7fe75f5a3a08]
 wolfi-dev#3 /usr/lib/libtalloc.so.2(talloc_named_const+0x30) [0x7fe75f5a4260]
 wolfi-dev#4 /usr/lib/samba/libgse-private-samba.so(resolve_name_list+0x6b)
[0x7fe75eb5b38b]
 wolfi-dev#5 /usr/lib/samba/liblibsmb-private-samba.so(+0x1805e) [0x7fe75f9fd05e]
 wolfi-dev#6 /usr/lib/samba/liblibsmb-private-samba.so(cli_connect_nb+0x7c)
[0x7fe75fa00f5c]
 wolfi-dev#7 /usr/lib/samba/liblibsmb-private-samba.so(+0x396f4) [0x7fe75fa1e6f4]
 wolfi-dev#8 /usr/lib/samba/liblibsmb-private-samba.so(+0x39d67) [0x7fe75fa1ed67]
 wolfi-dev#9 /usr/lib/samba/liblibsmb-private-samba.so(cli_cm_open+0xa7)
[0x7fe75fa1ef17]
 wolfi-dev#10 smbclient(main+0xb9d) [0x5572699730dd]
 wolfi-dev#11 /lib/libc.so.6(+0x26188) [0x7fe75f300188]
 wolfi-dev#12 /lib/libc.so.6(__libc_start_main+0x8b) [0x7fe75f30024b]
 wolfi-dev#13 smbclient(_start+0x25) [0x557269973d65]
Can not dump core: corepath not set up

Signed-off-by: Massimiliano Giovagnoli <massimiliano.giovagnoli@chainguard.dev>
maxgio92 added a commit to maxgio92/wolfi-os that referenced this pull request Feb 7, 2025
Samba needs to be rebuilt from the rebuilt py3-event version to solve
build-time and runtime issues.

Furhtermore a new test for samba-client has been added with this commit.

The current published py3-tevent content differs from the
one generated from current builds. With the published version
samba fails to build with the error:
2025/02/07 11:01:33 ERRO failed to build package: unable to build guest:
unable to generate image: installing apk packages: installing packages:
installing py3-tevent (ver:0.16.2-r0 arch:x86_64): unable to install
files for pkg py3-tevent: unable to install file over existing one,
different contents:
usr/lib/python3.13/site-packages/talloc.cpython-313-x86_64-linux-gnu.so

Also, at runtime samba-client panics with:
$ apk add --no-cache samba-client >/dev/null && smbclient -L 127.0.0.1

Can't load /etc/samba/smb.conf - run testparm to debug it
Bad talloc magic value - unknown value
===============================================================
INTERNAL ERROR: Bad talloc magic value - unknown value in smbclient ()
() pid 1 (4.21.3)
If you are running a recent Samba version, and if you think this problem
is not yet fixed in the latest versions, please consider reporting this
bug, see https://wiki.samba.org/index.php/Bug_Reporting
===============================================================
PANIC (pid 1): Bad talloc magic value - unknown value in 4.21.3
BACKTRACE: 14 stack frames:
 #0 /usr/lib/samba/libgenrand-private-samba.so(log_stack_trace+0x44)
[0x7fe75f5bf814]
 wolfi-dev#1 /usr/lib/samba/libgenrand-private-samba.so(smb_panic+0x15)
[0x7fe75f5bfab5]
 wolfi-dev#2 /usr/lib/libtalloc.so.2(+0x5a08) [0x7fe75f5a3a08]
 wolfi-dev#3 /usr/lib/libtalloc.so.2(talloc_named_const+0x30) [0x7fe75f5a4260]
 wolfi-dev#4 /usr/lib/samba/libgse-private-samba.so(resolve_name_list+0x6b)
[0x7fe75eb5b38b]
 wolfi-dev#5 /usr/lib/samba/liblibsmb-private-samba.so(+0x1805e) [0x7fe75f9fd05e]
 wolfi-dev#6 /usr/lib/samba/liblibsmb-private-samba.so(cli_connect_nb+0x7c)
[0x7fe75fa00f5c]
 wolfi-dev#7 /usr/lib/samba/liblibsmb-private-samba.so(+0x396f4) [0x7fe75fa1e6f4]
 wolfi-dev#8 /usr/lib/samba/liblibsmb-private-samba.so(+0x39d67) [0x7fe75fa1ed67]
 wolfi-dev#9 /usr/lib/samba/liblibsmb-private-samba.so(cli_cm_open+0xa7)
[0x7fe75fa1ef17]
 wolfi-dev#10 smbclient(main+0xb9d) [0x5572699730dd]
 wolfi-dev#11 /lib/libc.so.6(+0x26188) [0x7fe75f300188]
 wolfi-dev#12 /lib/libc.so.6(__libc_start_main+0x8b) [0x7fe75f30024b]
 wolfi-dev#13 smbclient(_start+0x25) [0x557269973d65]
Can not dump core: corepath not set up

Signed-off-by: Massimiliano Giovagnoli <massimiliano.giovagnoli@chainguard.dev>
maxgio92 added a commit that referenced this pull request Feb 7, 2025
Samba needs to be rebuilt from the rebuilt py3-event version [1] to
solve build-time and runtime issues.

Furhtermore a new test for samba-client has been added with this commit.

The current published py3-tevent content differs from the one generated
from current builds. With the published version samba fails to build
with the error:
```
2025/02/07 11:01:33 ERRO failed to build package: unable to build guest: unable to generate image: installing apk packages: installing packages: installing py3-tevent (ver:0.16.2-r0 arch:x86_64): unable to install files for pkg py3-tevent: unable to install file over existing one, different contents:
usr/lib/python3.13/site-packages/talloc.cpython-313-x86_64-linux-gnu.so
```

Also, at runtime samba-client panics with:
```
$ apk add --no-cache samba-client >/dev/null && smbclient -L 127.0.0.1

Can't load /etc/samba/smb.conf - run testparm to debug it Bad talloc magic value - unknown value
=============================================================== INTERNAL ERROR: Bad talloc magic value - unknown value in smbclient () () pid 1 (4.21.3)
If you are running a recent Samba version, and if you think this problem is not yet fixed in the latest versions, please consider reporting this bug, see https://wiki.samba.org/index.php/Bug_Reporting =============================================================== PANIC (pid 1): Bad talloc magic value - unknown value in 4.21.3 BACKTRACE: 14 stack frames:
 #0 /usr/lib/samba/libgenrand-private-samba.so(log_stack_trace+0x44)
[0x7fe75f5bf814]
 #1 /usr/lib/samba/libgenrand-private-samba.so(smb_panic+0x15)
[0x7fe75f5bfab5]
 #2 /usr/lib/libtalloc.so.2(+0x5a08) [0x7fe75f5a3a08]
 #3 /usr/lib/libtalloc.so.2(talloc_named_const+0x30) [0x7fe75f5a4260]
 #4 /usr/lib/samba/libgse-private-samba.so(resolve_name_list+0x6b)
[0x7fe75eb5b38b]
 #5 /usr/lib/samba/liblibsmb-private-samba.so(+0x1805e) [0x7fe75f9fd05e]
 #6 /usr/lib/samba/liblibsmb-private-samba.so(cli_connect_nb+0x7c)
[0x7fe75fa00f5c]
 #7 /usr/lib/samba/liblibsmb-private-samba.so(+0x396f4) [0x7fe75fa1e6f4]
 #8 /usr/lib/samba/liblibsmb-private-samba.so(+0x39d67) [0x7fe75fa1ed67]
 #9 /usr/lib/samba/liblibsmb-private-samba.so(cli_cm_open+0xa7)
[0x7fe75fa1ef17]
 #10 smbclient(main+0xb9d) [0x5572699730dd]
 #11 /lib/libc.so.6(+0x26188) [0x7fe75f300188]
 #12 /lib/libc.so.6(__libc_start_main+0x8b) [0x7fe75f30024b]
 #13 smbclient(_start+0x25) [0x557269973d65]
Can not dump core: corepath not set up
```

1. #41586

Signed-off-by: Massimiliano Giovagnoli <massimiliano.giovagnoli@chainguard.dev>
Co-authored-by: Wojciech Kocjan <wojciech.kocjan@chainguard.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants