Skip to content

Call /usr/bin/env bash rather than /bin/bash #1133

@adamcolwell

Description

@adamcolwell

What happened?

Not all systems have bash installed in /bin/bash. When trying to add API keys I get:

[ERROR] NotificationService System.ComponentModel.Win32Exception (2): An error occurred trying to start process '/bin/bash' with working directory 'xxxxx'. No such file or directory

Could we please get this call changed to '/usr/bin/env bash' so it works on nixos / bsd as well as deb and rpm based distros ?

Steps to reproduce

  1. Try adding an API key where bash does not exist in /bin/

Relevant logs

/nix/store/gwgqdl0242ymlikq9s9s62gkp5cvyal3-bash-5.2p37/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
[DEBUG] TrackedDownloadService  Indexing in-progress downloads at /home/adam/StabilityMatrix/.downloads/87ae2666-890e-46c5-b5cc-c119ef415c52.json...
[INFO]  TrackedDownloadService  Download added: (87ae2666-890e-46c5-b5cc-c119ef415c52, Inactive)
[DEBUG] TrackedDownloadService  Loaded in-progress download dreamshaper_8.safetensors
[INFO]  ModelIndexService       Loading models from database...
[INFO]  ModelIndexService       Loaded 0 models from database in 5.71ms
[INFO]  ModelIndexService       Refreshing model index...
[INFO]  ModelIndexService       Model index refreshed with 0 entries, took 1.11ms (3.34ms db)
Setup:  took 4.11s

[TRACE] SettingsManager [RelayPropertyFor] CivitAiBrowserViewModel.ResizeFactor -> Settings.CivitBrowserResizeFactor
[TRACE] SettingsManager [RelayPropertyFor] OutputsPageViewModel.ResizeFactor -> Settings.OutputsPageResizeFactor
[TRACE] SettingsManager [RelayPropertyFor] OutputsPageViewModel.ShowFolders -> Settings.IsOutputsTreeViewEnabled
[TRACE] SettingsManager [RelayPropertyFor] MainSettingsViewModel.InfinitelyScrollWorkflowBrowser -> Settings.IsWorkflowInfiniteScrollEnabled
[TRACE] SettingsManager [RelayPropertyFor] MainSettingsViewModel.SelectedNumberFormatMode -> Settings.NumberFormatMode
[TRACE] SettingsManager [RelayPropertyFor] MainSettingsViewModel.AutoLoadCivitModels -> Settings.AutoLoadCivitModels
[TRACE] SettingsManager [RelayPropertyFor] MainSettingsViewModel.MoveFilesOnImport -> Settings.MoveFilesOnImport
[TRACE] SettingsManager [RelayPropertyFor] MainSettingsViewModel.ConsoleLogHistorySize -> Settings.ConsoleLogHistorySize
[TRACE] SettingsManager [RelayPropertyFor] MainSettingsViewModel.PreferredGpu -> Settings.PreferredGpu
[TRACE] CompletionProvider      Loading tags from /home/adam/StabilityMatrix/Tags/danbooru.csv with Blake3 hash "2f20d20de38da8ca2dabafec02c947d5e6385d9e1adb4230a1aa9187220f79d3"
[DEBUG] CompletionProvider      Loading existing index for /home/adam/.config/StabilityMatrix/Temp/Tags/2f20d20de38da8ca2dabafec02c947d5e6385d9e1adb4230a1aa9187220f79d3/header.bin, /home/adam/.config/StabilityMatrix/Temp/Tags/2f20d20de38da8ca2dabafec02c947d5e6385d9e1adb4230a1aa9187220f79d3/index.bin
[INFO]  MainWindowViewModel     App started (5.42s)
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
[INFO]  CompletionProvider      Loaded 99997 tags for "danbooru.csv" in 0.34s
[INFO]  PyRunner        Setting PYTHONHOME="'/home/adam/StabilityMatrix/Assets/Python310'"
[DEBUG] PyRunner        Setting PATH="'/home/adam/StabilityMatrix/Assets/Python310:/nix/store/yf2qd4lnsn2m3ah0rbqn2pxmw2lka2v9-stability-matrix-2.13.2/bin-links:/nix/store/q8rgbkh5xvpv9wskicxfqdh2k0n4kz7y-dotnet-runtime-wrapped-8.0.12/bin:/nix/store/gwgqdl0242ymlikq9s9s62gkp5cvyal3-bash-5.2p37/bin:/run/wrappers/bin:/home/adam/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/home/adam/.nix-profile/bin:/nix/profile/bin:/home/adam/.local/state/nix/profile/bin:/etc/profiles/per-user/adam/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/nix/store/kz3cqaw9n856i3dirn3clmgvldzv1baz-ghostty-1.0.1/bin'"
[INFO]  PyRunner        Initializing Python runtime with DLL: "/home/adam/StabilityMatrix/Assets/Python310/lib/libpython3.10.so"
[ERROR] NotificationServiceExtensions   Error Installing Package
[ERROR] NotificationServiceExtensions   Error Showing Notification
[INFO]  UpdateHelper    No update available
[ERROR] NotificationService     System.ComponentModel.Win32Exception (2): An error occurred trying to start process '/bin/bash' with working directory '/home/adam/Sites/nixpkgs/pkgs/by-name/st/stabilitymatrix'. No such file or directory
   at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo startInfo, String resolvedFilename, String[] argv, String[] envp, String cwd, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at DeviceId.Internal.CommandExecutors.CommandExecutorBase.RunWithShell(String shell, String command)
   at DeviceId.Internal.CommandExecutors.BashCommandExecutor.Execute(String command)
   at DeviceId.Linux.Components.LinuxRootDriveSerialNumberDeviceIdComponent.GetValue()
   at DeviceId.Formatters.HashDeviceIdFormatter.<>c.<GetDeviceId>b__4_1(KeyValuePair`2 x)
   at System.Linq.Enumerable.IteratorSelectIterator`2.Fill(Iterator`1 source, Span`1 results, Func`2 func)
   at System.Linq.Enumerable.IteratorSelectIterator`2.PreallocatingToArray(Int32 count)
   at System.Linq.Enumerable.IteratorSelectIterator`2.ToArray()
   at DeviceId.Formatters.HashDeviceIdFormatter.GetDeviceId(IDictionary`2 components)
   at StabilityMatrix.Core.Models.GlobalEncryptedSerializer.GetComputerSid(FormatVersion version)
   at StabilityMatrix.Core.Models.GlobalEncryptedSerializer.GetComputerKeyPhrase(FormatVersion version)
   at StabilityMatrix.Core.Models.GlobalEncryptedSerializer.SerializeToBytesV2(Byte[] data, KeyInfo keyInfo)
   at StabilityMatrix.Core.Models.GlobalEncryptedSerializer.Serialize[T](T obj, KeyInfo keyInfo)
   at StabilityMatrix.Core.Services.SecretsManager.SaveAsync(Secrets secrets)
   at StabilityMatrix.Avalonia.Services.AccountsService.CivitLoginAsync(String apiToken)
   at StabilityMatrix.Avalonia.Services.NotificationService.TryAsync(Task task, String title, String message, NotificationType appearance)

Version

v2.13.2

What Operating System are you using?

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions