cross-rs / cross

“Zero setup” cross compilation and “cross testing” of Rust crates
Apache License 2.0
6.49k stars 365 forks source link

Doing `Getting Started` tutorial corrupted my WSL #1305

Open Multirious opened 1 year ago

Multirious commented 1 year ago

Checklist

Describe your issue

Update: Apparently it's configuration issue(?). Since I've done created a new Debian installation and it went fine. I don't know what went wrong with my first config.

I'm on Window 10, WSL2 Debian 12.

I was going through Getting Started tutorial section. I installed podman with the default configuration. After I ran cross run --target aarch64-unknown-linux-gnu, it crashes my WSL and literally corrupted it.

Here's the terminal log:

# I was on zsh shell
❯ cross run --target aarch64-unknown-linux-gnu
info: downloading component 'rust-std' for 'aarch64-unknown-linux-gnu'
info: installing component 'rust-std' for 'aarch64-unknown-linux-gnu'
 31.6 MiB /  31.6 MiB (100 %)  13.3 MiB/s in  2s ETA:  0s
WARN[0000] "/" is not a shared mount, this could cause issues or missing mounts with rootless containers
Trying to pull ghcr.io/cross-rs/aarch64-unknown-linux-gnu:0.2.5...
Getting image source signatures
Copying blob 9cccf86b8f43 done
Copying blob fb15d46c38dc done
Copying blob b51569e7c507 done
Copying blob da8ef40b9eca done
Copying blob 9d5962c83f5f done
Copying blob 58690f9b18fc done
Copying blob 4c6d73517e75 done
Copying blob 4afe128e6862 done
Copying blob 2765f54cfdee done
Copying blob 40c841a9d0e8 done
Copying blob 70c492706cd4 done
Copying blob b376264cc3c9 done
Copying blob f94a42110e99 done
Copying blob 29835156cc05 done
Copying blob d48b139772fe done
Copying blob 55ba4d0a0c25 done
Copying blob 5f4fa2c62d4d done
Copying blob 6bc43a1e4611 done
ERRO[0069] While recovering from a failure (creating a read-only layer), error deleting layer "6a8295f44097b968ae2a6944b429e06ca1538788b6575efb7616cbaae039ef20": unlinkat /home/peach/.local/share/containers/storage/vfs/dir/6a8295f44097b968ae2a6944b429e06ca1538788b6575efb7616cbaae039ef20: read-only file system
fatal error: unexpected signal during runtime execution
[signal SIGBUS: bus error code=0x2 addr=0x1ace0c0 pc=0x40de6e]

runtime stack:
fatal error: unexpected signal during runtime execution
panic during panic
[signal SIGBUS: bus error code=0x2 addr=0x1bd002c pc=0x462a57]

runtime stack:
fatal error: unexpected signal during runtime execution
stack trace unavailable
Error:
   0: could not execute `rustup component list --toolchain stable-x86_64-unknown-linux-gnu`
   1: Input/output error (os error 5)
PS C:\Users\Peach> debian # cannot access debian
<3>WSL (5619) ERROR: ConfigUpdateLanguage:2950: fopen(/etc/default/locale) failed 5
<3>WSL (5619) ERROR: CreateProcessEntryCommon:526: initgroups failed 5
<3>WSL (5619) ERROR: CreateProcessEntryCommon:586: Create process not expected to return
PS C:\Users\Peach>

What target(s) are you cross-compiling for?

aarch64-unknown-linux-gnu

Which operating system is the host (e.g computer cross is on) running?

What architecture is the host?

What container engine is cross using?

cross version

cross 0.2.5

Example

Following Getting Started tutorial on Windows 10, WSL 2 Debian 12.

cargo install cross
sudo apt-get -y install podman
cargo init --bin hello
cd hello
cross run --target aarch64-unknown-linux-gnu

And bye bye my Debian. Anyways, the Debian is not that important. I was just testing around.

Additional information / notes

I'm on zsh shell with some long configurations. podman uses default configuration. I have changed target-dir for cargo.

Multirious commented 1 year ago

Update: I've done a wsl --unregister debian. and got a new, fresh, and hot Debian. I've done: Installed Rust first through this default installer and proceed default installation.

sudo apt-get -y update; sudo apt-get -y upgrade
sudo apt-get -y install curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"

and then something along these lines:

sudo apt-get -y install podman build-essential
cargo install cross

then test the thing

cargo init --bin hello
cd hello
cross run --target aarch64-unknown-linux-gnu

And it has been working just fine! I don't know what happen in the first configuration I've got.

Update 2: I've reconfigured my new Debian with my personal dotfiles repository, which mean the corrupted Debian and this Debian should have about the same configs.

I've tested cross just for my current system. It went just fine. What actually went wrong?

I've tested cross for x86_64-pc-windows-gnu. Boom. My terminal is now all f*cked up. Luckily didn't crashes this time. My tmux key binds stop functioning for a minute. My helix editor on the left side of my tmux pane just straight up gone and giving me bell notification on every key presses. Executing any commands now give SEGV apparently? zsh is some how is still functioning, including the plugins. I executed exec zsh in my last effort. It returns

zsh: locking failed for /home/peach/.config/zsh/zsh_history: read-only file system

Does anyone have any idea before I have to go test every single config?

Emilgardis commented 1 year ago

Cross doesnt do anything magical with WSL, it simply invokes podman or docker.

You can see what happens with -v added to the command.

I don't think this is a cross issue, it should go to wsl I think.