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

Installing .NET 6 on Ubuntu 22.04 (Jammy) #7699

Open
richlander opened this issue Aug 10, 2022 · 81 comments
Open

Installing .NET 6 on Ubuntu 22.04 (Jammy) #7699

richlander opened this issue Aug 10, 2022 · 81 comments
Labels
area-setup Issues related to installing .NET Core

Comments

@richlander
Copy link
Member

richlander commented Aug 10, 2022

Installing .NET 6 on Ubuntu 22.04 (Jammy)

We announced support for .NET 6 on Ubuntu 22.04 with our May 2022 Updates. At that time, the supported installation methods were manual installation via a tarball or a .deb package via packages.microsoft.com (PMC). .NET 6 is now available natively via Jammy feeds, which can cause conflicts with PMC feeds. You need to apply the following guidance to install .NET 6 reliably and correctly on Ubuntu 22.04+.

More information will be shared shortly on .NET 6 being available natively in the jammy-updates feed. In general, we recommend that you use the native packages from this feed since it is much easier and simpler.

You can use one of the following scenarios:

  • The first two scenarios assume a clean machine. You want .NET 6 packages and haven't installed them before.
  • The second two scenarios assume you're machine is in a mixed-state, that you've installed .NET 6 packages before and don't have the ones you want or are in a bad state.

Related:

Clean machine scenario 1: Use .NET 6 Package via Jammy feed

The easiest approach is to use the .NET 6 package available in Jammy feeds. In this scenario, just install dotnet6 and don't register the PMC feed.

You can do that via the following commands:

sudo apt update && sudo apt -y install dotnet6

You can see this demonstrated with Docker:

$ docker run --rm -it ubuntu:jammy
root@4c9d58f507a3:/# apt update && apt install -y dotnet6
root@444999ffd672:/# dotnet --version
6.0.108

Note: This build of .NET 6 is for the 6.0.1xx band. 6.0.4xx builds are available via PMC. That difference matters most to Windows users. Both builds are supported.

Clean machine scenario 2: Use .NET 6 Package via PMC

You can install .NET 6 on Ubuntu 22.04 from packages.microsoft.com using the following steps:

wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

Configure apt preferences, to prioritize PMC repository, by creating the following file: /etc/apt/preferences

To create the file:

sudo touch /etc/apt/preferences

with contents:

Package: *
Pin: origin "packages.microsoft.com"
Pin-Priority: 1001

Update your APT information:

sudo apt update

Install .NET SDK 6.0:

sudo apt install dotnet-sdk-6.0

Mixed state scenario 1: Use native Jammy packages after installing a previous .NET release from PMC

You may want to switch to using the .NET 6 package available in Jammy after installing .NET 6 from PMC.

Do the following:

  1. Remove all .NET packages

sudo apt remove --purge dotnet*
sudo apt remove --purge aspnetcore*

  1. Delete PMC repository from APT, using any of the typical methods, for instance by deleting the repo .list file

sudo rm /etc/apt/sources.list.d/microsoft-prod.list

  1. Update APT

sudo apt update

  1. Install .NET SDK 6.0

sudo apt install dotnet-sdk-6.0

Mixed state scenario 2: Use PMC packages after installing native Jammy packages

You may want to switch to using packages.microsoft.com packages after installing native packages, potentially because you want to use 6.0.4xx builds.

Do the following:

  1. Remove all .NET packages

sudo apt remove --purge dotnet*
sudo apt remove --purge aspnetcore*

  1. Create apt preferences file as specified in the section above
  2. Install .NET SDK 6.0

sudo apt install dotnet-sdk-6.0

How to identify which packages you'd installed

We'll install .NET 6 with both feeds, from a clean state, and then point the various ways you can identify which feed you installed the package from.

First, let's install the native Jammy packages using the "Clean machine scenario 1" guidance.

rich@kamloops:~$ docker run --rm -it ubuntu:jammy
root@db7fd8ec177e:/# apt update && apt install -y dotnet6
Get:18 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 dotnet6 amd64 6.0.108-0ubuntu1~22.04.1 [20.5 kB]
root@db7fd8ec177e:/# dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.108
 Commit:    4e3a463d2b

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

global.json file:
  Not found

Host:
  Version:      6.0.8
  Architecture: x64
  Commit:       55fb7ef977

.NET SDKs installed:
  6.0.108 [/usr/lib/dotnet/dotnet6-6.0.108/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.NETCore.App]

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

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

Notice that we've installed .NET SDK 6.0.108, installed to /usr/lib/dotnet/, and that the dotnet6 package is being installed from http://archive.ubuntu.com/ubuntu jammy-updates/universe. That's expected for the native packages.

Let's try the same thing with PMC, but with the "Clean machine scenario 2" guidance.

rich@kamloops:~$ docker run --rm -it ubuntu:jammy
root@626dcadc888b:/# apt update && apt install -y wget 
root@626dcadc888b:/# wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
root@626dcadc888b:/# dpkg -i packages-microsoft-prod.deb
root@626dcadc888b:/# rm packages-microsoft-prod.deb
root@626dcadc888b:/# touch /etc/apt/preferences
root@626dcadc888b:/# echo "Package: *" >> /etc/apt/preferences
root@626dcadc888b:/# echo "Pin: origin \"packages.microsoft.com\"" >> /etc/apt/preferences
root@626dcadc888b:/# echo Pin-Priority: 1001 >> /etc/apt/preferences
root@626dcadc888b:/# cat /etc/apt/preferences
Package: *
Pin: origin "packages.microsoft.com"
Pin-Priority: 1001
root@626dcadc888b:/# apt update && apt -y install dotnet-sdk-6.0
Get:11 https://packages.microsoft.com/ubuntu/22.04/prod jammy/main amd64 dotnet-sdk-6.0 amd64 6.0.400-1 [86.4 MB]
root@626dcadc888b:/# dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.400
 Commit:    7771abd614

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

global.json file:
  Not found

Host:
  Version:      6.0.8
  Architecture: x64
  Commit:       55fb7ef977

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

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

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

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

Notice that we've installed .NET SDK 6.0.400, installed to /usr/share/dotnet/, and that the dotnet6 package is being installed from https://packages.microsoft.com/ubuntu/22.04/prod jammy/main. That's expected for PMC packages.

We can also tell if the Microsoft PMC feed is registered:

root@626dcadc888b:/# ls /etc/apt/sources.list.d/
microsoft-prod.list
root@626dcadc888b:/# cat /etc/apt/sources.list.d/microsoft-prod.list 
deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/ubuntu/22.04/prod jammy main

If you are using native packages, that file won't and shouldn't be present.

@omajid
Copy link
Member

omajid commented Aug 10, 2022

Should we add these to https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-mixup ?

@mirespace
Copy link

Should we add these to https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-mixup ?

A set of modifications for the page was here too: dotnet/docs#30457 (comment)

@smitssjors
Copy link

https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#2204 should be updated too.

@richlander
Copy link
Member Author

Can you elaborate @bastare?

@khteh
Copy link

khteh commented Aug 13, 2022

Tried the steps but to no avail.
Ubuntu 22.04

$ dn --info

global.json file:
  Not found

Host:
  Version:      6.0.8
  Architecture: x64
  Commit:       55fb7ef977

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.8 [/usr/lib/dotnet/dotnet6-6.0.108/shared/Microsoft.NETCore.App]

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

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info

@owenholloway
Copy link

This is specific to package version 6.0.8+. Downgrading to 6.0.7 resulted in the SDK showing.

@richlander
Copy link
Member Author

Did folks who are having this problem follow the instructions? If so, did you go with scenario 1 or 2?

@jub0t
Copy link

jub0t commented Aug 13, 2022

Thanks so much, I've been trying to fix the error for hours, Scenario 1 did it for me.

Edit: I was using Ubuntu Jammy.

@richlander
Copy link
Member Author

richlander commented Aug 13, 2022

I updated the scenarios to make them clearer. We now have two "Clean machine" scenarios and two "Mixed-state" scenarios. I've kept the numbering the same.

BTW: We are very sorry that this situation occurred. We should have predicted that it would but sadly did not. That's on us. We've learned that mix-and-matching package feeds with the same package names that install to different locations is a recipe for what we're seeing here. Again, we're sorry about that and won't repeat it.

@khteh
Copy link

khteh commented Aug 14, 2022

Why is there this sudden change of installation steps?
Is this going to be the one used moving forward?

@ar0311
Copy link
Contributor

ar0311 commented Aug 14, 2022

What do we do if we want powershell installed from PMC but to install SDK from jammy repo?

Also removing and re-installing dotnet* and aspnetcore* did not fix the issue for me either.

@alexisatkinson
Copy link

Did folks who are having this problem follow the instructions? If so, did you go with scenario 1 or 2?

After some trial and error, found this github issue and went with "Clean machine scenario 2: Use .NET 6 Package via PMC" as this allows using the latest dotnet 6 sdk version. These instructions worked well.

@mickdelaney
Copy link

How can I get dotnet 5 SDK installed on 22.04 ?
Its not supported using packages.
does this mean i cant use the native packages if i want to use SDK 5 & 6 ?

ldennington added a commit to ldennington/git-credential-manager that referenced this issue Aug 15, 2022
The dotnet team recently added support for installing natively from Jammy feeds on
Ubuntu:

dotnet/core#7699

This caused our current installation to fail, as it caused conflicts with
the packages.microsoft.com feed we use in the install from source script
for Debian/Ubuntu.

This change separates the Ubuntu and Debian install from source
processes, since Debian does not natively support Jammy feeds and continuing to try to
install from packages.microsoft.com on Ubuntu would require munging the
priority of feeds, which users would likely not appreciate.

fixes
ldennington added a commit to ldennington/git-credential-manager that referenced this issue Aug 15, 2022
The dotnet team recently added support for installing natively from Jammy feeds on
Ubuntu:

dotnet/core#7699

This caused our current installation to fail, as it caused conflicts with
the packages.microsoft.com feed we use in the install from source script
for Debian/Ubuntu.

This change separates the Ubuntu and Debian install from source
processes, since Debian does not natively support Jammy feeds and continuing to try to
install from packages.microsoft.com on Ubuntu would require munging the
priority of feeds, which users would likely not appreciate.

fixes
ldennington added a commit to ldennington/git-credential-manager that referenced this issue Aug 15, 2022
The dotnet team recently added support for installing natively from Jammy feeds on
Ubuntu:

dotnet/core#7699

This caused our current installation to fail, as it caused conflicts with
the packages.microsoft.com feed we use in the install from source script
for Debian/Ubuntu.

This change separates the Ubuntu and Debian install from source
processes, since Debian does not natively support Jammy feeds and continuing to try to
install from packages.microsoft.com on Ubuntu would require munging the
priority of feeds, which users would likely not appreciate.

fixes
ldennington added a commit to ldennington/git-credential-manager that referenced this issue Aug 15, 2022
The dotnet team recently added support for installing natively from Jammy feeds on
Ubuntu:

dotnet/core#7699

This caused our current installation to fail, as it caused conflicts with
the packages.microsoft.com feed we use in the install from source script
for Debian/Ubuntu.

This change separates the Ubuntu and Debian install from source
processes, since Debian does not natively support Jammy feeds and continuing to try to
install from packages.microsoft.com on Ubuntu would require munging the
priority of feeds, which users would likely not appreciate.

fixes
ldennington added a commit to ldennington/git-credential-manager that referenced this issue Aug 15, 2022
The dotnet team recently added support for installing natively from Jammy feeds on
Ubuntu 22.04:

dotnet/core#7699

This unfortunately created problems with our current install from source
script, as it caused conflicts with
the packages.microsoft.com feed we use in the install from for Debian/Ubuntu.

This change modifies the Debian/Ubuntu dotnet install to install from
Jammy feeds for users on Ubuntu 22.04 and greater while continuing to use
the packages.microsoft.com feed for Debian and older Ubuntu versions.
@carstencodes
Copy link

In our company we're using a mirror with the same starting url for both feeds - PMC and Ubuntu sources.

Hence pinning won't work by setting

Pin: release mirror.company.com

Instead the following configuration works for me:

Package: *
Pin: release o=microsoft-ubuntu-jammy-prod jammy, n=jammy, a=jammy, c=main
Pin-Priority: 1001

Just in case anybody has a similar issue...

@richlander
Copy link
Member Author

@mickdelaney Only .NET 6+ is supported on Ubuntu 22.04. That's unrelated to this discussion. See: #7038 (comment)

.NET 6 is our first release to support OpenSSL v3. Ubuntu 22.04 only includes OpenSSL v3. As a result .NET 5 cannot function. You can install OpenSSL v1.x yourself if needed. We don't support that. Same thing with .NET Core 3.1. Also, .NET 5 is EOL.

ldennington added a commit to ldennington/git-credential-manager that referenced this issue Aug 15, 2022
The dotnet team recently added support for installing natively from Jammy feeds on
Ubuntu 22.04:

dotnet/core#7699

This unfortunately created problems with our current install from source
script, as it caused conflicts with
the packages.microsoft.com feed we use in the install from for Debian/Ubuntu.

This change modifies the Debian/Ubuntu dotnet install to install from
Jammy feeds for users on Ubuntu 22.04 and greater while continuing to use
the packages.microsoft.com feed for Debian and older Ubuntu versions.
ldennington added a commit to ldennington/git-credential-manager that referenced this issue Aug 15, 2022
The dotnet team recently added support for installing natively from Jammy feeds on
Ubuntu 22.04:

dotnet/core#7699

This unfortunately created problems with our current install from source
script, as it caused conflicts with
the packages.microsoft.com feed we use in the install from for Debian/Ubuntu.

This change modifies the Debian/Ubuntu dotnet install to install from
Jammy feeds for users on Ubuntu 22.04 and greater while continuing to use
the packages.microsoft.com feed for Debian and older Ubuntu versions.
@rodrigo-speller
Copy link

@richlander better use /etc/apt/preferences.d/dotnet instead of /etc/apt/preferences ;)

sudo sh -c "cat > /etc/apt/preferences.d/dotnet <<'EOF'
Package: dotnet*
Pin: origin packages.microsoft.com
Pin-Priority: 1001
EOF"
sudo sh -c "cat > /etc/apt/preferences.d/aspnet <<'EOF'
Package: aspnet*
Pin: origin packages.microsoft.com
Pin-Priority: 1001
EOF"

I'm trying to install dotnet 6 and 7 (sudo apt install dotnet-sdk-6.0 dotnet-sdk-7.0). That works for me.

@kitingChris
Copy link

kitingChris commented Feb 21, 2023

Been struggling for hours with this. Soooo frustrating - Should be simple. I am new to Linux.

Latest error : A fatal error occurred. The folder [/usr/share/dotnet/host/fxr] does not exist ( dotnet --info)

When I run dotnet --list-runtimes, I only see 7.0.3. It seems the 6 & 7 sdks are there but only the 7 runtime. I have tried to install the ver 6 runtime many many times.

So, more errors when I try and run a .net 6 project:

Framework: 'Microsoft.NETCore.App', version '6.0.0' (x64) .NET location: /usr/share/dotnet/ The following frameworks were found: 7.0.3 at [/usr/share/dotnet/shared/Microsoft.NETCore.App] Learn about framework resolution: https://aka.ms/dotnet/app-launch-failed To install missing framework, download: https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=ubuntu.22.04-x64 . Please check the diagnostic logs for more information.

I have tried to install .net 6 using all scenarios - nothing works. So... back to a full uninstall of everything .net.

What a mess

There seems to be an issue in the ubuntu repos.

This command will create a setting that let apt prefer the microsoft packages over the ones from ubuntu.

sudo sh -c "cat > /etc/apt/preferences.d/dotnet <<'EOF'
Package: dotnet*
Pin: origin packages.microsoft.com
Pin-Priority: 1001
EOF"
sudo sh -c "cat > /etc/apt/preferences.d/aspnet <<'EOF'
Package: aspnet*
Pin: origin packages.microsoft.com
Pin-Priority: 1001
EOF"

@kitingChris
Copy link

sudo apt-get remove --purge dotnet-*
And then reinstall.

Not a dotnet dev myself but supporting collegues that do.
With Rider or vscode as IDE.

@kitingChris
Copy link

Didn't heard something not working but we are yet starting to migrate applications to .net 7.0

@dhduvall
Copy link

dhduvall commented Mar 2, 2023

sudo sh -c "cat > /etc/apt/preferences.d/dotnet <<'EOF'
Package: dotnet*
Pin: origin packages.microsoft.com
Pin-Priority: 1001
EOF"
sudo sh -c "cat > /etc/apt/preferences.d/aspnet <<'EOF'
Package: aspnet*
Pin: origin packages.microsoft.com
Pin-Priority: 1001
EOF"

I needed to add another clause for netstandard* because netstandard-targeting-pack-2.1 was being installed as a dependency of dotnet-sdk-6.0 and was otherwise coming from the Ubuntu repos.

@MatthieuHernandez
Copy link

I have the same problem:

matt@MattPc:~/Matt/linux$ apt list -a dotnet-sdk-6.0
Listing... Done
dotnet-sdk-6.0/jammy,now 6.0.408-1 amd64 [installed]
dotnet-sdk-6.0/jammy 6.0.407-1 amd64
...

But:

matt@MattPc:~/Matt/linux$ dotnet --info

global.json file:
  /mnt/c/Programming/Git/Matt/linux/global.json

Host:
  Version:      6.0.16
  Architecture: x64
  Commit:       1e620a42e7

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.NETCore.App 6.0.16 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

I was able to make it work with SDK 6.0.16 but I need the SDK 6.0.408 for a project.

I also try the script provide by Microsolf to install dotnet:

matt@MattPc:~/Matt/linux$ ./dotnet-install.sh
dotnet-install: .NET Core SDK with version '6.0.408' is already installed.

But still desn't detect when I run dotnet --info.

@LucasMaciuga
Copy link

LucasMaciuga commented Jun 30, 2023

What I did to Installing .NET 7 on Ubuntu 22.04 (Jammy)

# Purge old packages
sudo apt-get remove 'dotnet.*'
sudo apt-get remove 'aspnet.*'

# Get Ubuntu version
declare repo_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi)

# Download Microsoft signing key and repository
wget https://packages.microsoft.com/config/ubuntu/$repo_version/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

# Install Microsoft signing key and repository
sudo dpkg -i packages-microsoft-prod.deb

# Clean up
rm packages-microsoft-prod.deb

# Update packages
sudo apt update

see https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#register-the-microsoft-package-repository

Then followed @kitingChris suggestion

sudo sh -c "cat > /etc/apt/preferences.d/dotnet <<'EOF'
Package: dotnet*
Pin: origin packages.microsoft.com
Pin-Priority: 1001
EOF"
sudo sh -c "cat > /etc/apt/preferences.d/aspnet <<'EOF'
Package: aspnet*
Pin: origin packages.microsoft.com
Pin-Priority: 1001
EOF"
sudo apt install dotnet-sdk-7.0 

That worked for me - everything else did not.

@dustinmoris
Copy link

I followed all the steps, still couldn't get anything back from dotnet --list-sdks. Then I read somewhere that I also had to uninstall dotnet-host and I reran the steps from here an now I'm getting this error:

A fatal error occurred. The folder [/usr/share/dotnet/host/fxr] does not exist

Googling this leads me to many other suggested solutions yet, of which none has worked yet.

Man, I've been trying to upgrade from .NET 6 to .NET 7 on Ubuntu 22.04 for the last 3 hours now and not only does it not work, .NET is now completely broken and I'm unable to get it back into a working state again. What an abysmal experience.

@dustinmoris
Copy link

Ok if someone else comes here and thinks that .NET just doesn't seem to install on Ubuntu 22.04 then there's hope. This is the only solution that worked for me:

First run this:

curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin -c 7.0.2xx

Then add this to your .bashrc:

export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools

@NikolaMilosavljevic
Copy link
Member

@dustinmoris are you registering Microsoft package feed or rely on native Ubuntu package feeds? It seems that you do want to install 7.0.2xx feature band - solution for this scenario is provided in Mixed-state scenario 2 section of the first comment in this GitHub issue.

.NET 6 and 7 are provided in native Ubuntu feeds. The following page describes steps to install either .NET version on Ubuntu 22.04: https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-2204 On that page, it is called out that only one package feed should be registered at the time to avoid issues you have hit.

@loop-evgeny
Copy link

loop-evgeny commented Oct 26, 2023

Ubuntu 22.04, .NET 6.0 - was originally set up using PMC, with the APT preferences file as described in this issue:

# cat /etc/apt/preferences.d/microsoft 
Package: *
Pin: origin "packages.microsoft.com"
Pin-Priority: 1001

All seemed to work, but after last last night's unattended upgrade of the .NET packages we get the dreaded

A fatal error occurred. The folder [/usr/share/dotnet/host/fxr] does not exist

So it seems that it somehow ended in the "mixed scenario", even though we had the APT preferences file - and it seems to have been effective on other machines during previous upgrades!

/var/log/apt/term.log contains:

Log started: 2023-10-26  06:25:59
...
(Reading database ... 120909 files and directories currently installed.)
Preparing to unpack .../dotnet-hostfxr-6.0_6.0.124-0ubuntu1~22.04.1_amd64.deb ...
Unpacking dotnet-hostfxr-6.0 (6.0.124-0ubuntu1~22.04.1) over (6.0.23-1) ...
Setting up dotnet-hostfxr-6.0 (6.0.124-0ubuntu1~22.04.1) ...
Log ended: 2023-10-26  06:26:00

Edit: The problem was probably our unattended upgrades config, which had this:

Unattended-Upgrade::Allowed-Origins {
    "${distro_id}:${distro_codename}-updates"; // Allow non-security updates
};

So we allowed unattended upgrades from the Ubuntu APT source, but not from the MS one. The intention was to not upgrade .NET automatically (because that often breaks a running application!) so we've now added this:

Unattended-Upgrade::Package-Blacklist
{
    "dotnet.*";
    "aspnetcore.*";
};

Hopefully that's effective, but we won't know for sure until the next update of .NET is released.

@jhf
Copy link

jhf commented Mar 13, 2024

All seemed to work, but after last last night's unattended upgrade of the .NET packages we get the dreaded
...
So it seems that it somehow ended in the "mixed scenario", even though we had the APT preferences file - and it seems to have been effective on other machines during previous upgrades!

For those that wish to have unattended upgrades of dotnet, how about following https://askubuntu.com/a/1435868 and adding

Unattended-Upgrade::Allowed-Origins {
  ...
  "microsoft-ubuntu-${distro_codename}-prod ${distro_codename}:${distro_codename}";    
};

@siwatanejo
Copy link

Ok if someone else comes here and thinks that .NET just doesn't seem to install on Ubuntu 22.04 then there's hope. This is the only solution that worked for me:

@dustinmoris I hope no one tries to follow/read your comment, because it is very misplaced. This github issue is about Ubuntu packages of .NET x.y.z (which means, packages provided by the Ubuntu distribution, so that you can install directly with the native package manager tool apt without external scripts or external sources).

@siwatanejo
Copy link

This issue still hasn't been fixed.

This github issue is not a bug.

And .net 9 is in preview...

See the title of this issue, it's about .NET6. If you have issues with .NET9 open a new github issue?

@siwatanejo
Copy link

What issue? what tickets? sigh

@richlander
Copy link
Member Author

FYI on our plan for Ubuntu 24.04 packages

#9258

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-setup Issues related to installing .NET Core
Projects
None yet
Development

No branches or pull requests