Hi everyone!
First of all, thanks for this script!
It works... but very weird for me)
My environment:
Windows 10
OS version: 2004
OS build: 20190.1000 (insider preview "dev")
WSL: Ubuntu-20.04.1
Linux kernel: 4.19.121
The script itself works strange: when I run wsl for the first time and execute a command:
snap version
The result of the command execution:
snap 2.45.1+20.04.2
snapd unavailable
series -
Then I execute the command:
systemctl
The result of the command execution:
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
Then I execute the command:
sudo snap --list
The result of the command execution:
error: access denied (see 'snap help login')
Then I execute the command:
wslfetch
And, oh! miracle! Once this command is executed, snap packages become available.
But the weird thing doesn't end there - if I to run snap packets in a new session — an error will be displayed:
error: cannot find installed snap "bashtop" at revision 112: missing file /snap/bashtop/112/meta/snap.yaml
In addition, in the session where snap packages are available, are no longer commands available, such as: "code .zshrc" or "explorer.exe ."
code ~/.zshrc
zsh: command not found: code
explorer.exe .
zsh: command not found: explorer.exe
It seems that if systemd is available in the current session, which in turn makes snapd and snap packages available, this makes it impossible to use commands to run windows applications in this current session.
But if systemd is not available in the session, then application windows commands will be available.
And this is somehow affected by the command "wslfetch".
Obviously, if the error "zsh: command not found: code" or "zsh: command not found: code" is displayed, it is somehow related to the PATH environment variable.
It looks like that activation of systemd somehow modifies the PATH environment variable - but how? I don't understand that.
What result do I want to achieve? Ideally, for systemd to start with any new ubuntu session and this should not modify the PATH environment variable in any way - I should be able to use "code .something" or "explorer.exe ." and similar commands to run windows applications from ubuntu when systemd is activated.
This is a link to the video for a better understanding of the problem, where I show everything I wrote above: https://yadi.sk/i/gRPIMDwaDqt6uw