Skip to content

Segmentation fault when running in a linux/amd64 docker container on Apple Silicon macOS #3902

Closed as not planned

Description

@staktrace

Verification

Problem

Running rustup inside a linux/amd64 docker container on an M3 macOS machine segfaults. Instead it should not segfault.

Steps

On a Macbook Pro with a Apple M3 Max chip, running Sonoma 14.5 (23F79). I have docker installed, and start a docker container like so:

docker run --platform linux/amd64 -it ubuntu:22.04

Inside the docker container, I run the following:

cd
apt-get update
apt install -y curl
curl https://sh.rustup.rs -sSf | sh -s -- -y

The rustup command produces this output:

info: downloading installer
info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2024-06-13, rust version 1.79.0 (129f3b996 2024-06-10)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
 63.8 MiB /  63.8 MiB (100 %)  56.2 MiB/s in  1s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
Segmentation fault

Possible Solution(s)

Running the docker command with --platform linux/aarch64 and intead of --platform linux/amd64 allows the rustup command to succeed. However I need the amd64 docker build as I need to install other tools that are only precompiled for amd64.

Notes

No response

Rustup version

rustup 1.27.1 (54dd3d00f 2024-04-24)

Installed toolchains

N/A since the toolchain installation is the problem

OS version

macOS Sonoma 14.5 (23F79)

Activity

  1. ehuss commented on Jun 24, 2024

    @ehuss
    Contributor

    I believe this is the same as rust-lang/rust#125430, which has some workarounds. I believe this may be a Docker issue, and I'm not sure how possible it would be for rustup to work around it.

  2. staktrace commented on Jun 24, 2024

    @staktrace
    Author

    Ah, thanks. I'll close this issue as a dupe of rust-lang/rust#125430 then.

  3. staktrace commented on Jun 24, 2024

    @staktrace
    Author

    For the record, disabling Rosetta in the Docker Desktop options does also solve this problem, as mentioned in rust-lang/rust#125430

  4. reopened this on Jun 24, 2024
  5. added
    O-containersNot really OS-related, but container-specific
    on Jun 25, 2024
  6. geraldstanje commented on Jun 26, 2024

    @geraldstanje

    @staktrace i had the same issue in macbook pro m1 - disabling rosetta in the Docker Desktop also helped there.
    do you plan to fix it also for not disabling rosetta in the Docker Desktop? what is the consequence of disabling rosetta - will the compile time for rust be slower because of that?

  7. staktrace commented on Jun 27, 2024

    @staktrace
    Author

    @geraldstanje I don't plan on fixing it, no. Seems like a docker desktop bug. You'd have to ask docker folks.

  8. kylehassett commented on Jul 16, 2024

    @kylehassett

    For those looking for a solution right now, disable Rosetta in Docker Desktop's General settings.

  9. added
    not-rustupWhatever is described in this issue isn't Rustup's fault
    and removed on Nov 14, 2024
  10. changed the title [-]rustup segfaults when running in a linux/amd64 docker container on macOS M3 host[/-] [+]`Segmentation fault` when running in a `linux/amd64` docker container on macOS M3 host[/+] on Nov 14, 2024
  11. changed the title [-]`Segmentation fault` when running in a `linux/amd64` docker container on macOS M3 host[/-] [+]`Segmentation fault` when running in a `linux/amd64` docker container on Apple Silicon macOS[/+] on Nov 14, 2024
  12. rami3l commented on Nov 14, 2024

    @rami3l
    Member

    FYI this is a Docker issue and has nothing to do with this project per se. You'll need to update docker to fix it:

    I reproduced this bug on Docker Desktop 4.29.0 (145265). Updating to 4.32.0 (157355) resolved the issue. Rosetta is still enabled.

    rust-lang/rust#125430 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-containersNot really OS-related, but container-specificnot-rustupWhatever is described in this issue isn't Rustup's fault

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions