dotnet / sign

Code Signing CLI tool supporting Authenticode, NuGet, VSIX, and ClickOnce
MIT License
439 stars 84 forks source link

Cannot run on WSL Ubuntu #711

Closed bc3tech closed 2 weeks ago

bc3tech commented 2 weeks ago

Version: 0.9.1-beta.24312.3

Describe the bug Got the tool installed, but getting an exception when I run it in WSL Ubuntu (testing ahead of putting on a GH Action Linux runner)

Repro steps

Expected behavior Should output help as on Windows:

Windows Output ``` >sign Required command was not provided. Description: Sign CLI Usage: sign [command] [options] Options: --version Show version information -?, -h, --help Show help and usage information Commands: code Sign binaries and containers. ```

Actual behavior Crashes with:

~$ sign
Unhandled exception. System.DllNotFoundException: Unable to load shared library 'kernel32.dll' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
/usr/lib/dotnet/shared/Microsoft.NETCore.App/8.0.5/kernel32.dll.so: cannot open shared object file: No such file or directory
/home/hurlburb/.dotnet/tools/.store/sign/0.9.1-beta.24312.3/sign/0.9.1-beta.24312.3/tools/net8.0/any/kernel32.dll.so: cannot open shared object file: No such file or directory
/usr/lib/dotnet/shared/Microsoft.NETCore.App/8.0.5/libkernel32.dll.so: cannot open shared object file: No such file or directory
/home/hurlburb/.dotnet/tools/.store/sign/0.9.1-beta.24312.3/sign/0.9.1-beta.24312.3/tools/net8.0/any/libkernel32.dll.so: cannot open shared object file: No such file or directory
/usr/lib/dotnet/shared/Microsoft.NETCore.App/8.0.5/kernel32.dll: cannot open shared object file: No such file or directory
/home/hurlburb/.dotnet/tools/.store/sign/0.9.1-beta.24312.3/sign/0.9.1-beta.24312.3/tools/net8.0/any/kernel32.dll: cannot open shared object file: No such file or directory
/usr/lib/dotnet/shared/Microsoft.NETCore.App/8.0.5/libkernel32.dll: cannot open shared object file: No such file or directory
/home/hurlburb/.dotnet/tools/.store/sign/0.9.1-beta.24312.3/sign/0.9.1-beta.24312.3/tools/net8.0/any/libkernel32.dll: cannot open shared object file: No such file or directory

   at Sign.Cli.Kernel32.SetDllDirectoryW(String lpPathName)
   at Sign.Cli.Program.Main(String[] args) in /_/src/Sign.CLI/Program.cs:line 37
   at Sign.Cli.Program.<Main>(String[] args)
Aborted

Additional context

dotnet info output ``` $ dotnet --info .NET SDK: Version: 8.0.105 Commit: eae90abaaf Workload version: 8.0.100-manifests.796a77f8 Runtime Environment: OS Name: ubuntu OS Version: 22.04 OS Platform: Linux RID: ubuntu.22.04-x64 Base Path: /usr/lib/dotnet/sdk/8.0.105/ .NET workloads installed: Workload version: 8.0.100-manifests.796a77f8 There are no installed workloads to display. Host: Version: 8.0.5 Architecture: x64 Commit: 087e15321b .NET SDKs installed: 8.0.105 [/usr/lib/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 8.0.5 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 8.0.5 [/usr/lib/dotnet/shared/Microsoft.NETCore.App] Other architectures found: None Environment variables: Not set global.json file: Not found ```

Also tried sudo sign to no avail:

$ sudo sign
sudo: sign: command not found
clairernovotny commented 2 weeks ago

Sign only runs on Windows due to Authenticode only running on Windows. It cannot currently run on other operating systems.

For now, that shouldn't be a huge blocker as it's recommended to run sign on its own stage in the a pipeline. Build can happen on any OS and then Windows used just for signing. The samples in this repo demonstrate that for AzDo and Actions: https://github.com/dotnet/sign/tree/main/docs

bc3tech commented 2 weeks ago

alrighty then, I (wrongly) assumed since it's a dotnet (core) tool it'd work on linux.