Skip to content

dotnet restore fails for non-root user on 1.0.0-preview2-sdk #78

@kalahari

Description

@kalahari

If you attempt to run dotnet restore (or dotnet new) as a non-root user, the NuGet cache population fails because /tmp/NuGetScratch is owned by root. Upstream bug is here: NuGet/Home#2793.

Removing /tmp/NuGetScratch resolves the issue.

$ docker run -it --rm microsoft/dotnet:1.0.0-preview2-sdk
root@85fc27c5bede:/# useradd -d /opt/foobar -u 1000 -m -s /bin/bash foobar
root@85fc27c5bede:/# su - foobar
foobar@85fc27c5bede:~$ mkdir app
foobar@85fc27c5bede:~$ cd app
foobar@85fc27c5bede:~/app$ dotnet new

Welcome to .NET Core!
---------------------
Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.
Telemetry
--------------
The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include commandline arguments. The data is collected by Microsoft and shared with the community.
You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.
You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry.
Configuring...
-------------------
A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once.
Decompressing 100% 2118 ms
Expanding 100% 8398 ms
Failed to create prime the NuGet cache. restore failed with: 1
Created new C# project in /opt/foobar/app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions