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

mkdir: cannot create directory ‘/usr/share/dotnet’: Permission denied #565

Open
kaby76 opened this issue Dec 12, 2024 · 3 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@kaby76
Copy link

kaby76 commented Dec 12, 2024

Description:
This is the same bug as reported before, #327. Occurred elsewhere for me, at other times in the last few months, with no rhyme or reason, sometimes clearing up by itself.

I am using ubuntu-latest.

Here is the workflow: https://github.com/kaby76/Trash/blob/c93453d26cfdaca2dacce9db26d86f6d78511fcb/.github/workflows/main.yml#L40-L43

Adding this job fixes the problem temporarily until this action plugin works again.

Crashing without it: https://github.com/kaby76/Trash/actions/runs/12297495949/job/34318769805.

Now working with the workaround: https://github.com/kaby76/Trash/actions/runs/12297495949/job/34318769805#step:7:31

The problem is that once your plugin works magically again, this mkdir crashes your plugin.

Please fix your plugin to be more robust so that if the directory exists or not, no problem.

Task version:
4.0.1. Also now just the latest, 4.1.0.

Platform:

  • Ubuntu

Runner type:
It's a github hosted runner using one of they crappy VMs??. https://github.com/kaby76/Trash/blob/c93453d26cfdaca2dacce9db26d86f6d78511fcb/.github/workflows/main.yml

Repro steps:
Every PR kicks off the build and runs into this.

Expected behavior:
It should just work.

Actual behavior:
Fails with mkdir: cannot create directory ‘/usr/share/dotnet’: Permission denied.

@kaby76 kaby76 added bug Something isn't working needs triage labels Dec 12, 2024
@mahabaleshwars
Copy link

Hello @kaby76,
Thank you for creating this issue. We will investigate it and provide feedback as soon as we have some updates.

@acknosyn
Copy link

I'm also getting this error. I'm installing non-default .NET SDK versions in the latest Ubuntu image GitHub runner

I discovered that using this action meant that the default .NET installation wasn't able to be found. So following the recommendation to update installation paths in #554 to get the action to install other .NET versions to the same path as the default, I get these permission-denied errors

If I install the same version as the default .NET SDK (8.X), then it works for my builds. However, I found it strange that the default version could not be used. I'm also seeing that nuget can't be used, but I haven't troubleshot that yet and can't say definitely, but it feels like the same path issue

Build logs
Run actions/setup-dotnet@v4
  with:
    dotnet-version: 6.0.x
  7.0.x
  9.0.x
  
    cache: false
  env: [redacted]
/home/runner/work/_actions/actions/setup-dotnet/v4/externals/install-dotnet.sh --skip-non-versioned-files --runtime dotnet --channel LTS
dotnet-install: Attempting to download using aka.ms link https://dotnetcli.azureedge.net/dotnet/Runtime/8.0.11/dotnet-runtime-8.0.11-linux-x64.tar.gz
dotnet-install: Remote file https://dotnetcli.azureedge.net/dotnet/Runtime/8.0.11/dotnet-runtime-8.0.11-linux-x64.tar.gz size is 31277651 bytes.
dotnet-install: Extracting archive from https://dotnetcli.azureedge.net/dotnet/Runtime/8.0.11/dotnet-runtime-8.0.11-linux-x64.tar.gz
cp: cannot create directory '/usr/lib/dotnet/host/fxr/8.0.11/': Permission denied
cp: cannot create directory '/usr/lib/dotnet/shared/Microsoft.NETCore.App/8.0.11/': Permission denied
dotnet-install: Downloaded file size is 31277651 bytes.
dotnet-install: The remote and local file sizes are equal.
dotnet_install: Error: Failed to verify the version of installed `.NET Core Runtime`.
Installation source: https://dotnetcli.azureedge.net/dotnet/Runtime/8.0.11/dotnet-runtime-8.0.11-linux-x64.tar.gz.
Installation location: /usr/lib/dotnet.
Report the bug at https://github.com/dotnet/install-scripts/issues.
dotnet_install: Error: `.NET Core Runtime` with version = 8.0.11 failed to install with an error.
Warning: Failed to install dotnet runtime + cli, exit code: 1. cp: cannot create directory '/usr/lib/dotnet/host/fxr/8.0.11/': Permission denied
cp: cannot create directory '/usr/lib/dotnet/shared/Microsoft.NETCore.App/8.0.11/': Permission denied
dotnet_install: Error: Failed to verify the version of installed `.NET Core Runtime`.
Installation source: https://dotnetcli.azureedge.net/dotnet/Runtime/8.0.11/dotnet-runtime-8.0.11-linux-x64.tar.gz.
Installation location: /usr/lib/dotnet.
Report the bug at https://github.com/dotnet/install-scripts/issues.
dotnet_install: Error: `.NET Core Runtime` with version = 8.0.11 failed to install with an error.

/home/runner/work/_actions/actions/setup-dotnet/v4/externals/install-dotnet.sh --skip-non-versioned-files --channel 6.0
dotnet-install: Attempting to download using aka.ms link https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.428/dotnet-sdk-6.0.428-linux-x64.tar.gz
dotnet-install: Remote file https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.428/dotnet-sdk-6.0.428-linux-x64.tar.gz size is 188484831 bytes.
dotnet-install: Extracting archive from https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.428/dotnet-sdk-6.0.428-linux-x64.tar.gz
cp: cannot create directory '/usr/lib/dotnet/host/fxr/6.0.36/': Permission denied
cp: cannot create directory '/usr/lib/dotnet/packs/Microsoft.AspNetCore.App.Ref/6.0.36/': Permission denied
mkdir: cannot create directory ‘/usr/lib/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64’: Permission denied
cp: cannot create directory '/usr/lib/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/6.0.36/': No such file or directory
cp: cannot create directory '/usr/lib/dotnet/packs/Microsoft.NETCore.App.Ref/6.0.36/': Permission denied
cp: cannot create directory '/usr/lib/dotnet/sdk-manifests/6.0.300/': Permission denied
cp: cannot create directory '/usr/lib/dotnet/sdk/6.0.428/': Permission denied
mkdir: cannot create directory ‘/usr/lib/dotnet/sdk/6.0.428’: Permission denied
cp: cannot create directory '/usr/lib/dotnet/sdk/6.0.428/DotnetTools/dotnet-dev-certs/6.0.36-servicing.24516.4/': No such file or directory
mkdir: cannot create directory ‘/usr/lib/dotnet/sdk/6.0.428’: Permission denied
cp: cannot create directory '/usr/lib/dotnet/sdk/6.0.428/DotnetTools/dotnet-user-secrets/6.0.36-servicing.24516.4/': No such file or directory
mkdir: cannot create directory ‘/usr/lib/dotnet/sdk/6.0.428’: Permission denied
cp: cannot create directory '/usr/lib/dotnet/sdk/6.0.428/DotnetTools/dotnet-watch/6.0.428-servicing.24517.40/': No such file or directory
cp: cannot create directory '/usr/lib/dotnet/shared/Microsoft.AspNetCore.App/6.0.36/': Permission denied
cp: cannot create directory '/usr/lib/dotnet/shared/Microsoft.NETCore.App/6.0.36/': Permission denied
cp: cannot create directory '/usr/lib/dotnet/templates/6.0.36/': Permission denied
dotnet-install: Downloaded file size is 188484831 bytes.
dotnet-install: The remote and local file sizes are equal.
dotnet_install: Error: Failed to verify the version of installed `.NET Core SDK`.
Installation source: https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.428/dotnet-sdk-6.0.428-linux-x64.tar.gz.
Installation location: /usr/lib/dotnet.
Report the bug at https://github.com/dotnet/install-scripts/issues.
dotnet_install: Error: `.NET Core SDK` with version = 6.0.428 failed to install with an error.
Error: Failed to install dotnet, exit code: 1. cp: cannot create directory '/usr/lib/dotnet/host/fxr/6.0.36/': Permission denied
cp: cannot create directory '/usr/lib/dotnet/packs/Microsoft.AspNetCore.App.Ref/6.0.36/': Permission denied
mkdir: cannot create directory ‘/usr/lib/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64’: Permission denied
cp: cannot create directory '/usr/lib/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/6.0.36/': No such file or directory
cp: cannot create directory '/usr/lib/dotnet/packs/Microsoft.NETCore.App.Ref/6.0.36/': Permission denied
cp: cannot create directory '/usr/lib/dotnet/sdk-manifests/6.0.300/': Permission denied
cp: cannot create directory '/usr/lib/dotnet/sdk/6.0.428/': Permission denied
mkdir: cannot create directory ‘/usr/lib/dotnet/sdk/6.0.428’: Permission denied
cp: cannot create directory '/usr/lib/dotnet/sdk/6.0.428/DotnetTools/dotnet-dev-certs/6.0.36-servicing.24516.4/': No such file or directory
mkdir: cannot create directory ‘/usr/lib/dotnet/sdk/6.0.428’: Permission denied
cp: cannot create directory '/usr/lib/dotnet/sdk/6.0.428/DotnetTools/dotnet-user-secrets/6.0.36-servicing.24516.4/': No such file or directory
mkdir: cannot create directory ‘/usr/lib/dotnet/sdk/6.0.428’: Permission denied
cp: cannot create directory '/usr/lib/dotnet/sdk/6.0.428/DotnetTools/dotnet-watch/6.0.428-servicing.24517.40/': No such file or directory
cp: cannot create directory '/usr/lib/dotnet/shared/Microsoft.AspNetCore.App/6.0.36/': Permission denied
cp: cannot create directory '/usr/lib/dotnet/shared/Microsoft.NETCore.App/6.0.36/': Permission denied
cp: cannot create directory '/usr/lib/dotnet/templates/6.0.36/': Permission denied
dotnet_install: Error: Failed to verify the version of installed `.NET Core SDK`.
Installation source: https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.428/dotnet-sdk-6.0.428-linux-x64.tar.gz.
Installation location: /usr/lib/dotnet.
Report the bug at https://github.com/dotnet/install-scripts/issues.
dotnet_install: Error: `.NET Core SDK` with version = 6.0.428 failed to install with an error.

@gowridurgad
Copy link

Hi @kaby76, We reviewed the issue but were unable to reproduce it on our end. We successfully installed .NET on a GitHub-hosted Ubuntu runner (ubuntu-latest) without encountering a Permission denied error. Please find the screenshot attached for your reference. We are suspecting that the permission denied error when trying to create a directory in /usr/share is due to the system's restrictions rather than differences in user permissions.
As a workaround, we suggest using the DOTNET_INSTALL_DIR environment variable to specify an alternative installation location. You can set this variable in your workflow. For reference, please visit setup-node-environment-variables.
Example:

env:
  DOTNET_INSTALL_DIR: "path/to/directory"

If you have any additional details or further questions, please let us know.

Screenshot 2024-12-17 at 1 04 53 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants