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

Upgrade from setup-dotnet from 2 to 3.0.2 - Permission Denied #342

Closed
2 of 5 tasks
mj-dias opened this issue Nov 9, 2022 · 1 comment
Closed
2 of 5 tasks

Upgrade from setup-dotnet from 2 to 3.0.2 - Permission Denied #342

mj-dias opened this issue Nov 9, 2022 · 1 comment
Assignees
Labels
duplicate This issue or pull request already exists

Comments

@mj-dias
Copy link

mj-dias commented Nov 9, 2022

Description:
Failing to upgrade from actions/setup-dotnet@v2 to actions/[email protected] with error of Permission Denied

Task version:
v3.0.3

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Repro steps:
Upgrade from actions/setup-dotnet@v2 to actions/[email protected]

Expected behavior:
Continue working without errors as it was with version 2.

Actual behavior:

--> With Error
When the upgrade from actions/setup-dotnet@v2 to actions/[email protected] is used the following errors occur:

> Run actions/[email protected]
  with:
    dotnet-version: 6.0.x

/opt/actions-runner/_work/_actions/actions/setup-dotnet/v3.0.3/externals/install-dotnet.sh --channel 6.0
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: Attempting to download using aka.ms link https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.403/dotnet-sdk-6.0.403-linux-x64.tar.gz
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.403/dotnet-sdk-6.0.403-linux-x64.tar.gz
cp: cannot create directory '/usr/share/dotnet/host/fxr/6.0.11/': Permission denied
cp: cannot create directory '/usr/share/dotnet/packs/Microsoft.AspNetCore.App.Ref/6.0.11/': Permission denied
cp: cannot create directory '/usr/share/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/6.0.11/': Permission denied
cp: cannot create directory '/usr/share/dotnet/packs/Microsoft.NETCore.App.Ref/6.0.11/': Permission denied
mkdir: cannot create directory ‘/usr/share/dotnet/sdk-manifests’: Permission denied
cp: cannot create directory '/usr/share/dotnet/sdk-manifests/6.0.300/': No such file or directory
cp: cannot create directory '/usr/share/dotnet/sdk/6.0.403/': Permission denied
mkdir: cannot create directory ‘/usr/share/dotnet/sdk/6.0.403’: Permission denied
cp: cannot create directory '/usr/share/dotnet/sdk/6.0.403/DotnetTools/dotnet-dev-certs/6.0.11-servicing.[2](https://github.com/Intelliflo/github-actions/actions/runs/3362525391/jobs/5709512855#step:3:2)252[3](https://github.com/Intelliflo/github-actions/actions/runs/3362525391/jobs/5709512855#step:3:3).[4](https://github.com/Intelliflo/github-actions/actions/runs/3362525391/jobs/5709512855#step:3:5)/': No such file or directory
mkdir: cannot create directory ‘/usr/share/dotnet/sdk/6.0.403’: Permission denied
cp: cannot create directory '/usr/share/dotnet/sdk/6.0.403/DotnetTools/dotnet-user-secrets/6.0.11-servicing.22[5](https://github.com/Intelliflo/github-actions/actions/runs/3362525391/jobs/5709512855#step:3:6)23.4/': No such file or directory
mkdir: cannot create directory ‘/usr/share/dotnet/sdk/[6](https://github.com/Intelliflo/github-actions/actions/runs/3362525391/jobs/5709512855#step:3:7).0.403’: Permission denied
cp: cannot create directory '/usr/share/dotnet/sdk/6.0.403/DotnetTools/dotnet-watch/6.0.403-servicing.22523.23/': No such file or directory
cp: cannot create directory '/usr/share/dotnet/shared/Microsoft.AspNetCore.App/6.0.11/': Permission denied
cp: cannot create directory '/usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.11/': Permission denied
cp: cannot create directory '/usr/share/dotnet/templates/6.0.11/': Permission denied
cp: cannot create regular file '/usr/share/dotnet/dotnet': Permission denied
cp: cannot create regular file '/usr/share/dotnet/ThirdPartyNotices.txt': Permission denied
cp: cannot create regular file '/usr/share/dotnet/LICENSE.txt': 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.403/dotnet-sdk-6.0.403-linux-x64.tar.gz.
Installation location: /usr/share/dotnet.
Report the bug at https://github.com/dotnet/install-scripts/issues.
dotnet_install: Error: `.NET Core SDK` with version = 6.0.403 failed to install with an error.
Error: Failed to install dotnet 1. dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: Attempting to download using aka.ms link https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.403/dotnet-sdk-6.0.403-linux-x64.tar.gz
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.403/dotnet-sdk-6.0.403-linux-x64.tar.gz

--> Without Error
With version 2, the same step:

> Run actions/setup-dotnet@v[2](https://github.com/Intelliflo/github-actions/actions/runs/3426673822/jobs/5708760078#step:3:2)
  with:
    dotnet-version: 6.0.x
    include-prerelease: false

/opt/actions-runner/_work/_actions/actions/setup-dotnet/v2/externals/install-dotnet.sh --version 6.0.40[3](https://github.com/Intelliflo/github-actions/actions/runs/3426673822/jobs/5708760078#step:3:3)
dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.

dotnet-install: Attempting to download using primary link https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.[4](https://github.com/Intelliflo/github-actions/actions/runs/3426673822/jobs/5708760078#step:3:4)03/dotnet-sdk-[6](https://github.com/Intelliflo/github-actions/actions/runs/3426673822/jobs/5708760078#step:3:7).0.403-linux-x64.tar.gz
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.403/dotnet-sdk-6.0.403-linux-x64.tar.gz
dotnet-install: Installed version is 6.0.403
dotnet-install: Adding to current process PATH: `/home/runners/.dotnet`. Note: This change will be visible only when sourcing script.
dotnet-install: Note that the script does not resolve dependencies during installation.
dotnet-install: To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
dotnet-install: Installation finished successfully.
/home/runners/.dotnet:/home/runners/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
@mj-dias mj-dias added bug Something isn't working needs triage labels Nov 9, 2022
@IvanZosimov IvanZosimov added duplicate This issue or pull request already exists and removed bug Something isn't working needs triage labels Nov 9, 2022
@IvanZosimov IvanZosimov self-assigned this Nov 9, 2022
@IvanZosimov
Copy link
Contributor

Hi, @mj-dias 👋 Thanks for the issue! In the third version of the actions the place where the action installs .NET SDKs was changed. As I see from the logs you provided, the user that you're using doesn't have permission to write to this folder. There are two ways to solve this problem: 1) Get permissions for your user to write to /usr/share/dotnet; 2) Use env.variable DOTNET_INSTALL_DIR to set that folder, where you have permission to write, like it's stated in README.md:

  runs-on: ubuntu-latest
  env:
    DOTNET_INSTALL_DIR: "path/to/directory"
  steps:
    - uses: actions/checkout@main
    - uses: actions/setup-dotnet@v3
      with:
        dotnet-version: '3.1.x'

Now, I'm going to close this issue as a duplicate of this one. If you have any other questions, feel free to ping me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants