Open alexeyr-ci opened 7 months ago
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
I don't see what you see when I test. Can you post your ~/.wslconfig
& /etc/wsl.conf
Typically, we like logs from here: https://github.com/Microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method
Sorry, I was going to include them but forgot.
~/.wslconfig
[wsl2]
memory=16GB
processors=4
[experimental]
autoMemoryReclaim=gradual
sparseVhd=true
/etc/wsl.conf:
[boot]
systemd=true
[user]
default=alexey
For me, it works when I open a "normal" interactive shell,
> wsl.exe -d Ubuntu
$ shopt login_shell
login_shell on
$ whereis vlc
vlc: /snap/bin/vlc
but not when passing commands directly as an argument.
> wsl.exe -d Ubuntu -- shopt login_shell
login_shell off
> wsl.exe -d Ubuntu -- whereis vlc
vlc:
> wsl.exe -d Ubuntu -- vlc
/bin/bash: line 1: vlc: command not found
I installed VLC as a snap to reproduce the issue. Snaps are installed within /snap/bin/
$ sudo snap install vlc
vlc 3.0.19 from VideoLAN✓ installed
but not when passing commands directly as an argument.
That's the expected behavior according to https://github.com/microsoft/WSL/issues/816#issuecomment-301216901 (unless it was changed later, the comment is from 2017):
As of build 16188 when running bash.exe without arguments (or with the ~ argument) bash will be launched as a login shell. The same is true for the new wsl.exe binary (with the exception that wsl launches your user's default shell as a login shell).
@alexeyr-ci Thanks for the info. I guess it makes sense, as it seems to match the behavior of sshd
.
$ ssh 172.31.192.139 shopt login_shell
login_shell off
Unfortunately, in my case with NixOS, the distro is not using the standard paths, so I end up with almost nothing in the PATH, not even bash
or ls
. 😆 (I am not sure how they fixed the initial environment when connecting over ssh.) I cannot help you with your issue then.
I indeed cannot reproduce the issue:
wsl --shell-type login
$ shopt login_shell
login_shell on
@alexeyr-ci: Can you share details about your distro and default shell ?
The distro is Ubuntu, and the shell is bash
. Nothing special here.
Windows Version
Microsoft Windows [Version 10.0.22621.3085]
WSL Version
2.0.9.0
Are you using WSL 1 or WSL 2?
Kernel Version
5.15.133.1-1
Distro Version
Ubuntu 22.04
Other Software
Repro Steps
Run
wsl
orwsl --shell-type login
from Windows.Expected Behavior
The WSL shell should be a login shell (according to https://github.com/microsoft/WSL/issues/816#issuecomment-301216901). In particular, it should source
.profile
. This was working until a few days ago (with justwsl
).Actual Behavior
It isn't a login shell:
.profile
is not sourced andDiagnostic Logs
No response (I've tried to use Feedback Hub according to https://github.com/Microsoft/WSL/blob/master/CONTRIBUTING.md#9-collect-wsl-logs-with-feedback-hub, but I don't see "Attachments"; instead it only attached a screenshot of the screen by default which wouldn't be helpful).