This script allows Linux distributions to run unabated in a Windows user session without an active Terminal. This is especially useful for running Klipper from a Windows OS.
-
Windows 10 (22H2 - 19045)
-
Windows Terminal 1.17.11461.0
-
Windows Subsystem for Linux (WSL) 2
-
Debian (Bookworm)
-
KIAUH*: Klipper (v0.11.0)
-
KIAUH: Moonraker (v0.8.0)
-
KIAUH: Mainsail (v2.6.2)
*Installed through Klipper Installation And Update Helper (KIAUH)
This process is intended to be peformed after installing Klipper, Moonraker, and Mainsail. However, Mookraker may need to be updated after this process. (See "Policykit Update" below)
Remember, to use Klipper in WSL2, you must enable systemd by adding the /etc/wsl.conf file to your Linux distribution with the following system declaration:
[boot]
systemd=true
This example Linux distribution does not need an Administration level account. Just right-click on the Windows CMD icon and select Terminal. Once the application opens, click on the downward caret and select your Linux instance. You will need both tabs open for the next set of instructions.
git clone https://github.com/The-Monkey-King/wsl2-systemd-alwayson-script.git
cd wsl2-systemd-alwayson-script/
bash wsl2-systemd-alwayson-script.sh
# Enter your password and wait until the script has finished
setx WSLENV BASH_ENV/u
setx BASH_ENV /etc/bash.bashrc
- Close the Linux tab
- In the Terminal tab, run the command:
wslconfig /t <Linux_instance>
- Restart Linux by opening it in a new tab
- In the Linux tab, run the command:
systemctl
If you see a list of units and no errors, the script worked. You can test this further by opening a web browser to your Mainsail page (usually localhost / 127.0.0.1). Close the Terminal application. Klipper should still work as expected.
If you encounter this error in the Mainsail web interface, after restarting the Linux instance, you will need to set Moonraker's PolicyKit Rules for granting access
In the Linux tab, run the command:
~/moonraker/scripts/set-policykit-rules.sh
Restart the Linux instance.
This script is Open Source and free to implement under GNU General Public License v3.0. I am not responsible for broken installations, tears, or loss of social status when using this script.