How to upgrade from Microsoft.NETCore.App 6.0.13 to Microsoft.NETCore.App 6.0.16 on Ubuntu 22.04LTS?
I recently did a micro-update on my developer machine and now my machine is running Microsoft.NETCore.App 6.0.16 on Windows 11 while my Ubuntu server is running Microsoft.NETCore.App 6.0.13. Big mistake. Now my code won't run on the server because it is 3 minor versions behind.
I've tried but that just re-installs the 6.0.13 version. I also see this downloads page contains downloads for linux but idk how to install them. https://dotnet.microsoft.com/en-us/download/dotnet/6.0
Any help would be super excellent.
Microsoft
Download .NET 6.0 (Linux, macOS, and Windows)
.NET 6.0 downloads for Linux, macOS, and Windows. .NET is a free, cross-platform, open-source developer platform for building many different types of applications.
163 Replies
just do a normal
apt upgrade
separate from that, what you describe isn't really how
.NET works
what your program runs on isn't really tied to what is on your dev machine
not really
if your target environment only has 6.0.13, then don't build to target 6.0.16
(even that really doesn't make sense, your target would be "net6.0", patch version doesn't even come into play)
whatever's going on here, I don't think it's a versioning issue, as you describe it
YESSSS
Aw.
Okay, yeah. Lesson learned. Don't dev on latest versions when other people have earlier versions.
Eh. Oh. Not a version issue. Alright. Time to find out then.
Just got the right version installed.
Dammit. I hate devops.
K, this says something about location...
did you do an
apt upgrade
?I'll do it now.
if that doesn't fix it, show us the output of
dotnet --info
Aw man. This going to ruin plesk at all?
plesk?
I have no idea
Idk if it is related or not
PAM is the Linux auth stack
I still fail to understand how it's possible to produce a build that runs on 6.0.16 but not on 6.0.13
It isn't a self contained build. Maybe that means exact version matches are required.
my upload speed is ass tho. lol
if it's a self-contained build, then the version of .NET that's installed on the server is irrelevant
that's the whole point of a self-contained build, it doesn't rely on an external installation of .NET
they said it's not
oh, well, I misread that
no, exact version matches aren't how .NET works
your target framework is net6.0
or maybe net6.0-windows, which has some sub-versioning
but is clearly not the case here
Upgrade is finished...
enough theorizing, show your project file
Sure.
voice?
no
just show the $code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
If your code is too long, post it to: https://paste.mod.gg/(or the project xml rather)
yeah
or at least the relevant chunks of it
Sdk
, <TargetFramework>
etc.oh my
so
you're not on .NET 6?
<TargetFramework>net6.0</TargetFramework>
that's not a .NET MSBuild file, though
oh, there we go
what the hell was that first file?
publish settings
mm-kay
I'm actually uploading a full project zip, if it helps
anyway, yeah, none of that is gonna be affected by differing patch versions in the server and dev runtimes
it won't
in any case
by definition, different patch versions won't cause you any breaking changes
Okay. Great. So that rules tthat out. Kind of. Error logs all keep saying that it's that though.False alarm.
that second screenshot above is the relevant errors from you trying to run this on the server?
Different error versions though
more likely, you're misreading them
Another one of my projects on the same machine also broke today. Same error reasons
Yep. That is the error log.
You must install .NET to run this application
suggests it's not a versioning issue, it's a lack of ANY version issue
Hmmm
how are you running the app?
I have things installed. Maybe some env var is missing.
something to that effect is what I'm thinking, yeah
you quite literally just installed the current version and showed the logs from it, you definitely have dotnet installed
I have a service file installed at: /etc/systemd/system/api.taylorlove.info.service
I'm definitely not very familiar with linux services
is that saying that
/var/www/vhosts/taylorlove.info/services/api.taylorlove.info/ApiCore.Web
is an executable file?
the executable that is your program?Yes it is
again, not familiar with linux publishing models
but you say this used to work
what happens if you try to launch this manually?
or even with
dotnet [file]
?let me trry it
guess
dotnet
isn't in your env vars?it worked from wherever you were running it before
that right there could be the entire issue
it THINKS dotnet isn't installed, cause it's not in the env vars, or whatever it is on linux
possibly
Let me dump the vares
PATH is the var you're looking for
you need to put the dotnet install folder into PATH
IIRC
echo $PATH
to see what the current value is
yeahI don' see lib in the path vars
HRMMM
so, I dunno what the "proper" way to do it is, for your setup, but in one way or another, you need to do that
OR
just manually call
dotnet
from its path
[PathToDotnet]/dotnet ApiCore.Web
supposedly export PATH="PathToAdd:$PATH"
should add to the current variable, but I dunno if that's permanent, or what scope that edits
PATH variables are defined in /etc/environment
and /etc/profile
, depending on what scope you want
per user config is in ~/.bashrc
damn
I edited /etc/environment
and it didn't work?
echo $PATH
if it's not there, you probably need to force the shell vars to refreshI did
source /etc/environment
well, forget the path var for now
maybe the path for DOTNET_ROOT is wrong?
can you run it all manually
is that an env var?
ehhh. Yes.
is the path correct?
if I type env it shows up.
?
Im running it manually and it ffails
THat's what the pic means
no, you're not
you're trying to run it lazily
relying on the boostrapper within the program to find dotnet for you
hmmmm
launch it through dotnet manually
how?
[dotnet] [assembly]
yes
dotnet
is not a command
it's an executable file that's sitting somewhere
as are all commands in linux
your shell only knows it exists if it's in one of the folders defined in PATH
since we couldn't figure that out, we are forgetting about that for now, and launching it manuallyOkay idk which command to run here to do this manually.
(thank you for sticking with me so long sorry it isn't figured out yet)
/usr/bin/dotnet
clearly executes
and tells you how it works
dotnet [path-to-application]
so, now supply [path-to-application]
and do this all from within your application directorywhere the app expects to be run from
maybe it needs an absolute path?
THat wasnt it
does it need to be
./usr/bin/dotnet
no that isnt found
:/
It's a dedicated machine, so... full access.
oh, I guess cause
./
means "relative to current directory"
well, I dunno what the hell that's about
/usr/bin/dotnet ApiCore.Web
should absolutely be it
if ApiCore.Web
is an executable assembly file in that directory
does it need to be /usr/bin/dotnet run ApiCore.Web
?!!
Maybe
also
GitHub
.NET runtime not found on Ubuntu · Issue #79237 · dotnet/runtime
Description My weekly GitHub actions build started failing. I suspect some change in Ubuntu .NET 6 results in the apps no longer running, and complaining no runtime found. Docker: # Build externall...
/usr/lib/dotnet --info
-bash: cd: /etc/dotnet/install_location: Not a directory
yeah
I think you've got a bogus install
like, an old version
Yeah, that would make some sense.
I tried uninstalling everything before and it gogt me closer but still not perfect
this definitely looks like it was a bug introduced not too long ago
the logic for how a linux app searches for the dotnet install changed a bit, so when you upgraded on your dev machine, it changed the build output enough to break
so, it's SORT of a version issue, but definitely not a normal scenario
simplest resolution, in my mind, is to wipe and reinstall the server to latest
and upgrade to latest on the dev machine
uhhh
you mean a brand new os install?
nono, just the dotnet apt install
other than that, dig through that github thread, all the specifics about what files and variables need to be defined to make it work appear to be in there
this was from December of last year, so should still be valid info
aha
0
Step 1: Uninstall https://askubuntu.com/a/1386715/231561
Step 2: Set props in preferences.d https://stackoverflow.com/a/73899341/16454
Step 3: Install with some explicit values https://github.com/dotnet/sdk/issues/27082#issuecomment-1211181940
Ask Ubuntu
How to uninstall dotnet from Ubuntu 20.10 completely?
I have installed dotnet on my Ubuntu 20.10 but for some reason I want to remove it but I don't know how to do it please help.
Stack Overflow
A fatal error occurred. The folder [/usr/share/dotnet/host/fxr] doe...
Ubuntu 22.04
dotnet --info
Can't access dotnet after update.
Reinstall dotnet and vscode didn't help
GitHub
[Ubuntu 22.04] dotnet doesn't find installed SDKs · Issue #27082 · ...
Describe the bug I've followed instructions to install dotnet sdk via the package manager and the microsoft packages repository. dotnet find runtime but not sdk. however it seems that sdk is in...
yeah one comment specifically states that adding the right directory to
PATH
isn't sufficient for executables to workO_O
It does?
on github?
yeah, the thread I linked
GitHub
.NET runtime not found on Ubuntu · Issue #79237 · dotnet/runtime
Description My weekly GitHub actions build started failing. I suspect some change in Ubuntu .NET 6 results in the apps no longer running, and complaining no runtime found. Docker: # Build externall...
PATH lets you use
dotnet
in bash, anywhere, but self-starting executables look for either the DOTNET_PATH env var, or the /etc/dotnet/install_location file
STILL doesn't quite explain why you can't manually run, by pathing it all out yourself, that's why I think maybe you got a bogus install
either that, or I just don't know what I'm talking about
like, there was one mention that /usr/lib/dotnet
isn't the normal install location
I dunno
I think that thread ought to get you where you need to goMaybe.
maybe a missing lib...
hmmm
well, that seems like progress?
It does.
did you have to set that DOTNET_PATH value, or did it get setup when you reinstalled?
if you set it yourself, it's probably wrong
the default install directory is
/usr/share/dotnet
unless that's empty
I had to set it
well, uhhh
I mean
I dunno how to read those, exactly
but that sure doesn't look like
/usr/share/dotnet
to meIt was originally set to /usr/lib/dotnet
I did "which dotnet" to see that dotnet is stored at /usr/bin/dotnet
right, dotnet the executable
Although I suppose that could be a symlink.
I was about to say
I would actually bet that it is
it would make sense
https://taylorlove.info/api/swagger/index.html
I got it to work after uploading a self contained version, and setting the env variables above.
/usr/bin
is a directory that would make sense to already be in PATH
welp
gg, I guess?Let me try my pixelstacker program which is still on the non self contained version
pixelstacker works when I run it manually. https://taylorlove.info/projects/pixelstacker/swagger/index.html
So... yeah, gg.
my god.
Thank you man.
I feel like we didn't REALLY resolve everything
but if it works, it works
Ehhh.... wwhagt does REALLY resolving things look like?
Really ressolving means the svc actually works -_-
IMO
"really" resolving it would be that the build you had that was working before is working again
a non-self-contained build
where your execute action for the service is just
./[MyAppAssembly]
I have two builds uploaded
one that is self contained, one that is not
I thought both of them were non-self-contained, before
I mean, if you wanna switch up your deployment scheme, go ahead
this is kinda EXACTLY the advantage of a self-contained executable
"It works in the DVLP environment? Cool, deploy the whole DVLP environment."
truee
No I definitely do NOT want to switch it up if I dont have to
that's why I'm still trying to get my self contained version to work
only downside is redundant space usage on the server, if you have a lot of self-contained executables
uhhh
I meannnn
storage is cheap
also true
the time it takes me to upload is not. lol
and how many of them DO you have?
is it really just 2?
2 or 3, yeah.
So it isn''t too bad. Not like I'm running a huge server farm.
if it's simpler for you, go for it
Right now the services work for self contained, but not for uncontained.
I can execute the uncontained via cmdline as root user. Not as service.
I'm just obsessive
I also want it to be proper. I'm with you.
nnnnnneat
did you change up the server exec command?
Trying to
this is my etc/environment file right now.
I really don't like how .dotnet is stored in root's home directory.
is it?
I thought it was supposed to be
/usr/share/dotnet
you sure that's not just, like, settings files?For the record.... kind of hate everything right now.
:/
I hate having to reinstall every thing on the entire server every few months bc something gets messed udp.
Alright, I'm going nuclear. I'm finding all dotnet folders on entire system and deleting them. If it works, I get fresh installs. If it fails, I reinstall everything from scratch. All 50 websites, the server, the os, the databases, everything.
It worked thank goodness
omg
well, that's something
I ripped EVERYTHING out. I even uninstalled plesk's .net toolkit extension. Deleted ALL dotnet folders. Re-installed dotnet toolkit and then did a reboot.
the services started everything up just fine and it all works now
go figure
so, yeah
as far as .NET goes, this is NOT something you should expect on a regular basis
upgrading your development SDK did in fact cause this... sort of
but only as a result of A) a bug in the SDK, and B) some crazy shit with the installs on your server
@AnievNekaj can I buy you a beer or something?
do not fear upgrading your SDKs, when everything is working properly, it will not cause you harm
#rules for the record, but I appreciate the thought
er
#info-and-rules
hmmm
I owe you a favor then.
Welp. Midnight. Ima go hit the hay. Thank you so much for everything.
o7
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.