winapps icon indicating copy to clipboard operation
winapps copied to clipboard

Not working on bazzite (libvirt)

Open zany130 opened this issue 1 year ago • 7 comments

After following all the setup instructions for libvirt, the installer fails with

./installer.sh                                                                                                                                                                                                                                         ─╯
################################################################################
#                                                                              #
#                            WinApps Install Wizard                            #
#                                                                              #
################################################################################

Q) Install or uninstall WinApps? --> Installncies are installed... 
Q) Configure WinApps for the current user 'zany130' or the whole system? --> Current User
Q) Automatically install supported applications or choose manually? --> Manual (Default)

Installing WinApps.
Checking for existing conflicting WinApps installations... Done!
Attempting to load WinApps configuration file... Done!
Checking whether dependencies are installed... Done!
Checking whether the user 'zany130' is part of the required groups... Done!
Checking the status of the Windows VM... Exiting with status '1'.

trying to check the log at this point ~/.local/share/winapps does not exist so I tried

bin/winapps check

and that gave me

bin/winapps check                                                                                                                                                                                                                                      ─╯
bin/winapps: line 157: /home/zany130/.local/share/winapps/winapps.log: No such file or directory
bin/winapps: line 157: /home/zany130/.local/share/winapps/winapps.log: No such file or directory
bin/winapps: line 157: /home/zany130/.local/share/winapps/winapps.log: No such file or directory
bin/winapps: line 157: /home/zany130/.local/share/winapps/winapps.log: No such file or directory

but the log is now created it shows

       │ File: .local/share/winapps/winapps.log
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ [Sat Aug  3 11:40:05 AM EDT 2024-4891] THIS_RUN: 1722699605
   2   │ [Sat Aug  3 11:40:05 AM EDT 2024-4891] Using FreeRDP command 'xfreerdp'.
   3   │ [Sat Aug  3 11:40:05 AM EDT 2024-4891] ERROR: WINDOWS NONEXISTENT. EXITING.

I can see my VM is running.

sudo virsh list
[sudo] password for zany130: 
 Id   Name         State
----------------------------
 3    RDPWindows   running

Here is my config

cat .config/winapps/winapps.conf 
##################################
#   WINAPPS CONFIGURATION FILE   #
##################################

# INSTRUCTIONS
# - Leading and trailing whitespace are ignored.
# - Empty lines are ignored.
# - Lines starting with '#' are ignored.
# - All characters following a '#' are ignored.

# [WINDOWS USERNAME]
RDP_USER="********"

# [WINDOWS PASSWORD]
RDP_PASS="******"

# [WINDOWS DOMAIN]
# DEFAULT VALUE: '' (BLANK)
#RDP_DOMAIN=""

# [WINDOWS IPV4 ADDRESS]
# NOTES:
# - If using 'libvirt', 'RDP_IP' will be determined by WinApps at runtime if left unspecified.
# DEFAULT VALUE:
# - 'docker': '127.0.0.1'
# - 'podman': '127.0.0.1'
# - 'libvirt': '' (BLANK)
#RDP_IP="192.168.122.229"

# [WINAPPS BACKEND]
# DEFAULT VALUE: 'docker'
# VALID VALUES:
# - 'docker'
# - 'podman'
# - 'libvirt'
WAFLAVOR="libvirt"

# [DISPLAY SCALING FACTOR]
# NOTES:
# - If an unsupported value is specified, a warning will be displayed.
# - If an unsupported value is specified, WinApps will use the closest supported value.
# DEFAULT VALUE: '100'
# VALID VALUES:
# - '100'
# - '140'
# - '180'
RDP_SCALE="100"

# [ADDITIONAL FREERDP FLAGS & ARGUMENTS]
# DEFAULT VALUE: '' (BLANK)
# VALID VALUES: See https://github.com/awakecoding/FreeRDP-Manuals/blob/master/User/FreeRDP-User-Manual.markdown
#RDP_FLAGS=""

# [MULTIPLE MONITORS]
# NOTES:
# - If enabled, a FreeRDP bug *might* produce a black screen.
# DEFAULT VALUE: 'false'
# VALID VALUES:
# - 'true'
# - 'false'
MULTIMON="false"

# [DEBUG WINAPPS]
# NOTES:
# - Creates and appends to ~/.local/share/winapps/winapps.log when running WinApps.
# DEFAULT VALUE: 'true'
# VALID VALUES:
# - 'true'
# - 'false'
DEBUG="true"

# [AUTOMATICALLY PAUSE WINDOWS]
# NOTES:
# - This is currently INCOMPATIBLE with 'docker'.
# - See https://github.com/dockur/windows/issues/674
# DEFAULT VALUE: 'off'
# VALID VALUES:
# - 'on'
# - 'off'
AUTOPAUSE="off"

# [AUTOMATICALLY PAUSE WINDOWS TIMEOUT]
# NOTES:
# - This setting determines the duration of inactivity to tolerate before Windows is automatically paused.
# - This setting is ignored if 'AUTOPAUSE' is set to 'off'.
# - The value must be specified in seconds (to the nearest 10 seconds e.g., '30', '40', '50', etc.).
# - For RemoteApp RDP sessions, there is a mandatory 20-second delay, so the minimum value that can be specified here is '20'.
# - Source: https://techcommunity.microsoft.com/t5/security-compliance-and-identity/terminal-services-remoteapp-8482-session-termination-logic/ba-p/246566
# DEFAULT VALUE: '300'
# VALID VALUES: >=20
AUTOPAUSE_TIME="300"

# [FREERDP COMMAND]
# NOTES:
# - WinApps will attempt to automatically detect the correct command to use for your system.
# DEFAULT VALUE: '' (BLANK)
# VALID VALUES: The command required to run FreeRDPv3 on your system (e.g., 'xfreerdp', 'xfreerdp3', etc.).
#FREERDP_COMMAND=""

zany130 avatar Aug 03 '24 15:08 zany130

i wonder if my issue is the same as this https://github.com/winapps-org/winapps/discussions/28

when running as root as mentioned in that discussion there log becomes

cat /root/.local/share/winapps/winapps.log 
[Sat Aug  3 12:06:19 PM EDT 2024-21099] THIS_RUN: 1722701179
[Sat Aug  3 12:06:19 PM EDT 2024-21099] Using FreeRDP command 'xfreerdp'.
[Sat Aug  3 12:06:19 PM EDT 2024-21099] ERROR: APPLICATION NOT FOUND. EXITING.

EDIT:

yup the problem was I needed to run win apps as root

no idea why bin/winapps check failed with that but the installer script worked fine

to get everything setup on bazzite you need to do the following

you also need to overlay dialog for the installer to work. I was using brew when I was running as a user but that dosn't work for root

with

sudo rpm-ostree install dialog

and you also need to symlink your ~/.config/winapps/winapps.conf to /root/.config/winapps/winapps.conf

like this

ln -s /var/home/USERNAME/.config/winapps/ /var/roothome/.config/

and then finally you need to add the root user to the kvm and libvirt group like this

usermod -a -G libvirt root
usermod -a -G kvm root

you might also run into this problem https://docs.fedoraproject.org/en-US/fedora-silverblue/troubleshooting/#_unable_to_add_user_to_group

which can be fixed with

grep -E '^libvirt:' /usr/lib/group | sudo tee -a /etc/group

zany130 avatar Aug 03 '24 16:08 zany130

never mind now its failling with this

sudo ./installer.sh                                                                                                                                                                                                              ─╯
################################################################################
#                                                                              #
#                            WinApps Install Wizard                            #
#                                                                              #
################################################################################

Q) Install or uninstall WinApps? --> Installncies are installed... 
Q) Configure WinApps for the current user 'root' or the whole system? --> System
Q) Automatically install supported applications or choose manually? --> Manual (Default)

Installing WinApps.
Checking for existing conflicting WinApps installations... Done!
Attempting to load WinApps configuration file... Done!
Checking whether dependencies are installed... Done!
Checking whether the user 'root' is part of the required groups... Done!
Checking the status of the Windows VM... Done!
Checking for an open RDP Port on Windows... Done!
Attempting to establish a Remote Desktop connection with Windows... Done!
Checking for installed Windows applications... Done!
Creating an application entry for Windows... Exiting with status '1'.

EDIT: its because of the read-only filesystem

got a little further but know I am getting

I ran the script with bash -x to get that debug output

++ Get-Item : Cannot find path 'C:\Program Files\Java\jre-1.8\bin\javaws.exe' because it does not exist.
/root/.local/share/winapps/detected: line 16: Get-Item: command not found
+++ waTerminateScript
+++ local EXIT_STATUS=127
+++ echo -e '\033[1;41;37mExiting with status '\''127'\''.\033[0m'
Exiting with status '127'.
+++ exit 127

zany130 avatar Aug 03 '24 18:08 zany130

so I fixed the script not being able to detect the VM when ran as a user by

setting

LIBVIRT_DEFAULT_URI="qemu:///system" 

in ~/.config/environment.d/myenv.conf with the rest of my envs

but I am still getting the Get-Item error seems like its related to this https://github.com/winapps-org/winapps/issues/71

zany130 avatar Aug 03 '24 19:08 zany130

@zany130 Thank you for the detailed information; it's incredibly useful for pinpointing the source of your issues.

Based on your description, it seems likely that your problem aligns with this issue: https://github.com/winapps-org/winapps/issues/159.

You mentioned in your initial post that installer.sh fails with the message Checking the status of the Windows VM... Exiting with status '1'.. This is concerning because the script usually prints Failed! if it handles a non-zero exit code properly. The problem appears to originate from the function waCheckVMRunning, which contains the line VM_STATE=$(virsh list --all | grep -w "$VM_NAME"), where VM_NAME is globally set to RDPWindows.

As a first step, please run virsh list --all and share the output. Although you've already provided the output of sudo virsh list, I would like to see the results without elevated privileges. Additionally, comparing this with the output from virsh --connect qemu:///system list --all would be very helpful. If the second command lists your Windows VM while the first does not, it's likely that the LIBVIRT_DEFAULT_URI environment variable is not set correctly. Please see step 3 of this guide for more information on how to correctly set this environment variable for your particular system.

As a side note, the bin/winapps check command is no longer supported. The equivalent command is now bin/winapps manual explorer.exe.

KernelGhost avatar Aug 05 '24 11:08 KernelGhost

yup I forgot to setup LIBVIRT_DEFAULT_URI I had already setup kvm through a helper script included in bazzite but apparently it doesn't setup LIBVIRT_DEFAULT_URI

after adding

LIBVIRT_DEFAULT_URI="qemu:///system"

to

~/.config/environment.d/myenv.conf

and rebooting (I think logging out and back in would accomplish the same since its sourced by the user session of systemd)

Now that it is able to detect my VM (without running the script as root which also works) I was able to get to the app setup step where it scans the windows system for compatible app and started running into the second issue of

++ Get-Item : Cannot find path 'C:\Program Files\Java\jre-1.8\bin\javaws.exe' because it does not exist.
/root/.local/share/winapps/detected: line 16: Get-Item: command not found
+++ waTerminateScript
+++ local EXIT_STATUS=127
+++ echo -e '\033[1;41;37mExiting with status '\''127'\''.\033[0m'
Exiting with status '127'.
+++ exit 127

So I checked I don't have java in that path (this is a old windows 11 install that I am also dual-booting on this same PC , so I probably did have java at some point and uninstalled it) so what I did was I used CC cleaner to clean my windows registry (it was actually useful in this case lol)

and Winapps no longer complained about Java, and I was able to successfully add my Windows app to Bazzite.

Im guessing I had some leftover registry entries for java and winapps was picking that up?

would it be possible to have winapps skip invalid app entries instead of just exiting?

zany130 avatar Aug 05 '24 17:08 zany130

It would actually be great if the script would only complain about invalid entries. There should however be a warning about those entries.

LDprg avatar Aug 06 '24 09:08 LDprg

We can certainly take steps to improve warnings reported and error handling by the PowerShell script. The biggest complexity would be figuring out how to communicate errors and warnings from the PowerShell script to the installer bash script. Currently, a bash script file is programmatically written by the PowerShell script and then directly parsed by the bash script.

KernelGhost avatar Aug 09 '24 08:08 KernelGhost