dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.91k stars 4.63k forks source link

Update .NET Linux Build for .NET 9 #91826

Closed richlander closed 2 weeks ago

richlander commented 12 months ago

Update (2024-07): We decided to keep on targeting Ubuntu 16.04 based on other feedback. Doing so hasn't had any significant drawback and maintains significant compatibility.

We should update the Linux build to use Azure Linux 3.0 and target Ubuntu 18.04 for .NET 9. This plan builds on our successful .NET 8 Linux build project. This is for the Microsoft build. Other builders of .NET 9 can and will make different choices.

For .NET 8, we targeted Ubuntu 16.04, in order to provide broad support for older Linux distributions. We considered targeting Ubuntu 18.04 in that timeframe, but that would have broken compatibility with Amazon Linux 2. Upon the request of Amazon, we chose to support Ubuntu 16.04 to avoid that compatibility break. NET 8 will be the last release to provide glibc compatibility for Amazon Linux 2, such that we can move forward to targeting Ubuntu 18.04. This means that the Linux support matrix for .NET 8 and 9 will be significantly different.

Ubuntu glibc versions:

Here are some other distributions (bolded distro versions are compatible):

richlander commented 12 months ago

/cc @socketnorm @dotnet/distro-maintainers

am11 commented 12 months ago

The older the libc, the broader the compatibility.

IIUC, this update is desired not because we are actually using anything specific from modern glibc in code, but the reason for update is infrastructure related. In that case:

We are building the official image with older glibc on modern distro. We use debootsrap to create a cross-build environment, select older version of Ubuntu during the setup, and then install headers, dependencies etc. During the runtime build, we use -isystem=/path/to/rootfs/dir. This means that libc and the build dependencies are old in the rootfs environment. As the time is passing by, those old dependencies are getting hard to acquire and pass the security scan.

If that is the whole reason of this update, it is possible to setup rootfs environment with newer version of Ubuntu while keeping libc6 version lower. (apt install libc-bin=2.19-0ubuntu6 libc6=2.19-0ubuntu6 in rootfs). This way we will end up with "old libc and new $everythingElse". Note that we don't "execute" anything in rootfs environment aside from apt install et al. during the creation of docker layer.

If we set it up this way, would this satisfy everyone?

tmds commented 12 months ago

CentOS Stream 8/RHEL8 have 2.28.

If I recall correctly, we (Red Hat) would like to provide a supported version of .NET during the maintenance support phase of RHEL. For RHEL8, that is till May 2029. To cover that period, we'll need to build .NET 10 on RHEL8.

cc @omajid

ghost commented 12 months ago

Tagging subscribers to this area: @dotnet/runtime-infrastructure See info in area-owners.md if you want to be subscribed.

Issue Details
We should update the Linux build to target Ubuntu 20.04 for .NET 9. This is for the Microsoft build. Other builders of .NET 9 may choose to target a slightly different `glibc`. Ubuntu 20.04 includes `glibc` version 2.31. .NET 9 will support distributions with `glibc` 2.31 or newer. Musl distributions (like Alpine) are unaffected. This plan builds on our [successful .NET 8 Linux build project](https://github.com/dotnet/runtime/issues/83428). For .NET 8, we targeted Ubuntu 16.04, in order to provide broad support for older Linux distributions. We considered targeting Ubuntu 18.04 in that timeframe, but that would have broken compatibility with Amazon Linux 2. Upon the request of Amazon, we chose to support Ubuntu 16.04 to avoid that compatibility break. NET 8 will be the last release to provide `glibc` compatibility for Amazon Linux 2, such that we can move forward all the way to Ubuntu 20.04. This means that the Linux support matrix for .NET 8 and 9 will be significantly different. Ubuntu `glibc` versions: - Ubuntu 22.04: 2.35 - **Ubuntu 20.04: 2.31** - Ubuntu 18.04: 2.27 - Ubuntu 16.04: 2.23 Here are some other distributions (bolded distro versions are compatible): - AlmaLinux 8: 2.28 - **AlmaLinux 9: 2.34** - **Amazon Linux 2023: 2.34** - Amazon Linux 2: 2.26 - CentOS 7: 2.17 - **CentOS Stream 9: 2.34** - **Debian 11: 2.31** - **Debian 12: 2.36** - **Arch Linux 20230723.0.166908: 2.37** - **Fedora 37: 2.36** - **Fedora 38: 2.37**
Author: richlander
Assignees: -
Labels: `area-Infrastructure`, `untriaged`, `needs-area-label`
Milestone: -
jkoritzinsky commented 12 months ago

@tmds this change in minimum glibc version will only apply to the Microsoft build. RedHat's build should still be able to be built against RHEL8's glibc.

jkotas commented 12 months ago

RedHat's build should still be able to be built against RHEL8's glibc.

Agree. It can complicate the RHEL build bootstrapping though.

tmds commented 12 months ago

Can you use Ubuntu 18.04 for .NET 9?

That will evade the need to bootstrap.

It will also make self-contained apps built using the Microsoft SDK work on RHEL 8 (and RHEL 8 compatible distros).

normj commented 12 months ago

Acknowledging from AWS and we will be encouraging users to migrate to Amazon Linux 2023.

richlander commented 12 months ago

We could target 18.04 instead. There is no pressing reason to move to 20.04. Would that resolve the challenges?

tmds commented 12 months ago

Yes. If you can use Ubuntu 18.04, that would be preferable.

richlander commented 6 months ago

I updated this doc to Ubuntu 18.04. Sorry for the delay.

agocke commented 2 weeks ago

Closing this. I don't think we're going to change anything unless there's a specific reason.

richlander commented 2 weeks ago

Just in time to create a new one for .NET 10!