DamionGans / ubuntu-wsl2-systemd-script

[Does not work anymore!] Script to enable systemd support on current Ubuntu WSL2 images
1.56k stars 382 forks source link

"Sleeping for 1 second to let systemd settle" #51

Closed AaronNGray closed 3 years ago

AaronNGray commented 3 years ago

Getting the following after installing :-

C:\Users\aaron>wsl
Sleeping for 1 second to let systemd settle
Sleeping for 1 second to let systemd settle
Sleeping for 1 second to let systemd settle
Sleeping for 1 second to let systemd settle
Sleeping for 1 second to let systemd settle
Sleeping for 1 second to let systemd settle
Sleeping for 1 second to let systemd settle
Sleeping for 1 second to let systemd settle
Sleeping for 1 second to let systemd settle
Sleeping for 1 second to let systemd settle
...
AaronNGray commented 3 years ago

Reinstalled Ubuntu and its working now.

zccnqybjce commented 1 year ago

In PowerShell or CMD:

The following command starts WSL as root: wsl --user root

After logging in to the system, execute the following script using the following

#!/bin/bash

self_dir=$(pwd)

echo "Uninstalling ubuntu-wsl2-systemd-script"

sudo rm -rf /usr/sbin/start-systemd-namespace
sudo rm -rf /usr/sbin/enter-systemd-namespace
sudo rm -rf /etc/sudoers.d/systemd-namespace

cd /var/tmp
if [ -f "/etc/bash.bashrc" ]; then
sudo grep -v "# Start or enter a PID namespace in WSL2
export USE_WSLG_SOCKET=false
export USE_WSLG_SOCKET=true
source /usr/sbin/start-systemd-namespace" /etc/bash.bashrc > tmpfile
sudo mv tmpfile /etc/bash.bashrc
fi

cd $self_dir

Once this is done, you can log in with your own user.

reference:https://blog.csdn.net/marin1993/article/details/127935273