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

Can't install .NET6 runtime on Ubuntu 22.04 #19845

Closed
RussKie opened this issue May 24, 2024 · 6 comments
Closed

Can't install .NET6 runtime on Ubuntu 22.04 #19845

RussKie opened this issue May 24, 2024 · 6 comments
Assignees

Comments

@RussKie
Copy link
Member

RussKie commented May 24, 2024

I'm trying to install .NET 6 runtime on my Ubuntu (in WSL2)

~$ lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04
Codename:       jammy

~$ dotnet --info

-bash: /usr/bin/dotnet: No such file or directory

~$ sudo apt update && sudo apt install -y dotnet-runtime-6.0

Hit:1 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
205 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  aspnetcore-targeting-pack-6.0 netstandard-targeting-pack-2.1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  dotnet-host dotnet-hostfxr-6.0
The following NEW packages will be installed:
  dotnet-host dotnet-hostfxr-6.0 dotnet-runtime-6.0
0 upgraded, 3 newly installed, 0 to remove and 205 not upgraded.
Need to get 23.8 MB of archives.
After this operation, 67.9 MB of additional disk space will be used.
Get:1 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-host amd64 8.0.5-1 [37.8 kB]
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 dotnet-hostfxr-6.0 amd64 6.0.128-0ubuntu1~22.04.2 [155 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 dotnet-runtime-6.0 amd64 6.0.128-0ubuntu1~22.04.2 [23.6 MB]
Fetched 23.8 MB in 5s (4347 kB/s)
Selecting previously unselected package dotnet-host.
(Reading database ... 57740 files and directories currently installed.)
Preparing to unpack .../dotnet-host_8.0.5-1_amd64.deb ...
Unpacking dotnet-host (8.0.5-1) ...
Selecting previously unselected package dotnet-hostfxr-6.0.
Preparing to unpack .../dotnet-hostfxr-6.0_6.0.128-0ubuntu1~22.04.2_amd64.deb ...
Unpacking dotnet-hostfxr-6.0 (6.0.128-0ubuntu1~22.04.2) ...
Selecting previously unselected package dotnet-runtime-6.0.
Preparing to unpack .../dotnet-runtime-6.0_6.0.128-0ubuntu1~22.04.2_amd64.deb ...
Unpacking dotnet-runtime-6.0 (6.0.128-0ubuntu1~22.04.2) ...
Setting up dotnet-host (8.0.5-1) ...
Setting up dotnet-hostfxr-6.0 (6.0.128-0ubuntu1~22.04.2) ...
Setting up dotnet-runtime-6.0 (6.0.128-0ubuntu1~22.04.2) ...

~$ dotnet --info

Error: [/usr/share/dotnet/host/fxr] does not exist

If I run sudo apt update && sudo apt install -y dotnet-sdk-6.0 on top of that I still get the same error:

~$ sudo apt update && sudo apt install -y dotnet-sdk-6.0

Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Get:3 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease [3632 B]
Hit:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Fetched 3632 B in 1s (2914 B/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
205 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  aspnetcore-runtime-6.0 dotnet-apphost-pack-6.0 dotnet-targeting-pack-6.0
The following NEW packages will be installed:
  aspnetcore-runtime-6.0 dotnet-apphost-pack-6.0 dotnet-sdk-6.0 dotnet-targeting-pack-6.0
0 upgraded, 4 newly installed, 0 to remove and 205 not upgraded.
Need to get 100 MB of archives.
After this operation, 405 MB of additional disk space will be used.
Get:1 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-sdk-6.0 amd64 6.0.422-1 [86.9 MB]
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 dotnet-targeting-pack-6.0 amd64 6.0.128-0ubuntu1~22.04.2 [2248 kB]
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 aspnetcore-runtime-6.0 amd64 6.0.128-0ubuntu1~22.04.2 [7314 kB]
Get:4 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 dotnet-apphost-pack-6.0 amd64 6.0.128-0ubuntu1~22.04.2 [3704 kB]
Fetched 100 MB in 11s (8952 kB/s)
Selecting previously unselected package dotnet-targeting-pack-6.0.
(Reading database ... 57941 files and directories currently installed.)
Preparing to unpack .../dotnet-targeting-pack-6.0_6.0.128-0ubuntu1~22.04.2_amd64.deb ...
Unpacking dotnet-targeting-pack-6.0 (6.0.128-0ubuntu1~22.04.2) ...
Selecting previously unselected package aspnetcore-runtime-6.0.
Preparing to unpack .../aspnetcore-runtime-6.0_6.0.128-0ubuntu1~22.04.2_amd64.deb ...
Unpacking aspnetcore-runtime-6.0 (6.0.128-0ubuntu1~22.04.2) ...
Selecting previously unselected package dotnet-apphost-pack-6.0.
Preparing to unpack .../dotnet-apphost-pack-6.0_6.0.128-0ubuntu1~22.04.2_amd64.deb ...
Unpacking dotnet-apphost-pack-6.0 (6.0.128-0ubuntu1~22.04.2) ...
Selecting previously unselected package dotnet-sdk-6.0.
Preparing to unpack .../dotnet-sdk-6.0_6.0.422-1_amd64.deb ...
Unpacking dotnet-sdk-6.0 (6.0.422-1) ...
Setting up dotnet-apphost-pack-6.0 (6.0.128-0ubuntu1~22.04.2) ...
Setting up dotnet-targeting-pack-6.0 (6.0.128-0ubuntu1~22.04.2) ...
Setting up aspnetcore-runtime-6.0 (6.0.128-0ubuntu1~22.04.2) ...
Setting up dotnet-sdk-6.0 (6.0.422-1) ...
This software may collect information about you and your use of the software, and send that to Microsoft.
Please visit http://aka.ms/dotnet-cli-eula for more information.
Welcome to .NET!
---------------------
Learn more about .NET: https://aka.ms/dotnet-docs
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by sett
ing the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

Configuring...
--------------
A command is running to populate your local package cache to improve restore speed and enable offline access. This command takes up to one minute to complete and only runs once.

~$ dotnet --info

Error: [/usr/share/dotnet/host/fxr] does not exist

If I run sudo apt update && sudo apt install -y dotnet-sdk-8.0 it seems to heal and I get both the SDKs but only one runtime installed:

$ sudo apt update && sudo apt install -y dotnet-sdk-8.0

Hit:1 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease
Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Hit:3 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Fetched 110 kB in 2s (56.1 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
205 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  aspnetcore-runtime-8.0 aspnetcore-targeting-pack-8.0 dotnet-apphost-pack-8.0 dotnet-hostfxr-8.0 dotnet-runtime-8.0 dotnet-runtime-deps-8.0 dotnet-targeting-pack-8.0
The following NEW packages will be installed:
  aspnetcore-runtime-8.0 aspnetcore-targeting-pack-8.0 dotnet-apphost-pack-8.0 dotnet-hostfxr-8.0 dotnet-runtime-8.0 dotnet-runtime-deps-8.0 dotnet-sdk-8.0
  dotnet-targeting-pack-8.0
0 upgraded, 8 newly installed, 0 to remove and 205 not upgraded.
Need to get 146 MB of archives.
After this operation, 579 MB of additional disk space will be used.
Get:1 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-hostfxr-8.0 amd64 8.0.5-1 [108 kB]
Get:2 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-runtime-deps-8.0 amd64 8.0.5-1 [2886 B]
Get:3 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-runtime-8.0 amd64 8.0.5-1 [23.1 MB]
Get:4 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 aspnetcore-runtime-8.0 amd64 8.0.5-1 [7673 kB]
Get:5 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-targeting-pack-8.0 amd64 8.0.5-1 [2801 kB]
Get:6 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 aspnetcore-targeting-pack-8.0 amd64 8.0.5-1 [1924 kB]
Get:7 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-apphost-pack-8.0 amd64 8.0.5-1 [3516 kB]
Get:8 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-sdk-8.0 amd64 8.0.300-1 [107 MB]
Fetched 146 MB in 16s (9182 kB/s)
Selecting previously unselected package dotnet-hostfxr-8.0.
(Reading database ... 61417 files and directories currently installed.)
Preparing to unpack .../0-dotnet-hostfxr-8.0_8.0.5-1_amd64.deb ...
Unpacking dotnet-hostfxr-8.0 (8.0.5-1) ...
Selecting previously unselected package dotnet-runtime-deps-8.0.
Preparing to unpack .../1-dotnet-runtime-deps-8.0_8.0.5-1_amd64.deb ...
Unpacking dotnet-runtime-deps-8.0 (8.0.5-1) ...
Selecting previously unselected package dotnet-runtime-8.0.
Preparing to unpack .../2-dotnet-runtime-8.0_8.0.5-1_amd64.deb ...
Unpacking dotnet-runtime-8.0 (8.0.5-1) ...
Selecting previously unselected package aspnetcore-runtime-8.0.
Preparing to unpack .../3-aspnetcore-runtime-8.0_8.0.5-1_amd64.deb ...
Unpacking aspnetcore-runtime-8.0 (8.0.5-1) ...
Selecting previously unselected package dotnet-targeting-pack-8.0.
Preparing to unpack .../4-dotnet-targeting-pack-8.0_8.0.5-1_amd64.deb ...
Unpacking dotnet-targeting-pack-8.0 (8.0.5-1) ...
Selecting previously unselected package aspnetcore-targeting-pack-8.0.
Preparing to unpack .../5-aspnetcore-targeting-pack-8.0_8.0.5-1_amd64.deb ...
Unpacking aspnetcore-targeting-pack-8.0 (8.0.5-1) ...
Selecting previously unselected package dotnet-apphost-pack-8.0.
Preparing to unpack .../6-dotnet-apphost-pack-8.0_8.0.5-1_amd64.deb ...
Unpacking dotnet-apphost-pack-8.0 (8.0.5-1) ...
Selecting previously unselected package dotnet-sdk-8.0.
Preparing to unpack .../7-dotnet-sdk-8.0_8.0.300-1_amd64.deb ...
Unpacking dotnet-sdk-8.0 (8.0.300-1) ...
Setting up dotnet-hostfxr-8.0 (8.0.5-1) ...
Setting up dotnet-targeting-pack-8.0 (8.0.5-1) ...
Setting up aspnetcore-targeting-pack-8.0 (8.0.5-1) ...
Setting up dotnet-apphost-pack-8.0 (8.0.5-1) ...
Setting up dotnet-runtime-deps-8.0 (8.0.5-1) ...
Setting up dotnet-runtime-8.0 (8.0.5-1) ...
Setting up aspnetcore-runtime-8.0 (8.0.5-1) ...
Setting up dotnet-sdk-8.0 (8.0.300-1) ...

~$ dotnet --info

.NET SDK:
 Version:           8.0.300
 Commit:            326f6e68b2
 Workload version:  8.0.300-manifests.c1c70047
 MSBuild version:   17.10.4+10fbfbf2e

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  22.04
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/8.0.300/

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      8.0.5
  Architecture: x64
  Commit:       087e15321b

.NET SDKs installed:
  6.0.422 [/usr/share/dotnet/sdk]
  8.0.300 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

What's going on? How do I get .NET6 runtime installed without .NET8?

@marcpopMSFT
Copy link
Member

Were you using the Ubuntu feeds or the Microsoft feeds for finding the package? There can be issues if you mix the feeds (hence why we stopped producing the MS ones in later versions). Assigning to @MichaelSimons as he's probably more familiar with linux package installs.

@MichaelSimons
Copy link
Member

@NikolaMilosavljevic - Can you provide some guidance? TIA

@RussKie
Copy link
Member Author

RussKie commented May 29, 2024

Were you using the Ubuntu feeds or the Microsoft feeds for finding the package?

No idea. How do I check?

@wesQ3
Copy link

wesQ3 commented Jun 12, 2024

I ran into this same problem trying to install dotnet-runtime-6.0 after installing dotnet-8. My issue was I have MS apt sources added for vscode and mssql already, and somehow the package priorities are different between the 6.0 and 8.0 packages. You can see if this is the case for you with apt-cache:

$ apt-cache policy dotnet-runtime-8.0 
dotnet-runtime-8.0:
  Installed: 8.0.6-1
  Candidate: 8.0.6-1
  Version table:
 *** 8.0.6-1 500
        500 https://packages.microsoft.com/ubuntu/22.04/prod jammy/main amd64 Packages
        100 /var/lib/dpkg/status

$ apt-cache policy dotnet-runtime-6.0 
dotnet-runtime-6.0:
  Installed: 6.0.128-0ubuntu1~22.04.2
  Candidate: 6.0.128-0ubuntu1~22.04.2
  Version table:
 *** 6.0.128-0ubuntu1~22.04.2 500
        500 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        100 /var/lib/dpkg/status

Note that 8.0 is from the microsoft source and 6.0 is from the ubuntu source.

I want to keep my MS sources for vscode and mssql odbc, so I made an apt preferences file to select the ubuntu packages for dotnet to keep them consistent:

$ cat /etc/apt/preferences.d/dotnet
Package: dotnet-*
Pin: release o=Ubuntu, jammy-updates
Pin-Priority: 1001

Package: aspnetcore-*
Pin: release o=Ubuntu, jammy-updates
Pin-Priority: 1001

I removed all the dotnet packages and reinstalled, and now I have both runtimes available as expected:

$ dotnet --info
.NET SDK:
 Version:           8.0.105
 Commit:            eae90abaaf
 Workload version:  8.0.100-manifests.796a77f8

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  22.04
 OS Platform: Linux
 RID:         ubuntu.22.04-x64
 Base Path:   /usr/lib/dotnet/sdk/8.0.105/

.NET workloads installed:
 Workload version: 8.0.100-manifests.796a77f8
There are no installed workloads to display.

Host:
  Version:      8.0.5
  Architecture: x64
  Commit:       087e15321b

.NET SDKs installed:
  6.0.128 [/usr/lib/dotnet/sdk]
  8.0.105 [/usr/lib/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.28 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.5 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.28 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.5 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

@NikolaMilosavljevic
Copy link
Member

@RussKie I see that you have Microsoft feed registered, so Ubuntu will try to obtain packages from both Ubuntu (Jammy) and Microsoft (PMC) feeds. This is an unsupported scenario as you would end up with a mix of packages and it won't work correctly as packages from these 2 feeds install to different paths.

This issue offers solutions based on your intended experience:
Installing .NET 6 on Ubuntu 22.04 (Jammy) · Issue #7699 · dotnet/core (github.com)

@marcpopMSFT
Copy link
Member

Old issue triage: Closing per Nikola's comment.

@marcpopMSFT marcpopMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Oct 29, 2024
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

6 participants