GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fallback to different installation directory if `/usr/share/dotnet` doesn't available due to permissions · Issue #518 · actions/setup-dotnet

Fallback to different installation directory if /usr/share/dotnet doesn't available due to permissions #518

New issue
Copy link
New issue
Copy link
Closed
Closed
Fallback to different installation directory if /usr/share/dotnet doesn't available due to permissions#518
Copy link
Assignees
v-priyagupta108
Labels
feature requestNew feature or request to improve the current logic

Description

@maxim-lobanov
maxim-lobanov
opened on Mar 22, 2024
Issue body actions

Description:

By default, dotnet is downloaded and installed under /usr/share/dotnet folder:

setup-dotnet/src/installer.ts

Line 220 in 5d1464d

linux: '/usr/share/dotnet',

Unfortunately, it is not great location because on some self-hosted runners and some Larger Runners (Linux Arm64 private beta), user doesn't have enough permissions to create / modify this folder.

In this case, action will fail with error:
Error: Failed to install dotnet, exit code: 1. mkdir: cannot create directory '/usr/share/dotnet': Permission denied

Proposed solution
I guess it is not possible to change default location /usr/share/dotnet to some new location because it will be a breaking change. So I am proposing adding a new fallback location in case if user doesn't have permissions for /usr/share/dotnet. It won't be a breaking change because fallback will be used only in cases when the current version of action would fail.

This action can check permissions of /usr/share/dotnet folder. If user doesn't have permissions to create / modify this folder, then the action should use different DOTNET_INSTALL_DIR directory instead of /usr/share/dotnet.

For example, it can use:

  • $HOME/.dotnet -> this way location will be consistent with MacOS Runners + user always have permissions to $HOME
  • <runner.temp>/.dotnet -> https://docs.github.com/en/actions/learn-github-actions/contexts#runner-context

Alternative solutions

There are two alternative solutions:

  • Change permissions of /usr/share/dotnet once on self-hosted agent -> Unfortunately, it won't fix Linux Arm64 Larger Runners. Also, it is not super convenient and involve manual actions
  • User can override DOTNET_INSTALL_DIR environment variable by themselves -> it is definitely possible option but it is not super convenient and user needs to do it for every workflow YAML

We definitely have workarounds but it would be great if action can handle this case without workarounds.

Reacted by Dave, skucher, ABW, Yuxiao Zeng, Guðmundur Ólafsson and Michael Conrad

Activity

  1. maxim-lobanov
    added
    feature requestNew feature or request to improve the current logic
    needs triage
    on Mar 22, 2024
  2. v-HarithaVattikuti commented on Mar 22, 2024

    @v-HarithaVattikuti
    v-HarithaVattikuti
    on Mar 22, 2024
    Contributor
    More actions

    Hello @maxim-lobanov
    Thank you for creating this feature request. We will investigate it and get back to you as soon as we have some feedback.

  3. v-HarithaVattikuti
    removed
    needs triage
    on Mar 22, 2024
  4. tremblaysimon commented on Apr 1, 2024

    @tremblaysimon
    tremblaysimon
    on Apr 1, 2024
    More actions

    Seems to be a duplicate of #360.

    @HarithaVattikuti, if you could check the PR #498 that seems to fix those issues.

    Thank you in advance!

  5. maxim-lobanov commented on Apr 2, 2024

    @maxim-lobanov
    maxim-lobanov
    on Apr 2, 2024
    ContributorAuthor
    More actions

    @tremblaysimon I think #498 implements a bit different approach and I worry that it can't be accepted because it will be a breaking change.

    The current path priorities:

    1. env['DOTNET_INSTALL_DIR']
    2. /usr/share/dotnet
    3. env['RUNNER_TOOL_CACHE'] -> I propose adding a new location on third position in list of priorities.

    #498 changes path priorities to:

    1. env['DOTNET_INSTALL_DIR']
    2. env['RUNNER_TOOL_CACHE']
    3. /usr/share/dotnet

    I could be wrong but It will be a breaking change for all hosted runners because all hosted runners will change default location from /usr/share/dotnet to env['RUNNER_TOOL_CACHE'].
    Hosted runners have a cache of dotnet versions which is stored under /usr/share/dotnet: https://github.com/actions/runner-images/blob/2fd9adccce8acd226d394935c55b8a932b04d315/images/ubuntu/toolsets/toolset-2204.json#L274.
    Changing the priorities order means that task will ignore cache on all hosted runners and will always download dotnet on flight. It can significantly increase workflow run duration for users of hosted runners.

  6. cjj196 commented on May 7, 2024

    @cjj196
    cjj196
    on May 7, 2024
    More actions

    +1, this same issue occurs with windows self hosted runners as well. For example when trying to install 6.0.x using v4 a pair of access denied exceptions occur.

    Access to the path 'C:\Program Files\dotnet\host\fxr\8.0.4' is denied.
    Access to the path 'C:\Program Files\dotnet\sdk\6.0.421' is denied.

  7. no1melman commented on Sep 9, 2024

    @no1melman
    no1melman
    on Sep 9, 2024
    More actions

    The interesting case we have with this, is that on Ubuntu 24.04 it's all installed to /usr/lib/dotnet not /usr/share/dotnet - however, even when you change the ~/.bashrc file to override the DOTNET_INSTALL_DIR to /usr/lib/dotnet the action still doesn't seem to work ..... the action still tries to point at /usr/share/dotnet

  8. v-priya-kinthali
    self-assigned this
    on Dec 2, 2025
  9. v-priya-kinthali commented on Dec 23, 2025

    @v-priya-kinthali
    v-priya-kinthali
    on Dec 23, 2025
    Contributor
    More actions

    Hello @maxim-lobanov👋,
    Thank you for bringing up this feature request and suggesting effective approaches!
    For now, we've added a note to the README in #689 with guidance on setting DOTNET_INSTALL_DIR to a user-writable path, which should help avoid permission errors on self hosted Linux runners.
    We will continue to explore the feasibility of incorporating fallback logic into the action itself in future updates.
    Thank you again for your valuable input😊!

  10. v-priya-kinthali
    removed their assignment
    on Jan 6, 2026
  11. v-priyagupta108 commented on Oct 1, 2026

    @v-priyagupta108
    v-priyagupta108
    on Oct 1, 2026
    Contributor
    More actions

    A fix for this is up in #785. It implements the fallback proposed here: when the default install location is not writable, the action falls back to .dotnet in the user's home directory with a warning, instead of failing with Permission denied. DOTNET_INSTALL_DIR keeps top priority, and runners that can write to the default location are unaffected.
    Let us know if this resolves the failure on your runners.

  12. v-priyagupta108 commented on Oct 14, 2026

    @v-priyagupta108
    v-priyagupta108
    on Oct 14, 2026
    Contributor
    More actions

    Just following up on this. Any thoughts on whether #785 covers your case? Happy to adjust if the behaviour isn't what you expected.

  13. v-priyagupta108
    self-assigned this
    on Oct 21, 2026
  14. v-priyagupta108 commented on Oct 27, 2026

    @v-priyagupta108
    v-priyagupta108
    on Oct 27, 2026
    Contributor
    More actions

    Checking in again on #785, which implements the $HOME/.dotnet fallback proposed here. Does it cover your case, or is there a scenario it misses?

  15. v-priyagupta108 commented on Nov 2, 2026

    @v-priyagupta108
    v-priyagupta108
    on Nov 2, 2026
    Contributor
    More actions

    Fixed by #785, now merged. When the default install location is not writable, the action falls back to .dotnet in the user's home directory with a warning instead of failing. DOTNET_INSTALL_DIR still takes priority, and runners that can write to the default location are unaffected. This will be available in the next release. Thanks for the detailed proposal.

    Reacted by Frulfump
  16. v-priyagupta108
    closed this as completedon Nov 2, 2026
  17. Frulfump commented on Nov 2, 2026

    @Frulfump
    Frulfump
    on Nov 2, 2026
    More actions

    When's the next planned release?

  18. v-priyagupta108 commented on Nov 3, 2026

    @v-priyagupta108
    v-priyagupta108
    on Nov 3, 2026
    Contributor
    More actions

    v6.1.0 is out and the v6 tag has been updated accordingly. If you're pinned to a SHA or an exact version, bump it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @v-priyagupta108
    v-priyagupta108

Labels

feature requestNew feature or request to improve the current logic

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.