From 20262aed68581e1273b05c9c613aa671d9be2b75 Mon Sep 17 00:00:00 2001 From: John Gray Date: Thu, 9 Feb 2023 17:53:30 -0800 Subject: [PATCH] Change nsenter options to unbreak WSL Running the original script broke WSL. This change fixed it, thought I'm not sure why. The options "-m -p" seem to conflict but what do I know. Found at https://github.com/DamionGans/ubuntu-wsl2-systemd-script/issues/85. --- enter-systemd-namespace | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enter-systemd-namespace b/enter-systemd-namespace index d7a949d..3ab88c5 100755 --- a/enter-systemd-namespace +++ b/enter-systemd-namespace @@ -38,11 +38,11 @@ fi USER_HOME="$(getent passwd | awk -F: '$1=="'"$SUDO_USER"'" {print $6}')" if [ -n "$SYSTEMD_PID" ] && [ "$SYSTEMD_PID" != "1" ]; then if [ -n "$1" ] && [ "$1" != "bash --login" ] && [ "$1" != "/bin/bash --login" ]; then - exec /usr/bin/nsenter -t "$SYSTEMD_PID" -a \ + exec /usr/bin/nsenter -t "$SYSTEMD_PID" -m -p \ /usr/bin/sudo -H -u "$SUDO_USER" \ /bin/bash -c 'set -a; [ -f "$HOME/.systemd-env" ] && source "$HOME/.systemd-env"; set +a; exec bash -c '"$(printf "%q" "$@")" else - exec /usr/bin/nsenter -t "$SYSTEMD_PID" -a \ + exec /usr/bin/nsenter -t "$SYSTEMD_PID" -m -p \ /bin/login -p -f "$SUDO_USER" \ $([ -f "$USER_HOME/.systemd-env" ] && /bin/cat "$USER_HOME/.systemd-env" | xargs printf ' %q') fi