Skip to main content
Skip table of contents

Using LabJack Hardware in WSL

Windows Subsystem for Linux (WSL) is a tool from Microsoft that allows developers to run Linux from a Windows computer. More information can be found in the WSL documentation. This application note outlines some steps to use LabJack devices in WSL.

Run a LabJack software installer under WSL.

Download and install the most appropriate LabJack software installer for your WSL system. The installation should be done from WSL. See the Linux installation instructions for your LabJack device:

Connect the LabJack to your computer via USB.

Connect the LabJack USB to WSL.

See the instructions in the following WSL Connect USB devices article.

Ensure udev rules are being loaded or run your program with sudo.

After connecting the LabJack USB to WSL, you still need to ensure that you have proper permissions to use the USB connection in WSL. An easy way to ensure that your program can access the LabJack USB connection is to run your program with root-level permissions, such as by running your program with sudo. Carelessly running programs with root permissions can create security vulnerabilities, so we would recommend avoiding this option whenever possible.

To allow non-root access to your LabJack USB connection, our software installers add a set of udev rules to your system. If our udev rules are loaded, root permissions should not be necessary to access the USB connection. Our testing has found that WSL 1 does not load udev rules by default, which causes issues with the LabJack USB connection. The following process can help ensure that udev rules are being loaded correctly.

First, try starting the udev service. For example:

service udev start

If this runs without error, you should already be able to access the LabJack USB connection. However, we ran into the following error when trying to start udev in WSL 1:

udev does not support containers, not started

Commenting out the following lines in /etc/init.d/udev got us past the error message and allowed us to start our udev rules, which might suggest that the error is due to a simple lack of formal support for udev under WSL. You typically should not modify /etc/init.d/udev, so do so at your own risk:

Lines to comment out in the udev init script:

#if ! ps --no-headers --format args ax | egrep -q '^\['; then # log_warning_msg "udev does not support containers, not started" # exit 0 #fi

If udev was already started but for some reason our udev rules have not been applied, you could try one of the following sets of commands to reload the rules (which may require the use of sudo) :

service udev restart

Or

udevadm control --reload-rules
udevadm trigger

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.