lucyllewy / one-script-wsl2-systemd Goto Github PK
View Code? Open in Web Editor NEWThe one-script variant of the systemd hack for WSL2
License: MIT License
The one-script variant of the systemd hack for WSL2
License: MIT License
I just did a fresh install of WSL2 with Ubuntu
wsl.exe install -d Ubuntu
I also installed Powershell 7 and run the following command
pwsh.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -File C:\Users\frhec\Desktop\install.ps1 -distro Ubuntu
No error during installation but as soon I launch the Ubuntu terminal I get
Waiting for systemd to finish booting
.....
Systemd is ready. Logging in.
x86 : The term 'x86' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:159
+ ... Text.Encoding]::GetEncoding(437); Write-Output $Env:ProgramFiles(x86)
+ ~~~
+ CategoryInfo : ObjectNotFound: (x86:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
wslpath: /GnuPG/bin/gpg.exe
ln: failed to create symbolic link '/home/frhec/.wsl-cmds/gpg' -> '': No such file or directory
Any Ideas? Here are my specs
Device name DESKTOP-4IA2HB2
Processor AMD Ryzen 9 5900X 12-Core Processor 4.30 GHz
Installed RAM 32.0 GB
------
Edition Windows 11 Pro
Version 21H2
Installed on 10/25/2021
OS build 22000.556
Experience Windows Feature Experience Pack 1000.22000.556.0
Hi, thanks for your script! 😃 🚀
I installed your script and after that, for some reason, the cpu load increases a lot when running normal commands - it was not like that before I installed the script. I showed it in the video: I opened the search and just moved through the previous commands, - on the right side it says: "loading" and at that moment the cpu load increases.
After that I deleted the script and installed it without GPG4Win and without the custom kernel - but even in this case the load on the CPU when running simple commands increases significantly. That said, otherwise everything seems to work fine. I also added different variants to exceptions for windows defender: wsl.exe, wslhost.exe, ubuntu2004.exe and also added to exceptions folders containing executable wsl files. But still, the cpu load increases significantly.
What could be the reason and do you have any idea how to fix it?
Just ran the install script as the README says, but I think I'm locked out of the VM:
realpath: missing operand
Try 'realpath --help' for more information.
[sudo] password for joe:
/bin/sh: 0: Can't open
[process exited with code 127]
So I tried to run this on the latest build and it is completely broken, here is a log of the issues, I have tried everything, cmd, PowerShell and I cant get this to work, I also tried different distros and not a single one works, here is what I did:
Get the following errors:
C:\Users\DiegoMagdaleno\Downloads>powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -File .\install.ps1
--- Installing WSL PowerShell module --- No distro specified, using your default distro UbuntuWSL --- Installing files in UbuntuWSL /bin/bash: -c: line 2: syntax error near unexpected token `<<' /bin/bash: -c: line 2: `cat > <<'EOF''
Wsl.exe returned exit code 1
At C:\Program Files\WindowsPowerShell\Modules\Wsl\1.0.0\Wsl.psm1:932 char:21
+ throw "Wsl.exe returned exit code $LASTEXITCODE"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Wsl.exe returned exit code 1:String) [], RuntimeException
+ FullyQualifiedErrorId : Wsl.exe returned exit code 1
WARNING:
--unit=multi-user.target ]; then if [ -x /usr/lib/systemd/systemd ]; then SYSTEMD_EXE=/usr/lib/systemd/systemd else SYSTEMD_EXE=/lib/systemd/systemd
fi
fi
SYSTEMD_EXE=/lib/systemd/systemd: -c: line 2: syntax error near unexpected token `<<'
--unit=multi-user.target ]; then
if [ -x /usr/lib/systemd/systemd ]; then SYSTEMD_EXE=/usr/lib/systemd/systemd else SYSTEMD_EXE=/lib/systemd/systemd fi
fi
SYSTEMD_EXE=/lib/systemd/systemd: -c: line 2: `cat > <<'EOF''
mount: /proc/sys/fs/binfmt_misc: binfmt_misc already mounted on /proc/sys/fs/binfmt_misc.
Trying to run as user instance, but $XDG_RUNTIME_DIR is not set.
Wsl.exe returned exit code 1
At C:\Program Files\WindowsPowerShell\Modules\Wsl\1.0.0\Wsl.psm1:932 char:21
+ throw "Wsl.exe returned exit code $LASTEXITCODE"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Wsl.exe returned exit code 1:String) [], RuntimeException
+ FullyQualifiedErrorId : Wsl.exe returned exit code 1
C:\Users\DiegoMagdaleno\Downloads>powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -File .\install.ps1
--- Installing WSL PowerShell module
C:\Users\DiegoMagdaleno\Downloads>powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -File .\install.ps1
--- Installing WSL PowerShell module
--- No distro specified, using your default distro UbuntuWSL
--- Installing files in UbuntuWSL
/bin/bash: -c: line 2: syntax error near unexpected token `<<'
/bin/bash: -c: line 2: `cat > <<'EOF''
Wsl.exe returned exit code 1
At C:\Program Files\WindowsPowerShell\Modules\Wsl\1.0.0\Wsl.psm1:932 char:21
+ throw "Wsl.exe returned exit code $LASTEXITCODE"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Wsl.exe returned exit code 1:String) [], RuntimeException
+ FullyQualifiedErrorId : Wsl.exe returned exit code 1 WARNING: --unit=multi-user.target ]; then if [ -x /usr/lib/systemd/systemd ]; then
SYSTEMD_EXE=/usr/lib/systemd/systemd
else
SYSTEMD_EXE=/lib/systemd/systemd
fi
fi
SYSTEMD_EXE=/lib/systemd/systemd: -c: line 2: syntax error near unexpected token `<<' --unit=multi-user.target ]; then if [ -x /usr/lib/systemd/systemd ]; then SYSTEMD_EXE=/usr/lib/systemd/systemd
else
SYSTEMD_EXE=/lib/systemd/systemd
fi
fi
SYSTEMD_EXE=/lib/systemd/systemd: -c: line 2: `cat > <<'EOF''
mount: /proc/sys/fs/binfmt_misc: binfmt_misc already mounted on /proc/sys/fs/binfmt_misc.
Trying to run as user instance, but $XDG_RUNTIME_DIR is not set.
Wsl.exe returned exit code 1
At C:\Program Files\WindowsPowerShell\Modules\Wsl\1.0.0\Wsl.psm1:932 char:21
+ throw "Wsl.exe returned exit code $LASTEXITCODE"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Wsl.exe returned exit code 1:String) [], RuntimeException
+ FullyQualifiedErrorId : Wsl.exe returned exit code 1
C:\Users\DiegoMagdaleno\Downloads>powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -File .\install.ps1
--- Installing WSL PowerShell module
--- No distro specified, using your default distro UbuntuWSL
--- Installing files in UbuntuWSL
/bin/bash: -c: line 2: syntax error near unexpected token `<<'
/bin/bash: -c: line 2: `cat > <<'EOF''
Wsl.exe returned exit code 1
At C:\Program Files\WindowsPowerShell\Modules\Wsl\1.0.0\Wsl.psm1:932 char:21
+ throw "Wsl.exe returned exit code $LASTEXITCODE"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Wsl.exe returned exit code 1:String) [], RuntimeException
+ FullyQualifiedErrorId : Wsl.exe returned exit code 1
WARNING:
--unit=multi-user.target ]; then if [ -x /usr/lib/systemd/systemd ]; then SYSTEMD_EXE=/usr/lib/systemd/systemd else SYSTEMD_EXE=/lib/systemd/systemd
fi
fi
SYSTEMD_EXE=/lib/systemd/systemd: -c: line 2: syntax error near unexpected token `<<'
--unit=multi-user.target ]; then
if [ -x /usr/lib/systemd/systemd ]; then
SYSTEMD_EXE=/usr/lib/systemd/systemd
else
SYSTEMD_EXE=/lib/systemd/systemd
fi
fi
SYSTEMD_EXE=/lib/systemd/systemd: -c: line 2: `cat > <<'EOF''
mount: /proc/sys/fs/binfmt_misc: binfmt_misc already mounted on /proc/sys/fs/binfmt_misc.
Trying to run as user instance, but $XDG_RUNTIME_DIR is not set. Wsl.exe returned exit code 1 At C:\Program Files\WindowsPowerShell\Modules\Wsl\1.0.0\Wsl.psm1:932 char:21 + throw "Wsl.exe returned exit code $LASTEXITCODE" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (Wsl.exe returned exit code 1:String) [], RuntimeException + FullyQualifiedErrorId : Wsl.exe returned exit code 1
ForEach-Object : Cannot validate argument on parameter 'User'. The argument is null or empty. Provide an argument that is not null or empty, and then try the
command again. At C:\Users\DiegoMagdaleno\Downloads\install.ps1:155 char:42 + $files.values + $agentfiles.values | ForEach-Object { + ~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [ForEach-Object], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.ForEachObjectCommand
/bin/bash: -c: line 2: syntax error near unexpected token `<<'
/bin/bash: -c: line 2: `cat > <<'EOF''
Wsl.exe returned exit code 1
At C:\Program Files\WindowsPowerShell\Modules\Wsl\1.0.0\Wsl.psm1:932 char:21
+ throw "Wsl.exe returned exit code $LASTEXITCODE"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Wsl.exe returned exit code 1:String) [], RuntimeException
+ FullyQualifiedErrorId : Wsl.exe returned exit code 1
ForEach-Object : Cannot validate argument on parameter 'User'. The argument is null or empty. Provide an argument that is not null or empty, and then try the
command again.
At C:\Users\DiegoMagdaleno\Downloads\install.ps1:155 char:42
+ $files.values + $agentfiles.values | ForEach-Object {
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [ForEach-Object], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.ForEachObjectCommand
--- Setting systemd to automatically start in UbuntuWSL
--- Installing SSH, GPG, etc. agent scripts in UbuntuWSL
Invoke-WslCommand : Cannot validate argument on parameter 'DistributionName'. The argument is null or empty. Provide an argument that is not null or empty, and
then try the command again.
At C:\Users\DiegoMagdaleno\Downloads\install.ps1:100 char:41
+ Invoke-WslCommand -DistributionName $DistributionName -User $User ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-WslCommand], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Invoke-WslCommand
WARNING: Could not fetch the GPG agent script. Continuing without it.
Invoke-WslCommand : Cannot validate argument on parameter 'DistributionName'. The argument is null or empty. Provide an argument that is not null or empty, and
then try the command again.
At C:\Users\DiegoMagdaleno\Downloads\install.ps1:100 char:41
+ Invoke-WslCommand -DistributionName $DistributionName -User $User ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-WslCommand], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Invoke-WslCommand
WARNING: Could not fetch the SSH agent script. Continuing without it.
--- Disabling conflicting systemd services in UbuntuWSL
--- Updating desktop-file MIME database in UbuntuWSL
/bin/bash: -c: line 24: syntax error near unexpected token `ubuntu'
/bin/bash: -c: line 24: ` ubuntu)'
Wsl.exe returned exit code 1
At C:\Program Files\WindowsPowerShell\Modules\Wsl\1.0.0\Wsl.psm1:932 char:21
+ throw "Wsl.exe returned exit code $LASTEXITCODE"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Wsl.exe returned exit code 1:String) [], RuntimeException
+ FullyQualifiedErrorId : Wsl.exe returned exit code 1
C:\Users\DiegoMagdaleno\Downloads>`
The same thing happens with any distro I try.
Does the minimal install section only work on Windows 11? I have not been able to get the "[boot] command" to work on Windows 10 and I read (at Microsoft WSL-config) that it only works with Windows 11. If it did work in the past, I'd like to know how so I could get it going that way again, and if not, I'll update the readme.
After running the script, I don't seem to be able to run any exe commands anymore:
➜ cmd.exe /c ver
<3>init: (1158) ERROR: UtilConnectToInteropServer:300: connect failed 2
➜ code .
<3>init: (1190) ERROR: UtilConnectToInteropServer:300: connect failed 2
This is my setting in Windows Terminal
I am using zsh.
This is the behavior when opening split panes,
For vertical ones the promptline stays on the left hand side instead of inside of the right split pane.
Prior to running this script it was behaving as expected.
After uninstalling the expected behavior is restored:
On this system:
`PS D:\Users\eigil> wsl --status
Default Distribution: Ubuntu
Default Version: 2
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.22610.1
PS D:\Users\eigil> wsl --list --all -v
NAME STATE VERSION
I can't get it to work.
pwsh.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -File "D:\Users\eigil\projects\myCommands\WSL_Div\one-script-wsl2-systemd\install.ps1"
That didn't do anything (as far as I could see).
pwsh.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -File "D:\Users\eigil\projects\myCommands\WSL_Div\one-script-wsl2-systemd\install.ps1" -distro UbuntuDvlGenie
That didn't do anything either (as far as I could see).
Minimal manual installation
Now I get this errer
: command not found
-bash: /etc/profile.d/00-wsl2-systemd.sh: line 21: syntax error near unexpected token$'in\r'' 'bash: /etc/profile.d/00-wsl2-systemd.sh: line 21:
case "$0" in
when the distro is started.
--
Eigil
I ran the install script on an older version of ubuntu wsl, and have since uninstalled that instance, now every time I boot up, a powershell window pops-up with this error message:
Cannot invoke method. Method invocation is supported only on core types in this language mode.
At line:1 char:31
+ ... heduledJob; $jobDef = [Microsoft.PowerShell.ScheduledJob.ScheduledJob ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodInvocationNotSupportedInConstrainedLanguage
You cannot call a method on a null-valued expression.
At line:1 char:216
+ ... ata\Local\Microsoft\Windows\PowerShell\ScheduledJobs'); $jobDef.Run()
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
I tried running the uninstall script but it keeps giving this error:
#########################################################
# #
# One Script WSL2 Systemd uninstall script #
# #
#########################################################
Write-PowerShellMsg : The term 'Write-PowerShellMsg' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At C:\Users\user\.workspace\wsl2\systemd\uninstall.ps1:183 char:5
+ Write-PowerShellMsg
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Write-PowerShellMsg:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
After running the script, and booting up distro (ubuntu-20.04 I get permission denied.
chmod on the 00-wsl2-systemd.sh says -rw-r--r-- 1 root root
Changed permission to chmod 0755 /etc/profile.d/00-wsl2-systemd.sh and the script ran.
Then when starting the distro I see a blinking curser, and at one point I found this error:
rm: cannot remove '/mnt/c/users/john/.ubuntu/doe/.systemd.env'
Errors when trying to reset with:
powershell.exe: ScriptBlock should only be specified as a value of the Command parameter.
or from within bash. Black screen.
I made 10 various attempts to figure out where the problem might be, but with no luck. such a shame..
I just came to inform you that the Out-IniFile function is missing in the uninstall file.
#########################################################
# #
# One Script WSL2 Systemd uninstall script #
# #
#########################################################
---------------------------------------------------------
Uninstalling systemd enablement from Ubuntu
Uninstalling GnuPG
Nenhum pacote instalado foi encontrado que corresponda aos critérios de entrada.
Reverting WSL to the Microsoft-provided kernel
Out-IniFile: C:\Users\USER\OneDrive\script-completo\Systemd-WSL\uninstall.ps1:256
Line |
256 | Out-IniFile $wslconfig "$env:USERPROFILE/.wslconfig"
| ~~~~~~~~~~~
| The term 'Out-IniFile' is not recognized as a name of a cmdlet, function, script file, or executable program. Check
| the spelling of the name, or if a path was included, verify that the path is correct and try again.
Done.
I found the function in the setup-agent-services.ps1 file from lines 82-106
Thank you for the good work.
Hi, I've been experiencing a weird issue involving /tmp
.
This happens when a process that is non-systemd
'd tries to access the /tmp
files created inside systemd environment.
To reproduce:
touch "$(mktemp)"
wsl -d <distro> ls /tmp
My distribution is SLES-15-SP1 and I followed the minimal manual installation. After the installation, wsl distros is not starting. But the wsl is running able to interact with it via cmd/powershell but not able to launch it separately. I'm able to see the systemd and its related processes running. Please help
After installed systemd applications using Qt exhibits always a black window. I've tried with VLC and QtCreator.
What I'm missing?
First of all, thanks for this awesome script. It was really easy and works pretty well.
I installed GitKraken and IntelliJ IDEA Ultimate with snap on my WSL 2 system. I am running Ubuntu 20.04.
I am pretty sure that I was able to run gitkraken
in my terminal just fine when I installed it but after a restart, this is no longer possible. I wasn't able to start IntelliJ at all.
It's possible to start both snaps with snap run <name>
and I can also start them on my Windows 11 system because I copied the desktop files from /var/lib/snapd/desktop/applications
to /usr/share/applications
.
When executing sudoedit /etc/environment
, I get the following output:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
WSL_INTEROP='/run/WSL/1300_interop'
WSL_DISTRO_NAME=''
DISPLAY=':0'
The snap path is included but snaps are not found as commands.
❯ gitkraken
zsh: command not found: gitkraken
Using echo $PATH
gives me a list of the whole Windows path as well.
I'm genuinely confused.
Alpine by default uses OpenRC. There is no decent systemd package for alpine(?).
WSL Team announced support for systemd.
So whenever I try to run the script it yields:
ln: /etc/systemd/user/dirmngr.service: No such file or directory
I guess that these are the systemd units that need to be disabled. Yet I have no systemd installed.
So what am I supposed to do?
(Btw: during -Debug
flag the behaviour of the script is different.)
Hello. I am unable to connect to my display to run GUI apps. It keeps giving me the following error:
I know that this has something to do with the fact that wsl2 uses a different ip address that my host windows system uses, but I do not know how to solve this problem. I have found ways to edit the DISPLAY variable by using export DISPLAY=$(grep nameserver /etc/resolv.conf | awk '{print $2}'):0.0
and adding it to .bashrc
, but when I do that, the bash simply gets stuck after printing Systemd is ready. Logging in.
Does anyone know how one could solved this issue?
I apologize if my question is not related to your wonderful script.
I installed your script and everything seems to work fine (there is one nuance, I asked this question in a separate post).
But shouldn't it be that when I run the command:
systemctl disable
then afterwards I should also be able to make the unit available again by running the command
systemctl enable ?
In my case, when I execute the command systemctl disable , then after that I can not reactivate the unit.
Or is this expected behavior of systemd and cannot be changed?
When running pwsh.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -File install.ps1 -distro Ubuntu-22.04 -Debug
I receive the following error message:
DEBUG: --- Detecting default user in Ubuntu-22.04
/usr/sbin/enter-systemd-namespace: line 10: /usr/sbin/daemonize: No such file or directory
Is there a different command required to launch ubuntu22.04.exe
with Windows Terminal after installing this? I installed using the powershell method, and then got the error about /sys/kernel/security path does not exist.
With fedoraremix from WhiteWater, it comes with this pre-installed and You just need to type fedoraremix.exe -s
with -s option.
--- Installing files in kali-linux
--- Installing SSH, GPG, etc. agent scripts in kali-linux
--- Disabling conflicting systemd services in kali-linux
--- Updating desktop-file MIME database in kali-linux
Get:1 http://kali.download/kali kali-rolling InRelease [30.5 kB]
Get:2 http://kali.download/kali kali-rolling/main amd64 Packages [17.8 MB]
Get:3 http://kali.download/kali kali-rolling/main amd64 Contents (deb) [40.3 MB]
Get:4 http://kali.download/kali kali-rolling/contrib amd64 Packages [108 kB]
Fetched 58.3 MB in 15s (3,983 kB/s)
Reading package lists... Done
Reading package lists...
Building dependency tree...
Reading state information...
desktop-file-utils is already the newest version (0.26-1).
desktop-file-utils set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 28 not upgraded.
--- Installing WSLUtilities in kali-linux
Hit:1 http://kali.download/kali kali-rolling InRelease
Reading package lists... Done
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
apt-transport-https gnupg2
0 upgraded, 2 newly installed, 0 to remove and 28 not upgraded.
Need to get 595 kB of archives.
After this operation, 620 kB of additional disk space will be used.
Get:1 http://kali.download/kali kali-rolling/main amd64 apt-transport-https all 2.3.8 [160 kB]
Get:2 http://kali.download/kali kali-rolling/main amd64 gnupg2 all 2.2.27-2 [434 kB]
Fetched 595 kB in 1s (467 kB/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 501913 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_2.3.8_all.deb ...
Unpacking apt-transport-https (2.3.8) ...
Selecting previously unselected package gnupg2. Preparing to unpack .../gnupg2_2.2.27-2_all.deb ... Unpacking gnupg2 (2.2.27-2) ... Setting up gnupg2 (2.2.27-2) ... Setting up apt-transport-https (2.3.8) ...
Processing triggers for kali-menu (2021.3.1) ...
Processing triggers for man-db (2.9.4-2) ...
--2021-08-27 09:07:35-- https://access.patrickwu.space/wslu/public.asc
Resolving access.patrickwu.space (access.patrickwu.space)... Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
159.65.110.94, 162.159.26.99, 162.159.25.129, ...
Connecting to access.patrickwu.space (access.patrickwu.space)|159.65.110.94|:443... failed: Connection timed out.
Connecting to access.patrickwu.space (access.patrickwu.space)|162.159.26.99|:443... failed: Connection timed out.
Connecting to access.patrickwu.space (access.patrickwu.space)|162.159.25.129|:443... failed: Connection timed out.
Connecting to access.patrickwu.space (access.patrickwu.space)|162.159.27.72|:443... failed: Connection timed out.
Connecting to access.patrickwu.space (access.patrickwu.space)|162.159.24.39|:443... failed: Connection timed out.
Connecting to access.patrickwu.space (access.patrickwu.space)|162.159.24.25|:443... failed: Connection timed out.
Connecting to access.patrickwu.space (access.patrickwu.space)|2400:cb00:2049:1::a29f:1b48|:443... failed: Network is unreachable.
Connecting to access.patrickwu.space (access.patrickwu.space)|2400:cb00:2049:1::a29f:1981|:443... failed: Network is unreachable.
Connecting to access.patrickwu.space (access.patrickwu.space)|2400:cb00:2049:1::a29f:1a63|:443... failed: Network is unreachable.
Connecting to access.patrickwu.space (access.patrickwu.space)|2400:cb00:2049:1::a29f:1827|:443... failed: Network is unreachable.
Connecting to access.patrickwu.space (access.patrickwu.space)|2400:cb00:2049:1::a29f:1819|:443... failed: Network is unreachable.
gpg: no valid OpenPGP data found.
Hit:1 http://kali.download/kali kali-rolling InRelease
Ign:2 https://access.patrickwu.space/wslu/kali kali-rolling InRelease
Ign:2 https://access.patrickwu.space/wslu/kali kali-rolling InRelease
Ign:2 https://access.patrickwu.space/wslu/kali kali-rolling InRelease
Err:2 https://access.patrickwu.space/wslu/kali kali-rolling InRelease
Cannot initiate the connection to access.patrickwu.space:443 (2400:cb00:2049:1::a29f:1b48). - connect (101: Network is unreachable) Cannot initiate the connection to access.patrickwu.space:443 (2400:cb00:2049:1::a29f:1981). - connect (101: Network is unreachable) Cannot initiate the connection to access.patrickwu.space:443 (2400:cb00:2049:1::a29f:1a63). - connect (101: Network is unreachable) Cannot initiate the connection to access.patrickwu.space:443 (2400:cb00:2049:1::a29f:1827). - connect (101: Network is unreachable) Cannot initiate the connection to access.patrickwu.space:443 (2400:cb00:2049:1::a29f:1819). - connect (101: Network is unreachable) Could not connect to access.patrickwu.space:443 (159.65.110.94), connection timed out Could not connect to access.patrickwu.space:443 (162.159.26.99), connection timed out Could not connect to access.patrickwu.space:443 (162.159.25.129), connection timed out Could not connect to access.patrickwu.space:443 (162.159.27.72), connection timed out Could not connect to access.patrickwu.space:443 (162.159.24.39), connection timed out Could not connect to access.patrickwu.space:443 (162.159.24.25), connection timed out
Reading package lists... Done
W: Failed to fetch https://access.patrickwu.space/wslu/kali/dists/kali-rolling/InRelease Cannot initiate the connection to access.patrickwu.space:443 (2400:cb00:2049:1::a29f:1b48). - connect (101: Network is unreachable) Cannot initiate the connection to access.patrickwu.space:443 (2400:cb00:2049:1::a29f:1981). - connect (101: Network is unreachable) Cannot initiate the connection to access.patrickwu.space:443 (2400:cb00:2049:1::a29f:1a63). - connect (101: Network is unreachable) Cannot initiate the connection to access.patrickwu.space:443 (2400:cb00:2049:1::a29f:1827). - connect (101: Network is unreachable) Cannot initiate the connection to access.patrickwu.space:443 (2400:cb00:2049:1::a29f:1819). - connect (101: Network is unreachable) Could not connect to access.patrickwu.space:443 (159.65.110.94), connection timed out Could not connect to access.patrickwu.space:443 (162.159.26.99), connection timed out Could not connect to access.patrickwu.space:443 (162.159.25.129), connection timed out Could not connect to access.patrickwu.space:443 (162.159.27.72), connection timed out Could not connect to access.patrickwu.space:443 (162.159.24.39), connection timed out Could not connect to access.patrickwu.space:443 (162.159.24.25), connection timed out
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package wslu
Skipping Gpg4win installation
--- Adding a Windows scheduled tasks and starting services
Hi! I'm currently unable to use GPG through the bridge.
Basic install of the script with only -d Ubuntu
flag (so GPG was installed by the script), fresh Ubuntu install.
After restarting WSL, I get the next output:
Failed to connect to bus: No such file or directory
mkdir: cannot create directory ‘/run/user/1000’: Permission denied
2021/10/03 23:35:51 socat[70] E bind(5, {AF=1 "/run/user/1000/gnupg/S.gpg-agent"}, 34): No such file or directory
>
It partially looks like this error which I got during the previous run under Win10.
Thank you for this script.
It worked and I can install snap packages, great.
I observer one thing though.
Whenever I start wss.exe in windows terminal I get this message before my prompt appears.
x86 : The term 'x86' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:32
+ Write-Output $Env:ProgramFiles(x86)
+ ~~~
+ CategoryInfo : ObjectNotFound: (x86:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
wslpath: /GnuPG/bin/gpg.exe
ln: failed to create symbolic link '/home/mrt181/.wsl-cmds/gpg' -> '': No such file or directory
I have created the link manually myself
ln -s /mnt/c/Program\ Files\ \(x86\)/GnuPG/bin/gpg.exe gpg
but the error persists on each start. It looks as if the gpg installation path needs to be escaped.
Just a quick note to let you know that I've had a patch accepted into AppArmor (and have a similar one awaiting review for snapd) to support running under WSL:
https://gitlab.com/apparmor/apparmor/-/merge_requests/812
As suggested in the comments there, there's a potential issue with AppArmor profiles leaking from distro to distro and/or from container to container because of WSL's architecture, so to avoid this problem in genie, I've arranged for it to create an AppArmor namespace before starting systemd (if AppArmor support is detected in the kernel) to prevent potential leakage.
Thought I'd let the other authors of WSL systemd hacks know in case you wish to take similar measures. In case it might be useful, my implementation of this can be found here, called from here.
Regards,
Alistair
genie developer
Following #5
Since that patch, I now see
/etc/profile.d/00-wsl2-systemd.sh:50: command not found: -zsh
When trying to open a WSL shell.
Is there a way to uninstall this script, i.e. to revert the changes (on both Windows and WSL sides) brought by this script? There is seemingly no separate uninstall script nor an -Uninstall
option in Install.ps1
. Are there any plans to add such feature?
When starting vscode without launching it from a WSL shell with remote.WSL.useShellEnvironment
enabled, $HOME/.wsl-cmds
will not be available in path.
Making both the SSH and the GPG agent inaccessible to vscode and other tools that take the same approach as vscode to detect the environment.
Maybe it is an idea to make the script add PATH="$HOME/.wsl-cmds:$PATH:/snap/bin"
to ~/.bashrc
, ~/.profile
or whatever vscode gets the environment from? Or maybe it's an idea to change how the environment is configured?
Without it will make both the forwarded agents and snap inaccessible from vscode as snap is also not in path.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.