swiftly icon indicating copy to clipboard operation
swiftly copied to clipboard

Segmentation fault on WSLv2/Ubuntu 24.04.1 LTS

Open titonovelianto opened this issue 8 months ago • 6 comments

Description

Hello there!

I was trying to install the Swift toolchain on my WSLv2/Ubuntu 24.04.1 LTS by downloading the Swiftly release through the command provided on Swift.org:

 curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz

Which resolved to swiftly-x86_64.tar.gz for me. But after I ran the swiftly binary and confirmed to proceed with the installation, it crashed during/after fetching the latest Swift release.

The following is the full log:

$ ./swiftly
Welcome to swiftly, the Swift toolchain manager for Linux and macOS!

Please read the following information carefully before proceeding with the installation. If you
wish to customize the steps performed during the installation process, refer to 'swiftly init -h'
for configuration options.

Swiftly installs files into the following locations:

/home/ubuntu/.local/share/swiftly - Directory for configuration files
/home/ubuntu/.local/share/swiftly/bin - Links to the binaries of the active toolchain
/home/ubuntu/.local/share/swiftly/toolchains - Directory hosting installed toolchains

These locations can be changed by setting the environment variables
SWIFTLY_HOME_DIR, SWIFTLY_BIN_DIR, and SWIFTLY_TOOLCHAINS_DIR before running 'swiftly init' again.

Once swiftly is set up, it will install the latest available Swift toolchain. This can be
suppressed with the '--skip-install' option. In the process, swiftly will add swift.org
GnuPG keys into your keychain to verify the integrity of the downloads.

For your convenience, swiftly will also attempt to modify your shell's profile file to make
installed items available in your environment upon login. This can be suppressed with the
'--no-modify-profile' option.

Proceed? (Y/n):
y
Installing swiftly in /home/ubuntu/.local/share/swiftly/bin/swiftly...
Creating shell environment file for the user...
Updating profile...
Fetching the latest stable Swift release...
Segmentation fault (core dumped)

Unfortunately, WSL did not produce a core dump by default, so there is only the following message in dmesg:

[ 1139.531593] swiftly[5476]: segfault at 7153e270c000 ip 0000000001d515c8 sp 00007153e28d1350 error 4 in swiftly[975000+18df000] likely on CPU 15 (core 7, socket 0)
[ 1139.531610] Code: d3 00 00 00 0f 29 84 24 f0 00 00 00 0f 10 80 e3 00 00 00 0f 29 84 24 00 01 00 00 0f 10 80 f3 00 00 00 0f 29 84 24 10 01 00 00 <0f> 10 80 03 01 00 00 0f 29 84 24 20 01 00 00 80 7c 24 30 00 74 32
[ 1139.531618] swiftly: swiftly: potentially unexpected fatal signal 11.
[ 1139.531621] CPU: 15 PID: 5476 Comm: swiftly Not tainted 6.6.87.2-microsoft-standard-WSL2 #1
[ 1139.531625] RIP: 0033:0x1d515c8
[ 1139.531672] Code: d3 00 00 00 0f 29 84 24 f0 00 00 00 0f 10 80 e3 00 00 00 0f 29 84 24 00 01 00 00 0f 10 80 f3 00 00 00 0f 29 84 24 10 01 00 00 <0f> 10 80 03 01 00 00 0f 29 84 24 20 01 00 00 80 7c 24 30 00 74 32
[ 1139.531675] RSP: 002b:00007153e28d1350 EFLAGS: 00010202
[ 1139.531678] RAX: 00007153e270bef8 RBX: 0000000000000049 RCX: 0000000000000102
[ 1139.531681] RDX: 0000000000000738 RSI: 0000000000000002 RDI: 00007153e270b7c0
[ 1139.531683] RBP: 0000000000000000 R08: 00007153e270b7c0 R09: 0000000000000041
[ 1139.531684] R10: 000000000000003a R11: 0000000000000049 R12: 0000000000000000
[ 1139.531686] R13: e200000000000000 R14: 00007153e270b7c0 R15: 0000000000000049
[ 1139.531688] FS:  00007153e28d1b38 GS:  0000000000000000
[ 1139.534822] WSL (5504 - CaptureCrash): Capturing crash for pid: 4534, executable: !home!ubuntu!.local!share!swiftly!bin!swiftly, signal: 11, port: 50005

I can confirm that Swiftly is installed on my system. The following is the output of the Swiftly version:

$ swiftly --version
1.0.1

However, there is no toolchain installed in ~/.local/share/swiftly/toolchains/.

Expected behavior

Swiftly installs successfully and setup the latest Swift toolchain release.

Environment

WSLv2/Ubuntu 24.04.1 LTS.

uname -a:

Linux ${HOSTNAME} 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

lsb_release -a:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.1 LTS
Release:        24.04
Codename:       noble

Additional information

UPDATE: Unfortunately, I'm unable to reproduce this crash ☹️. Subsequent runs successfully installed the Swift toolchain.

titonovelianto avatar Jun 27 '25 15:06 titonovelianto

Thanks Microsoft!

xtremekforever avatar Jun 28 '25 00:06 xtremekforever

On Ubuntu 22.04 I don't even get that far, I just see:

$ ./swiftly init
Illegal instruction (core dumped)
$ ./swiftly
Illegal instruction (core dumped)

dom96 avatar Aug 04 '25 19:08 dom96

@dom96 are you running it in WSL2, or is your Ubuntu 22.04 install still using WSL version 1?

xtremekforever avatar Aug 04 '25 20:08 xtremekforever

I am using WSL 1 indeed

dom96 avatar Aug 04 '25 22:08 dom96

This issue is for WSL 2...but I've also found that using WSL 1 with Swift at all doesn't work. So, I'd recommend switching to WSL2- it should be easy to upgrade your Ubuntu 22.04 install.

xtremekforever avatar Aug 06 '25 11:08 xtremekforever

I've switched to WSL 2 before and ran into issues with other software I need to use. It would be nice if Swift supported both.

dom96 avatar Aug 06 '25 13:08 dom96