PietJankbal / powershell-wrapper-for-wine

pwsh
63 stars 3 forks source link

Waves Central 13.4.1 (latest) authorization is broken on Ubuntu 22.04 wine8.0rc2 #20

Closed mcgov closed 1 year ago

mcgov commented 1 year ago

Waves Central was working for me as of 13.0. Central 13.4.1 runs and will install plugins but cannot find any connected devices to authorize the plugins. I've checked the last legacy installer available, Central v 12 sees the C:\ drive and allows you to load your licenses on it. The new release doesn't see any drives it can use for licensing, though plugins can install.

Ubuntu 22.04, latest kernel: 5.15.0-56-generic dpkg info for wine:

ii  fonts-wine                                                  6.0.3~repack-1                          all          Windows API implementation - fonts
ii  libwine:i386                                                6.0.3~repack-1                          i386         Windows API implementation - library
ii  wine-staging                                                8.0~rc2~jammy-1                         amd64        WINE Is Not An Emulator - runs MS Windows programs
ii  wine-staging-amd64                                          8.0~rc2~jammy-1                         amd64        WINE Is Not An Emulator - runs MS Windows programs
ii  wine-staging-i386:i386                                      8.0~rc2~jammy-1                         i386         WINE Is Not An Emulator - runs MS Windows programs
ii  wine32:i386                                                 6.0.3~repack-1                          i386         Windows API implementation - 32-bit binary loader
ii  winehq-staging                                              8.0~rc2~jammy-1                         amd64        WINE Is Not An Emulator - runs MS Windows programs
ii  winetricks                                                  0.0+20210206-2                          all          simple tool to work around common problems in Wine

I was following the install procedure from: https://hackmd.io/@rauldipeas/waves-central in a fresh wineprefix.

In Central 13.4.1 no devices are available: image

Also none in the settings panel: image

Looking into the Waves-Central.log, the first thing I noted is that the electron app seems to be having trouble querying disk information based on the last few lines when performing an action that would refresh the device list. I noted them when pulling up the settings panel and selecting some plugins to install.

2022/12/25 22:53:43 [error]     MacGetSize::getSizeGB failed to get size    C:\users\mows\AppData\Local\Waves Audio
2022/12/25 23:00:50 [warning]   WinNodeDisk:getFreeSpaceGB failed for current method    wmic    wmic logicaldisk where "DeviceID='C:'" get FreeSpace
2022/12/25 23:00:50 [warning]   WinNodeDisk:getFreeSpaceGB failed for current method    wmicAbsolutePath    wmic logicaldisk where "DeviceID='C:'" get FreeSpace
2022/12/25 23:00:50 [warning]   WinNodeDisk:getFreeSpaceGB failed for current method    powershell  "%SystemRoot%\System32\Wbem\wmic.exe" logicaldisk where DeviceID='C:' get FreeSpace

Do you have any tips for debugging this? Does this reproduce for you with the latest Central release?

PietJankbal commented 1 year ago

Hi, if that failing wmic command is the cause of this bug maybe you could try install another github project of me here https://github.com/PietJankbal/Chocolatey-for-wine

It also installs quite some overhead you don`t need for running Waves really (like chocolatey, 7zip , net48 etc.) but it has a better wmic (and powershell) implementation so maybe it could work around the problem and then at least we would know what the cause of this bug is.

Install in a fresh prefix (that you can "throw away" afterwards) and then install Waves; does that change any behaviour?,

mcgov commented 1 year ago

Giving it a shot now. While the installer is running:

Ah, no dice. 13.4.1 remains broken. The strange bit is that this wle.exe program DOES return the correct text block if it's run from the commandline. Each of the methods Central tries to get the disk info does succeed when they're run in the shell, so now my suspicion is that it's something going wrong between Wine and Electron.

2022/12/27 13:15:10 [info]      ElectronMainLiveProcess::start  C:\Program Files\Waves Central\resources\res\external\bin\WavesLicenseEngine.bundle\Contents\Win64\exec\wle.exe sync    --user  XXXXXXXX    --log   C:\users\mows\AppData\Roaming\Waves Audio\Waves Central\Logs
2022/12/27 13:15:10 [info]      LocalScanGetProducts::doGetProducts completed after 0.01s
2022/12/27 13:15:10 [info]      CentralGetInstallableProducts::doGetProducts completed after 0.55s
2022/12/27 13:15:10 [error]     Utils::tryParse failed parsing  Problem calling GetDriveType on F:\
[{"device_id":"XXXXXXXXXXXXX","device_name":" (C:)","device_path":"C:\\","device_type":"comp","is_writable":"yes","license_folder_path":"C:\\ProgramData\\Waves Audio\\Licenses"}]

2022/12/27 13:15:10 [warning]   ShellWle::getDevicesHelper has returned with no valid devices, will resort to using non-json method

2022/12/27 12:54:34 [error]     ShellWle::getDevicesHelperFailSafe failed   {"centralParsedError":true,"message":"spawn C:\\Program Files\\Waves Central\\resources\\res\\external\\bin\\WavesLicenseEngine.bundle\\Contents\\Win64\\exec\\wle.exe devices --report-writable  --log \"C:\\users\\mows\\AppData\\Roaming\\Waves Audio\\Waves Central\\Logs\" ENOENT","stack":"Error: spawn C:\\Program Files\\Waves Central\\resources\\res\\external\\bin\\WavesLicenseEngine.bundle\\Contents\\Win64\\exec\\wle.exe devices --report-writable  --log \"C:\\users\\mows\\AppData\\Roaming\\Waves Audio\\Waves Central\\Logs\" ENOENT\n    at ChildProcess._handle.onexit (node:internal/child_process:283:19)\n    at onErrorNT (node:internal/child_process:478:16)\n    at process.processTicksAndRejections (node:internal/process/task_queues:83:21)"}

that bit of text (device id removed) is the expected output from wle.exe when it's supposed to output json. [{"device_id":"XXXXXXXXXXXX","device_name":" (C:)","device_path":"C:\\","device_type":"comp","is_writable":"yes","license_folder_path":"C:\\ProgramData\\Waves Audio\\Licenses"}]

PietJankbal commented 1 year ago

Hi

Is powershell supposed to launch in a ConEmu graphical window?

Not really, strange that that happens. The ConEmu window is invoked when powershell is called without a command, so might be a bug in the powershell wrapper.

I don`t have access to my machine with Waves atm so cannot test myself, but maybe you could run like WINEDEBUG=+process wine Waves Central.exe &>log and put the file "log" somewhere up or paste it here, maybe it reveals something (make sure you run up until the error occurs)

mcgov commented 1 year ago

uploaded logs: https://github.com/mcgov/waves_logs/raw/main/waves_logs.tar.gz

PietJankbal commented 1 year ago

Hi, thanks for the log

Maybe it's due to :

CreateProcessInternalW app L"C:\windows\system32\WindowsPowershell\v1.0\powershell.exe" cmdline L"powe rshell.exe -noLogo -command \"ls -r \\"C:\users\mows\AppData\Local\Waves Audio\\" | measure -s Length | Select -ExpandP roperty Sum\""

Apparantly PowerShell Core fails on "measure -s Length", I get : Measure-Object: Parameter cannot be processed because the parameter name 's' is ambiguous. Possible matches include: -StandardDeviation -Sum.

This works fine in Powershell 5.1 though. So there's an incompability between PS51 and PowerShell Core.

Maybe just returning some fake value might help (???)

Could you try add pasting below code into c:\Program Files\Powershell7\7\profile.ps1 (just open that file with some editor and paste the code below)

Remove-Alias -Force measure

function measure {

$Length = 2323 Write-Host $Length }

If that doesn't help , another thing that you might try is just run with environment variable 'FAKESUCCESS=1'. Does that change anything?

PietJankbal commented 1 year ago

I`ve reenabled some code to replace strings (incompatible commands) in the commandline fed to pwsh.exe

At least the command 'powershell.exe -noLogo -command "ls -r \"C:\users\mows\AppData\Local\Waves Audio\" | measure -s Length | Select -ExpandProperty Sum' should now work correctly with current version of powershell wrapper. Not sure if this fixes this issue, but hopefully an improvement

mcgov commented 1 year ago

Awesome!

Unfortunately I had tried the profile.ps1 changes and it still fails. Something else seems to be broken, ConEmu popping a GUI is fishy. I had been able to install Waves Central previously by just installing powershell 6 and redirecting system32/WindowsPowerShell/v1.0/ to the new installation folder before and that is also broken with Central's latest.

I'm going to try to install on another machine or another Ubuntu installation on this machine. It's totally possible that this might be due to some other change on my machine.

mcgov commented 1 year ago

Ok interesting, it is some issue with my installation of 22.04. A live disk with 20.04 doesn't reproduce the issue.

I'm going to refresh my 22.04 installation and see if this still reproduces. I must have tweaked something.

mcgov commented 1 year ago

Welp! We can close this. So strange, no clue what broke. I backed up my home dir and reinstalled 22.04 and everything is looking good now. Thank you for your patience and time helping me out!

mcgov commented 1 year ago

I think we don't need the full wrapper anymore just for Waves Central too. I have a bootleg-ey script to install and link pwsh.exe to powershell.exe; I'll clean it up and share if you're interested?

mcgov commented 1 year ago

@PietJankbal interesting development:

I encountered this again and fixed it with another installation in a clean wineprefix. My theory is that this is related to Wine auto-scanning and adding drives to the wineprefix. I noted that on a clean installation there are two drives listed in winecfg and in .wineprefix/dosdevices: c: -> /home/me/.wineprefix d: -> /run/media/some_ssd d:: -> /dev/sdX

And on the older installation where Waves Central reports no drive is found, there are many more drives listed, e: f: h: i: etc. Some of them are stale links to drives that aren't mounted. My guess is this is the result of mounting flash drives, sd cards, mounting my NVME data disk, etc. while the wineserver is active. Anything that causes WINE to add a drive to the wineprefix over time. At some point this confuses Waves Central and will end up bugging things out to the point that it does not detect the drive that was used for the license, so you cannot install new plugins or remove licenses from the wineprefix.

If anyone else encounters this issue, reinstalling in a clean wineprefix should fix it as long as the drive that was mounted when you installed the previous installation is mounted. I'm not sure how Waves Central is determining which machine is which (drive serial number?) but reinstalling in a fresh wineprefix or saving a copy of the wineprefix after a successful installation should resolve the issue.