Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Windows Programs ignores the first argument #264

Closed
IsaacOscar opened this issue Apr 26, 2022 · 2 comments
Closed

Running Windows Programs ignores the first argument #264

IsaacOscar opened this issue Apr 26, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@IsaacOscar
Copy link

Windows version (build number):
WSL version: 0.58.3.0
Kernel version: 5.10.102.1
WSLg version: 1.0.33
MSRDC version: 1.2.2924
Direct3D version: 1.601.0
Windows version: 10.0.22000.613

(note: I installed the Windows Store Version of Genie)
Linux distribution:
openSUSE Tumbleweed 20220424

Genie version:
genie 2.3

To Reproduce

If I start up genie, and then run any windows program from WSL, the first argument to it will be ignored:

  • cmd.exe "anything here" "/?" acts just like cmd.exe "/?" would in windows, i.e. it prints the help for cmd.exe
  • cmd.exe "anything here" /C "echo hello" acts like cmd.exe /C "echo hello", i.e. it prints hello
  • cmd.exe alone, without any arguments, does nothing except set the exit status to 1.

The same behaviour occurs for other windows programs, I've tested wsl.exe, reg.exe and even explorer.exe

I hypothesis that it is using the first argument as the program name (i.e. as argv[0]), however I don't know how to check this.

Bat files are even weirder:

  • running ./foo.bat args... seems to just do cmd.exe /C args..., regardless of the contents of foo.bat, provided that file is readable and non-empty.
  • running ./foo.bat without any arguments, does nothing but set the exit status to 1.

The same behaviour occurs if I proceed my WSL commands with /init.

Note it doesn't matter whether I run the above commands inside our outside of the bottle,
as long as have started up genie first.

Relavent config files
This is my /etc/wsl.conf file:

[automount]
root = /
enabled = true
options = "metadata,umask=022,case=dir"
mountFsTab = true

[network]
generateHosts = true
generateResolvConf = true

[interop]
enabled = true
appendWindowsPath = true

[user]
default = root

And my C:\Users\Isaac\.wslconfig file:

[wsl2]
guiApplications=true
memory=26084MB # 80% of total hardware ram
processors=16 # number of hardware threads

My /etc/genie.ini file:

[genie]
systemd-timeout=240
clone-env=WSL_DISTRO_NAME,WSL_INTEROP,WSLENV,DISPLAY,WAYLAND_DISPLAY,PULSE_SERVER,XDG_RUNTIME_DIR,WT_SESSION,WT_PROFILE_ID,VSCODE_WSL_EXT_LOCATION
secure-path=/lib/systemd:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
clone-path=true
target-warning=true
update-hostname=false
update-hostname-suffix=-wsl
resolved-stub=false
@IsaacOscar IsaacOscar added the bug Something isn't working label Apr 26, 2022
@IsaacOscar
Copy link
Author

I fixed the problem by masking the systemd-binfmt unit.

@cerebrate
Copy link
Member

@IsaacOscar

Oops, I missed this one. This is the same issue as #267 , and a fix is in for it in 2.4, so you may wish to unmask the unit at that time. Alternatively, you can unmask it now and edit the /usr/lib/binfmt.d/WSLInterop.conf file as per that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants