GithubHelp home page GithubHelp logo

cawa0505 / chsh-variant-wsl2-systemd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from diddlesnaps/chsh-variant-wsl2-systemd

0.0 0.0 0.0 14 KB

The 'change the user shell' variant of the systemd hack for WSL2

License: MIT License

Shell 100.00%

chsh-variant-wsl2-systemd's Introduction

WSL2 Systemd by changing the user's shell

About

This repository includes the files to set-up WSL2 distro to run systemd.

What does it do?

  • Disables a few Systemd units that aren't required for WSL2 or might cause issues
  • Creates a minimal script called /etc/profile.d/00-wsl2-systemd.sh that sets up some WSL2-specific environment that cannot be carried into the Systemd namespace easily. At the moment this is only the PATH variable
  • Creates a file called /usr/sbin/start-systemd-namespace that is used to start Systemd inside a PID namespace so that Systemd is PID 1
  • Creates a file called /usr/bin/namespaced-shell-wrapper.sh that will call start-systemd-namespace to enter the systemd namespace. It will then execute your shell
  • Symlinks namespaced-shell-wrapper.sh alongside your current user shell's executable. For example, if you are running BASH with executable /bin/bash then it will create the symlink as /bin/namespaced-bash
  • Modifies /etc/pam.d/runuser to allow the usage of a user-specific environment override file that is enforced by the PAM subsystem. The file, $HOME/.pam_environment is written by /usr/bin/namespaced-shell-wrapper.sh and contains variables that should not change often
  • Finally, changes your user's configured shell with chsh to point to the symlink to the shell wrapper, e.g. /bin/namespaced-bash.

Installing

  1. Clone the repository, or download the three scripts via a browser
  2. Execute either install-all.sh or install-systemd.sh.
    • The install-all.sh script will execute both install-systemd.sh and install-gui-support.sh to perform a complete install
    • install-systemd.sh will install just enough to get systemd operational, but will not enable GUI support via X11
    • If you install the GUI support by running install-all.sh (or install-gui-support.sh after running install-systemd.sh) it is advisable to ensure that you have an X11 server on your Windows system that is listening for connections while using your WSL2 distro, else you might find some Linux commands stall or fail
  3. Restart your WSL2 session

Alternatives

chsh-variant-wsl2-systemd's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.