dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.73k stars 1.07k forks source link

workload install command in dot-net 8 doesn't work #40721

Open NourAldynKMHD opened 7 months ago

NourAldynKMHD commented 7 months ago

URL(s)

https://github.com/dotnet/core/issues?q=is%3Aissue+is%3Aopen+author%3ANourAldynKMHD

Description

on my Linux PC I'm trying to install dotnet-sdk and its workload when I'm trying to download any work load using dotnet workload install maui-android it give me this error

Unhandled exception: System.IO.IOException: Read-only file system : '/snap/dotnet-sdk/239/metadata' at System.IO.FileSystem.CreateDirectory(String fullPath, UnixFileMode unixCreateMode) at System.IO.Directory.CreateDirectory(String path) at Microsoft.DotNet.Workloads.Workload.Install.WorkloadInstallerFactory.CanWriteToDotnetRoot(String dotnetDir) at Microsoft.DotNet.Workloads.Workload.Install.WorkloadInstallerFactory.GetWorkloadInstaller(IReporter reporter, SdkFeatureBand sdkFeatureBand, IWorkloadResolver workloadResolver, VerbosityOptions verbosity, String userProfileDir, Boolean verifySignatures, INuGetPackageDownloader nugetPackageDownloader, String dotnetDir, String tempDirPath, PackageSourceLocation packageSourceLocation, RestoreActionConfig restoreActionConfig, Boolean elevationRequired, Boolean shouldLog) at Microsoft.DotNet.Workloads.Workload.Install.WorkloadInstallCommand..ctor(ParseResult parseResult, IReporter reporter, IWorkloadResolverFactory workloadResolverFactory, IInstaller workloadInstaller, INuGetPackageDownloader nugetPackageDownloader, IWorkloadManifestUpdater workloadManifestUpdater, String tempDirPath, IReadOnlyCollection`1 workloadIds) at Microsoft.DotNet.Cli.WorkloadInstallCommandParser.<>c.b__6_0(ParseResult parseResult) at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult) at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)

I have searched a lot but I don't find any one who fix the problem so what I have to do

jamesmontemagno commented 7 months ago

Moving this over to the .NET MAUI repo

NoTuxNoBux commented 4 months ago

This sounds similar to https://github.com/dotnet/maui/issues/23219 that I just created. Ubuntu snaps are also sandboxed from what I gather, just like Flatpaks, and it seems like .NET is installed in a read-only filesystem. From what I understand this makes it impossible to install MAUI workloads, even if using sudo would be possible (which usually doesn't exist in Flatpaks).

The workaround for now is to not use .NET 8 within Flatpak-ed or snapped apps, or alternatively use something like flatpak-spawn --host dotnet ... and have .NET 8 installed on the host instead.