-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Cannot run dotnet command after installing 6.0 RC/preview using snap #4446
Comments
Try running |
That actually cannot work, since
So when I try to execute This is what the output of
So this is not something easily fixed by changing file permissions. |
So try running I've installed Ubuntu on my machine and |
Yes, that does indeed do something. However, any downloaded Nuget packages will be owned by root, so you have to manually The regular |
if you run |
Yes, I think it is a problem in the snap package itself, the folder permissions are wrong. I don't know how to work around this, though, because the snap package is mounted as read-only and I have no idea where the mounted file itself is located. |
I found a workaround. It is possible to fix the snap package :) These are the commands I used to find where the actual package file is located, extract it to a new location, fix the permissions, create a new package and replace the old one: Note: I updated this workaround for the .NET 6 snap. # Install the .NET 6 SDK as a snap package.
# The snap package will automatically be mounted.
snap install dotnet-sdk --channel=6.0/beta --classic
# Try running the snap command. If this works, you do not have to
# apply the workaround. If this fails, continue.
dotnet-sdk.dotnet --version
# To find out where the snap package has been mounted,
# list all block devices and look for /snap/dotnet-sdk/
# in the MOUNTPOINT column. Remember the name of the loop
# device.
lsblk
# To get the actual path of the snap package file, run
# the following command with the name of the loop device.
# Replace XXX with the number of your loop device.
# The path in the BACK-FILE column points to the snap package.
losetup --list /dev/loopXXX
# Create a folder where we're extracting the snap package into.
mkdir dotnet-snap-fix
cd dotnet-snap-fix
# Extract the snap package into this directory.
# Add the correct BACK-FILE path to your snap package here.
# Replace XXX or the whole path with the BACK-FILE displayed by
# the losetup command above.
sudo unsquashfs /var/lib/snapd/snaps/dotnet-sdk_XXX.snap
# Change the permissions of the snap folder containing the runner
# to be readable and executable. This will fix the permission problem.
sudo chmod -R +rx ./squashfs-root/snap/
# Create a new snap package with the changed permissions.
# Make sure to use the same file name as in the BACK-FILE path.
# Replace XXX or the whole file name with the file name of the
# BACK-FILE path displayed by the losetup command above.
sudo mksquashfs ./squashfs-root/ dotnet-sdk_XXX.snap -comp xz -all-root
# Overwrite the old snap package with our new one.
# Make sure the file name is correct (same as in BACK-FILE).
sudo mv ./dotnet-sdk_XXX.snap /var/lib/snapd/snaps/
# Finally reboot your machine so the changes are detected.
sudo reboot
# Do not use snap disable / snap enable, they will replace the
# fixed snap package with the broken one again.
# After the reboot, the dotnet-sdk.dotnet command will work without sudo.
dotnet-sdk.dotnet After that horrendous "fix", the command works without sudo:
|
It works like a charm! Thanks for the help. I hope MS fix this in future versions! |
Preview 2 no longer has this issue. |
I'm on 5.0.100-preview.3.20216.6 (installed via
Error on run:
Also, the "horrid fix" steps didn't fix it. Ended up with the same error after the reboot 😢 I'm on a raspberry pi 4 B:
|
We're seeing this issue with .NET 5.0.400:
Downgrading the snap package resolved it. |
Also seeing this issue, but when i run snap revert is shows: |
same here for .NET 5.0.400 |
@Tasty213
Should do the trick. |
Same issue here also, version latest/stable: 5.0.400, installed with snap. Installing latest/edge: 5.0.202 2021-04-16 (120) 137MB classic) fixed my issue for now.
You can see the versions with |
Same issue here .NET 3.1.412. Snap revert worked. Can I hold the snap packages somehow? |
This is a temporary fix but, worked fine for me.
After that you can remove the sdk with |
Worked for me. Thanks! |
Me too :) |
Also getting this issue with .NET 6.0 preview 7 snap. sudo snap revert dotnet-sdk worked, however it's no longer preview 7 but preview 6 which is a bit pointless |
didn't work with me
also, the issue is still present with the latest stable
|
Hope this gets resolved soon, but atleast the fix worked :)
|
Why would the dotnet package be installed under root permission? |
For dotnet-sdk-3.1 the following worked for me:
Then
source: https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#2004- |
Thats for the deb package. This issue is regarding installation using snap package. |
The @nikonthethird workaround fix the "permission denied", thanks. Nonetheless, when I do a "
|
This also happens on a
|
It appears this permissions issue related to the automatic |
Flatpak is a much better system as MS can host the repository while Snap you can't. |
@nikonthethird thanks dude, it works beaut here. |
Issue still present on 6.0.101. Workaround works. |
I followed the official instructions for installing dotnet sdk 6.0 https://docs.microsoft.com/en-us/dotnet/core/install/linux-snap on Ubuntu 21.04 and ended up here. How is this still and problem yet this issue is closed? |
"How is this still and problem yet this issue is closed?" But for real if Snap has this many problems MS... please use Flatpak... kinda ridicules as this point. |
This is still an issue.
This is with 6.0.101. |
same issue here |
Same issue with 6.0.101 |
I confirm the issue with 6.0.101 on Ubuntu 21.10
|
Seems like this problem still persists across all .NET 6.0 versions. Best solution would be to use version 5 like @merto-dvp's or @nikonthethird's if you need version 6. -- Debian 11 x64 |
It appears to be problem with snap alias. Just unalias the snap and symlink the binary instead.
You should then be able to call |
It still doesn't work... with the 6th version of .net - tried changing the alias however the snap libraries don't look like that for me. @Xeevis |
This problem is fixed with version 7.0.0 in case anyone doesn't mind upgrading from 6.0 |
Had the same issue on Ubuntu. Replace 5.0 with desired version :)
And now |
This is still an issue with snap and even on the 7.0 version on my side. I use Solus so I don't have a native version on the repo so "install as apt" is not a solution on my side. |
On my raspberry pi I installed .Net runtime and .Net core SDK. But, it only shows runtime and it can not find the SDK.
(Used resource: https://snapcraft.io/install/dotnet-sdk/raspbian) |
Try looking in |
@tznind |
Ah that looks like WinForms. I think you can't compile WinForms on linux. If you can compile a basic app e.g. See https://stackoverflow.com/questions/60912058/how-to-install-and-use-winforms-in-vscode-on-linux |
@ksandaru You can only use WinForms on Linux if you use the Mono Runtime. |
I saw many articles that saying mono is deprecated..mono still works?? |
@ksandaru Mono runtime is still under active development and is what powers C# apps to run on Android, iOS & WASM etc. If you're just trying to get legacy software to work on Linux with WinForms use Mono. |
Thank you..got it! |
The
dotnet
command cannot be executed after installing snapGeneral
I followed these instructions to install the .NET 5.0 preview using
snap
.After installation, when I try to execute the
dotnet
command, I get the following error message:This is because the directory
/snap/dotnet-sdk/67/snap
is only accessible by root and is a mounted file system, so it is not possible tochmod
it.I am using a fresh Ubuntu 18.04 install, so there should not be any other conflicts.
The text was updated successfully, but these errors were encountered: