Results 1 to 4 of 4

Thread: help with .NET snap. Can't run as normal user

  1. #1
    Join Date
    Oct 2019
    Beans
    116

    help with .NET snap. Can't run as normal user

    Hi,

    I'm having some trouble getting the .NET snap to work. It installs, but following the instructions, it seems like I need to run as root/sudo to execute any .NET application.

    Reference:
    https://docs.microsoft.com/en-us/dot...all/linux-snap

    Code:
    sudo snap install dotnet-runtime-50 --classic
    sudo snap alias dotnet-runtime-50.dotnet dotnet 
    export DOTNET_ROOT=/snap/dotnet-sdk/current
    Here's the problem. I can only execute .net as root.

    Code:
    $ dotnet --info
    cannot snap-exec: cannot exec "/snap/dotnet-sdk/137/snap/command-chain/snapcraft-runner": permission denied
    $ sudo dotnet --info
    .NET SDK (reflecting any global.json):
     Version:   5.0.400
     Commit:    d61950f9bf
    
    Runtime Environment:
     OS Name:     ubuntu
     OS Version:  21.04
     OS Platform: Linux
     RID:         ubuntu.21.04-x64
     Base Path:   /snap/dotnet-sdk/137/sdk/5.0.400/
    
    Host (useful for support):
      Version: 5.0.9
      Commit:  208e377a53
    
    .NET SDKs installed:
      5.0.400 [/snap/dotnet-sdk/137/sdk]
    
    .NET runtimes installed:
      Microsoft.AspNetCore.App 5.0.9 [/snap/dotnet-sdk/137/shared/Microsoft.AspNetCore.App]
      Microsoft.NETCore.App 5.0.9 [/snap/dotnet-sdk/137/shared/Microsoft.NETCore.App]
    
    To install additional .NET runtimes or SDKs:
      https://aka.ms/dotnet-download

    any ideas on how I can get dotnet to work as a regular user?

    Thanks,

  2. #2
    Join Date
    Oct 2019
    Beans
    116

    Re: help with .NET snap. Can't run as normal user

    Nevermind, think I got it.

    Don't use aliases and link instead

    Code:
    sudo snap unalias dotnet
    sudo ln -s /snap/dotnet-sdk/current/dotnet /usr/local/bin/dotnet

  3. #3
    Join Date
    Feb 2012
    Beans
    1

    Re: help with .NET snap. Can't run as normal user

    Theres another simple way.

    Code:

    sudo chown <user name> /snap/dotnet-sdk/current

  4. #4
    Join Date
    Jul 2008
    Location
    The Left Coast of the USA
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: help with .NET snap. Can't run as normal user

    It might be unwise to change ownership of that directory. Changing directory ownership is not to be taken lightly.

    The OP's solution was part of the instructions cited. That should be enough.

    Given that the thread was marked Solved by the user -- who will not likely be back to check -- further discussion is pointless in any case.
    Last edited by QIII; 3 Weeks Ago at 05:01 AM.
    Please read The Forum Rules and The Forum Posting Guidelines

    A thing discovered and kept to oneself must be discovered time and again by others. A thing discovered and shared with others need be discovered only the once.
    This universe is crazy. I'm going back to my own.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •