Skip to content

Instantly share code, notes, and snippets.

@lopugit
Created January 29, 2021 04:28
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save lopugit/dcff73fe104e5897599972bfcfd8aedd to your computer and use it in GitHub Desktop.
run root command in wsl without starting user session, for recovering broke wsl init configs
If you only need to remove the script, try from cmd wsl.exe -u root -e rm /etc/profile.d/00-wsl2.systemd.sh.
If you have bad startup config in /etc/wsl.conf, perhaps you can run wsl -u root -e mv /etc/wsl.conf /etc/wsl.conf.bak.
EDIT: you know what -u root does, don't you ;) As for -e, it means do not invoke the default login shell and run the rm or mv binaries directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment