-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Description
I had issues setting up the udev rules and compiling/flashing/running a sample Rust embedded program on my WSL2 setup and I figured that filing an issue would help shed some light on the things I went through. The solution I found is at the bottom of this message.
Technical information
OS: Windows 11
WSL: WSL2
Board: BBC Microbit v2
Steps I followed
Here are the steps I went through initially to set up a development environment on WSL2:
-
I followed the instructions in the MB2 Discovery book under Chapter 3 and the Linux section to get the initial libraries set up and copy the rules file into
/etc/udev/rules.d. The rules file was called69-microbit.rules. -
When I followed the steps under Verify the Installation, I got an error on using the
probe-rs listcommand that said it could not find any debug probes. (No debug probes were found) -
I followed the instructions from this Microsoft page to install
usbipdand attach the MB2 to my computer using a Powershell terminal started as admin. This fixed theprobe-rs listissue from Step 2, but not thecargo embedissue in Step 4. -
I cloned the blinky-rs repository and tried to build/run the code using the command
cargo embed --release
but ran into a new error about a missing probe-rs rule (the same issue happened with cargo embed --target thumbv7em-none-eabihf):
WARN probe_rs::probe::list::linux: Make sure you have reloaded udev rules after setting everything up
WARN probe_rs::probe::list::linux: Read more under https://probe.rs/docs/getting-started/probe-setup/
WARN probe_rs::probe::list::linux: There seems no probe-rs rule to be installed.
WARN probe_rs::probe::list::linux: Read more under https://probe.rs/docs/getting-started/probe-setup/
WARN probe_rs::probe::list::linux: If you manage your rules differently, put an empty rule file with 'probe-rs' in the name in /etc/udev/rules.d.
Error Failed to open the debug probe.
Caused by:
0: The debug probe could not be created.
1: The selected USB device could not be opened.
This was despite the fact I copied the rules file from Step 1 into the correct directory (/etc/udev/rules.d).
I tried running the commands
sudo udevadm control --reload
sudo udevadm trigger
adduser <my username> plugdev (It turns out I am already in plugdev)
and neither command fixed the issue.
- With some help, I reinstalled Rust and the necessary libraries as
/rootand managed to fix the issue from Step 4, but I learned that installing as/rootcould break things, so I decided to remove my Rust setup and reinstall without/rootpermissions. However, I still ran into the issue described in Step 4 until I tried the solution below.
Solution
I ultimately solved the error from Step 4 by copying the rules file from this probe.rs page and placing it inside the /etc/udev/rules.d folder. The file is called 69-probe-rs.rules.
Suggestions
- For WSL2 users, it would be nice to mention that the rules file from this probe.rs page may be needed to fix issues with compiling/flashing/running Rust embedded programs on an MB2 board.