Running meshtasticd on WSL
Overview
This guide will walk you through how to run meshtasticd under WSL, the Windows Subsystem for Linux.
Requirements
To run meshtasticd on Windows via the Windows Subsytem Layer (WSL), your computer must have the following satisfied:
- Windows 10 (64-bit), version 1809 or newer
- A WSL Linux distribution with a kernel version greater than 5.10.60.1.
- A WSL Linux distrubiton under WSL 2
- USBIP Device Host usbipd-win version 4.0.0 or newer installed
- (optional) wsl-usb-manager downloaded
This guide was written using Ubuntu on WSL in mind. Minor adjustments to the commands excecuted within Linux may be needed depending on your distro.
Verifying pre-requisites
- Verify your WSL Linux distirbution is greater than 5.10.60.1.
- Do this by executing
uname -r
in the WSL terminal. - It may be necessary to update WSL by running
wsl --update
in an elevated command prompt or PowerShell window.
- Do this by executing
- Verify your WSL Linux installation is a WSL2 installation.
- Do this by executing
wsl --list --verbose
- Do this by executing
- Ensure USBIP-Win is installed and configured.
- In a commmand prompt or PowerShell window, run
usbipd list
to enumerate your USB devices. - If you do not have
usbip-win
installed, you may install it via the .msi installer provided on their GitHub, or by runningwinget install usbipd
to install via the Windows Package Manager. You will need to relaunch your command prompt or PowerShell window, as this installation updates your PATH.
- In a commmand prompt or PowerShell window, run
Connecting your Meshtastic-compatible LoRA USB modem to WSL
...via command line / PowerShell
- Leave your LoRA USB modem disconnected for now. In an elevated command prompt or PowerShell terminal, enumerate the current visible devices with
usbipd list
. - Connect your USB modem, then run the same command. Make note of the new device that enumerated in that list, and the bus ID it is associated to, and the device ID belonging to it.
- Run
usbipd bind --busid=<BUSID>
, where<BUSID>
is the bus ID identified in Step 2 to bind the device. - Run
usbipd attach --wsl --busid=<BUSID>
, where<BUSID>
is the bus ID identified in Step 2 to attach the device to WSL2. - In your WSL terminal, run
lsusb
to see if your device, with its device ID you identified in Step 2. If you see your device enumerated here, then you have correctly configured usbipd for your LoRA modem.
While binding persists across reboots, attaching a device does not. You will have to re-attach your modem via usbipd every time you disconnect the device from your computer or reboot your host.
...via wsl-usb-manager
The wsl-usb-manager application makes it easy to bind and share USB devices over IP for those who are uncomfortable (or find inconvenient) using the command line. The steps to bind and attach the USB device over IP are the same as the CLI option above, except with a GUI.
Installing meshtasticd
in your WSL instance
Refer to Linux install instructions for your respective distro. In this example, we will be using Ubuntu.
After installing meshtasticd, run sudo meshtastic
. Verify it runs, the terminate the process for now.
Configuring your meshtastic node
You may configigure your Meshtastic node via the command-line interface, or by the daemon's web client.
Accessing the Meshtastic node via the CLI
- Run
ip a
in your WSL terminal to determine the IP address for the eth0 interface of your WSL instance. - Run
meshtastic --host <WSL_IP_ADDRESS>
to test a connection to your WSL container. - Issue configuration commands using the CLI as you would any other Meshtastic device.
Enabling and accessing the Meshtastic Web Client
- Edit the
config.yaml
to enable the web server by uncommenting the Port and RootPath entries. - Run
ip a
(or equivalent) in your WSL terminal to determine the IP address for the eth0 interface of your WSL instance. - Connect to
https://<WSL_IP_ADDRESS>:9443/
in your web browser. (You may have to accept self-signed certificates.) - Proceed with configuring your node as you would with any other Meshtastic node, such as setting the region, node name, etc.
Some notes
- As WSL does not have a
system
daemon, when you save your settings via Meshtastic CLI or the web client, you will have to restartmeshtasticd
in your WSL instance.
Appendix
Convert WSL1 to WSL2
In the case where you already have WSL1 installed, you will need to upgrade it to WSL2.
Running wsl --set-version <distro> 2
, where <distro>
is the name of the WSL installation from wsl --list --verbose
, may convert your WSL1 installtion to WSL2.
However, if you are unable to do so, it may mean that your WSL installation on Windows is much older and will require upgrading. Follow this guide from Microsoft to do so.