Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go package (and others) fail to build due to cpu arch assumption (M1 Mac OSX) #36

Open
superfell opened this issue Sep 24, 2022 · 11 comments

Comments

@superfell
Copy link

using latest, attempting to build the go package target/debug/cubicle package update go results in

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Copying/extracting seed tarball
15.5KiB 0:00:00 [4.12MiB/s] [================================>] 100%            
Checking latest version of Go
./build.sh: 13: go: not found
./build.sh: 14: go: not found
Have  installed at 
Downloading go1.19.1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    75  100    75    0     0    681      0 --:--:-- --:--:-- --:--:--   681
100  141M  100  141M    0     0  80.6M      0  0:00:01  0:00:01 --:--:-- 92.1M
Unpacking go1.19.1
 141MiB 0:00:02 [54.8MiB/s] [============================================================================================================================================================================================================================================>] 100%            
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
ERROR: Have  installed at , which is still not right
Error: failed to update package: "go"

Caused by:
    0: error building package "go"
    1: failed to run command in environment "package-go"
    2: Non-zero exit status (1) from docker exec

Stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /Users/simon/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.66/src/backtrace/libunwind.rs:93:5
      backtrace::backtrace::trace_unsynchronized
             at /Users/simon/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.66/src/backtrace/mod.rs:66:5
   1: backtrace::backtrace::trace
             at /Users/simon/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.66/src/backtrace/mod.rs:53:14
   2: anyhow::backtrace::capture::Backtrace::create
             at /Users/simon/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.61/src/backtrace.rs:216:13
   3: anyhow::backtrace::capture::Backtrace::capture
             at /Users/simon/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.61/src/backtrace.rs:204:17
   4: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
             at /Users/simon/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.61/src/error.rs:533:25
   5: <T as core::convert::Into<U>>::into
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/convert/mod.rs:550:9
   6: anyhow::kind::Trait::new

poking around in build.sh and in the created docker image, it looks like the build.sh assumes ~/bin is in the path, but it doesn't appear to be. At least from docker exec -i cub-package-go sh from that shell, it lists the path as PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'

The PATH issue may be a complete red herring, and the real issue is whatever causes the qemu logging.
I'll continue to poke around.

@superfell superfell changed the title go package (and others) fail to build (M1 Mac OSX) go package (and others) fail to build due to cpu arch assumption (M1 Mac OSX) Sep 24, 2022
@superfell
Copy link
Author

previous ramblings about path are indeed a red herring.

The base docker VM on a M1 Mac, is an arm image.

simon@Starbuck cubicle % docker exec -i cub-package-go sh      
lscpu
Architecture:                    aarch64
CPU op-mode(s):                  64-bit
Byte Order:                      Little Endian
CPU(s):                          4
On-line CPU(s) list:             0-3
Thread(s) per core:              1
Core(s) per socket:              4
Socket(s):                       1
Vendor ID:                       0x00
Model:                           0
Stepping:                        0x0
BogoMIPS:                        48.00
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Not affected
Vulnerability Spec store bypass: Vulnerable
Vulnerability Spectre v1:        Mitigation; __user pointer sanitization
Vulnerability Spectre v2:        Not affected
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected

All the packages installs that install an x86/amd64 version are going to fail.

I hacked build.sh for go to install the arm64 version instead, and that all seemed to work fine.

@ongardie
Copy link
Owner

Thanks for the report. I figured this issue would show up eventually. From a grep of x86|64, it looks like these packages are suspicious:

  • firefox
  • go
  • mold
  • python
  • rust
  • vscodium
  • vscodium-rust-analyzer

...so lots of them.

It seems like everyone has their own terminology for what to call the architectures, unfortunately.

BTW, we should probably set the PATH to something more sensible if you do run the docker command, but instead of docker exec -i cub-package-go sh, you can use cub enter package-go.

This was referenced Sep 25, 2022
@ongardie
Copy link
Owner

@superfell please try out #38 to see if it fixes this

@superfell
Copy link
Author

With #38 I was able to successfully package go & rust, and create new cub's with them. the firefox package still fails.

@ongardie
Copy link
Owner

Thanks. We'll call that progress.

Did you see an arch-specific failure with Firefox? The Firefox package may need X11 to pass its tests.

@superfell
Copy link
Author

Firefox is still trying x86

Downloading Firefox 105.0.1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 74.4M  100 74.4M    0     0  12.1M      0  0:00:06  0:00:06 --:--:-- 12.6M
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
Error: failed to update package: "firefox"

Caused by:
    0: error building package "firefox"
    1: failed to run command in environment "package-firefox"
    2: Non-zero exit status (255) from docker exec

@superfell
Copy link
Author

vscodium-go fails, not sure what's going on here

simon@Starbuck cubicle % cub package update vscodium-go
Updating "vscodium" package
[+] Building 0.1s (12/12) FINISHED                                                                                                                                                                                                                                                          
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                   0.0s
 => => transferring dockerfile: 1.80kB                                                                                                                                                                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/debian:11                                                                                                                                                                                                                           0.0s
 => [1/8] FROM docker.io/library/debian:11                                                                                                                                                                                                                                             0.0s
 => CACHED [2/8] RUN echo America/Los_Angeles > /etc/timezone &&     ln -fs '/usr/share/zoneinfo/'America/Los_Angeles /etc/localtime                                                                                                                                                   0.0s
 => CACHED [3/8] RUN addgroup --gid 20 simon || addgroup simon &&     adduser --disabled-password --gecos '' --uid 501 --ingroup simon simon &&     adduser simon sudo &&     mkdir /home/simon/w &&     chown simon:simon /home/simon/w                                               0.0s
 => CACHED [4/8] RUN sed -i 's/ main$/ main contrib non-free/' /etc/apt/sources.list                                                                                                                                                                                                   0.0s
 => CACHED [5/8] RUN apt-get update && apt-get upgrade --yes                                                                                                                                                                                                                           0.0s
 => CACHED [6/8] RUN apt-get install --no-install-recommends --yes     apt-file     bash-completion     bind9-dnsutils     build-essential     bzip2     ca-certificates     clang     cmake     curl     dialog     eatmydata     file     gdb     git     iproute2     iputils-ping  0.0s
 => CACHED [7/8] RUN apt-file update                                                                                                                                                                                                                                                   0.0s
 => CACHED [8/8] RUN sh -c 'echo "Defaults umask = 0027" > /etc/sudoers.d/umask' &&     sh -c 'echo "%sudo ALL=(ALL) CWD=* NOPASSWD: ALL" > /etc/sudoers.d/nopasswd'                                                                                                                   0.0s
 => exporting to image                                                                                                                                                                                                                                                                 0.0s
 => => exporting layers                                                                                                                                                                                                                                                                0.0s
 => => writing image sha256:73b8a53b3622edbfc33699efc6fdf070e009b3851260f749bf509c8cc031c6aa                                                                                                                                                                                           0.0s
 => => naming to docker.io/library/cub-cubicle-base                                                                                                                                                                                                                                    0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Copying/extracting seed tarball
25.0KiB 0:00:00 [6.88MiB/s] [================================>] 100%            
Checking latest version of VS Codium
./build.sh: 12: /home/simon/opt/vscodium/bin/codium: not found
Downloading VSCodium-linux-arm64-1.71.2.22258
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  107M  100  107M    0     0  18.6M      0  0:00:05  0:00:05 --:--:-- 21.3M
Updating "go" package
[+] Building 0.1s (12/12) FINISHED                                                                                                                                                                                                                                                          
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                   0.0s
 => => transferring dockerfile: 1.80kB                                                                                                                                                                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/debian:11                                                                                                                                                                                                                           0.0s
 => [1/8] FROM docker.io/library/debian:11                                                                                                                                                                                                                                             0.0s
 => CACHED [2/8] RUN echo America/Los_Angeles > /etc/timezone &&     ln -fs '/usr/share/zoneinfo/'America/Los_Angeles /etc/localtime                                                                                                                                                   0.0s
 => CACHED [3/8] RUN addgroup --gid 20 simon || addgroup simon &&     adduser --disabled-password --gecos '' --uid 501 --ingroup simon simon &&     adduser simon sudo &&     mkdir /home/simon/w &&     chown simon:simon /home/simon/w                                               0.0s
 => CACHED [4/8] RUN sed -i 's/ main$/ main contrib non-free/' /etc/apt/sources.list                                                                                                                                                                                                   0.0s
 => CACHED [5/8] RUN apt-get update && apt-get upgrade --yes                                                                                                                                                                                                                           0.0s
 => CACHED [6/8] RUN apt-get install --no-install-recommends --yes     apt-file     bash-completion     bind9-dnsutils     build-essential     bzip2     ca-certificates     clang     cmake     curl     dialog     eatmydata     file     gdb     git     iproute2     iputils-ping  0.0s
 => CACHED [7/8] RUN apt-file update                                                                                                                                                                                                                                                   0.0s
 => CACHED [8/8] RUN sh -c 'echo "Defaults umask = 0027" > /etc/sudoers.d/umask' &&     sh -c 'echo "%sudo ALL=(ALL) CWD=* NOPASSWD: ALL" > /etc/sudoers.d/nopasswd'                                                                                                                   0.0s
 => exporting to image                                                                                                                                                                                                                                                                 0.0s
 => => exporting layers                                                                                                                                                                                                                                                                0.0s
 => => writing image sha256:73b8a53b3622edbfc33699efc6fdf070e009b3851260f749bf509c8cc031c6aa                                                                                                                                                                                           0.0s
 => => naming to docker.io/library/cub-cubicle-base                                                                                                                                                                                                                                    0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Copying/extracting seed tarball
3.15MiB 0:00:00 [46.5MiB/s] [================================>] 100%            
No plugins installed
initializing plugin repository...Cloning into '/home/simon/.asdf/repository'...
remote: Enumerating objects: 4357, done.
remote: Counting objects: 100% (184/184), done.
remote: Compressing objects: 100% (90/90), done.
remote: Total 4357 (delta 113), reused 161 (delta 92), pack-reused 4173
Receiving objects: 100% (4357/4357), 992.30 KiB | 8.34 MiB/s, done.
Resolving deltas: 100% (2294/2294), done.
Platform 'linux' supported!
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  109M  100  109M    0     0  79.3M      0  0:00:01  0:00:01 --:--:-- 79.3M
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    64  100    64    0     0    688      0 --:--:-- --:--:-- --:--:--   688
verifying checksum
/home/simon/.asdf/downloads/golang/1.19.1/archive.tar.gz: OK
checksum verified
Testing "go" package
Error: No such container: cub-test-package-go
[+] Building 0.1s (12/12) FINISHED                                                                                                                                                                                                                                                          
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                   0.0s
 => => transferring dockerfile: 1.80kB                                                                                                                                                                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/debian:11                                                                                                                                                                                                                           0.0s
 => [1/8] FROM docker.io/library/debian:11                                                                                                                                                                                                                                             0.0s
 => CACHED [2/8] RUN echo America/Los_Angeles > /etc/timezone &&     ln -fs '/usr/share/zoneinfo/'America/Los_Angeles /etc/localtime                                                                                                                                                   0.0s
 => CACHED [3/8] RUN addgroup --gid 20 simon || addgroup simon &&     adduser --disabled-password --gecos '' --uid 501 --ingroup simon simon &&     adduser simon sudo &&     mkdir /home/simon/w &&     chown simon:simon /home/simon/w                                               0.0s
 => CACHED [4/8] RUN sed -i 's/ main$/ main contrib non-free/' /etc/apt/sources.list                                                                                                                                                                                                   0.0s
 => CACHED [5/8] RUN apt-get update && apt-get upgrade --yes                                                                                                                                                                                                                           0.0s
 => CACHED [6/8] RUN apt-get install --no-install-recommends --yes     apt-file     bash-completion     bind9-dnsutils     build-essential     bzip2     ca-certificates     clang     cmake     curl     dialog     eatmydata     file     gdb     git     iproute2     iputils-ping  0.0s
 => CACHED [7/8] RUN apt-file update                                                                                                                                                                                                                                                   0.0s
 => CACHED [8/8] RUN sh -c 'echo "Defaults umask = 0027" > /etc/sudoers.d/umask' &&     sh -c 'echo "%sudo ALL=(ALL) CWD=* NOPASSWD: ALL" > /etc/sudoers.d/nopasswd'                                                                                                                   0.0s
 => exporting to image                                                                                                                                                                                                                                                                 0.0s
 => => exporting layers                                                                                                                                                                                                                                                                0.0s
 => => writing image sha256:73b8a53b3622edbfc33699efc6fdf070e009b3851260f749bf509c8cc031c6aa                                                                                                                                                                                           0.0s
 => => naming to docker.io/library/cub-cubicle-base                                                                                                                                                                                                                                    0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
Copying/extracting seed tarball
 334MiB 0:00:04 [69.2MiB/s] [================================>] 100%            
go version go1.19.1 linux/arm64
Updating "go-install.github.com/go-delve/delve/cmd/dlv" package
[+] Building 0.1s (12/12) FINISHED                                                                                                                                                                                                                                                          
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                   0.0s
 => => transferring dockerfile: 1.80kB                                                                                                                                                                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/debian:11                                                                                                                                                                                                                           0.0s
 => [1/8] FROM docker.io/library/debian:11                                                                                                                                                                                                                                             0.0s
 => CACHED [2/8] RUN echo America/Los_Angeles > /etc/timezone &&     ln -fs '/usr/share/zoneinfo/'America/Los_Angeles /etc/localtime                                                                                                                                                   0.0s
 => CACHED [3/8] RUN addgroup --gid 20 simon || addgroup simon &&     adduser --disabled-password --gecos '' --uid 501 --ingroup simon simon &&     adduser simon sudo &&     mkdir /home/simon/w &&     chown simon:simon /home/simon/w                                               0.0s
 => CACHED [4/8] RUN sed -i 's/ main$/ main contrib non-free/' /etc/apt/sources.list                                                                                                                                                                                                   0.0s
 => CACHED [5/8] RUN apt-get update && apt-get upgrade --yes                                                                                                                                                                                                                           0.0s
 => CACHED [6/8] RUN apt-get install --no-install-recommends --yes     apt-file     bash-completion     bind9-dnsutils     build-essential     bzip2     ca-certificates     clang     cmake     curl     dialog     eatmydata     file     gdb     git     iproute2     iputils-ping  0.0s
 => CACHED [7/8] RUN apt-file update                                                                                                                                                                                                                                                   0.0s
 => CACHED [8/8] RUN sh -c 'echo "Defaults umask = 0027" > /etc/sudoers.d/umask' &&     sh -c 'echo "%sudo ALL=(ALL) CWD=* NOPASSWD: ALL" > /etc/sudoers.d/nopasswd'                                                                                                                   0.0s
 => exporting to image                                                                                                                                                                                                                                                                 0.0s
 => => exporting layers                                                                                                                                                                                                                                                                0.0s
 => => writing image sha256:73b8a53b3622edbfc33699efc6fdf070e009b3851260f749bf509c8cc031c6aa                                                                                                                                                                                           0.0s
 => => naming to docker.io/library/cub-cubicle-base                                                                                                                                                                                                                                    0.0s

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: sethostname: invalid argument: unknown.
Error: failed to update package: "go-install.github.com/go-delve/delve/cmd/dlv"

Caused by:
    0: error building package "go-install.github.com/go-delve/delve/cmd/dlv"
    1: failed to create environment "package-go-install-github.com/go-delve/delve/cmd/dlv"
    2: failed to start Docker container "cub-package-go-install-github.com/go-delve/delve/cmd/dlv" (encoded for Docker as "cub-package-go-install-github.2ecom.2fgo-delve.2fdelve.2fcmd.2fdlv")
    3: Non-zero exit status (125) from docker run

@superfell
Copy link
Author

Yeah, for Firefox, its not likely to work even if it gets further. Same for vscode. Perhaps need to set arch specific filters for packages?

@ongardie
Copy link
Owner

Firefox is still trying x86

Oh I see, Firefox's "Linux 64-bit" download really means x86-64, and they don't offer official ARM64 Linux builds. https://firefox-source-docs.mozilla.org/build/buildsystem/supported-configurations.html#tier-3-targets
So, that's not great.

@ongardie
Copy link
Owner

vscodium-go fails, not sure what's going on here

[...]
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: sethostname: invalid argument: unknown.
Error: failed to update package: "go-install.github.com/go-delve/delve/cmd/dlv"

This might be caused by the hostname being too long.

~$ docker run -it --rm --hostname package-go-install-github-com-go-delve-delve-cmd-dlv.fractal debian 
root@package-go-install-github-com-go-delve-delve-cmd-dlv:/# 
exit
~$ docker run -it --rm --hostname package-go-install-github-com-go-delve-delve-cmd-dlv.morecharactershere debian
docker: Error response from daemon: OCI runtime create failed: container_linux.go:367: starting container process caused: process_linux.go:495: container init caused: sethostname: invalid argument: unknown.
Command exited with status 125

My machine is named fractal (after the brand of its case), and yours must be named something longer 😂. So I guess we need to truncate long hostnames?

@ongardie
Copy link
Owner

#44 / #48 just now should have fixed the long hostname problem

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

No branches or pull requests

2 participants