comprehensive-rust icon indicating copy to clipboard operation
comprehensive-rust copied to clipboard

Instructions for bare metal part regarding udev rules didn't work

Open Mandragorian opened this issue 1 year ago • 6 comments

When I tried to run the cargo embed command to flash the microbit:v2 controller, it failed with a permission error regarding device /dev/hidraw0. Unfortunately I do not have the exact error message since I accidentally closed the terminal window.

It turned out that I had to change the udev rules to make it work.

Instead the contents that made it work are:

SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", ATTR{idProduct}=="0204", MODE:="666"

taken from: https://docs.rust-embedded.org/discovery/microbit/03-setup/linux.html#udev-rules

I think this is because the plugdev group is ubuntu specific and according to the Arch Wiki:

Ubuntu's approach is to create a plugdev group that devices are added to, but this practice is not only discouraged by the systemd developers, [[2]](https://bugzilla.redhat.com/show_bug.cgi?id=815093) but considered a bug when shipped in udev rules on Arch

(It could be also that I forgot to reload the rules and/or re-plug in the controller, but I think I did that. At any case I open this issue in case others have the same problem)

Mandragorian avatar May 03 '23 23:05 Mandragorian

Thanks @Mandragorian, it sounds like we should do one or more of the following

  1. Add a note to the setup instructions telling people that they're specifically for Debian/Ubuntu/gLinux or
  2. Add a note about how to do things on Arch
  3. Link to the rust-embedded book you link to

I think I would prefer 3 since it's more future proof.

mgeisler avatar May 04 '23 07:05 mgeisler

The instructions in the course already do say that they are specific to gLinux and Debian. The instructions linked above give all users read-write access to the device, which is probably not what you want.

I guess we could give instructions per distribution, but that might get rather unwieldy.

qwandor avatar May 04 '23 16:05 qwandor

I guess we could give instructions per distribution, but that might get rather unwieldy.

Yes, we should avoid that — it's not our area of expertise. So could we take out the instructions we have right now and instead point people to a reliable third-party source?

mgeisler avatar May 08 '23 08:05 mgeisler

For the common case of people at Google running gLinux, or people externally using Debian or Ubuntu, the instructions we have are correct and the instructions linked above are less secure: they give all users on the system access to the device, rather than just those who should have access to external devices. I think we should keep the instructions we have, rather than making people take more steps to get the correct setup.

We could also add a link somewhere else for other distributions, but they still need to figure out how to install the other required packages (we only give instructions using apt for Debian based distributions). I'm inclined to just say if you don't use our supported distributions then you're on your own.

qwandor avatar May 09 '23 10:05 qwandor

I'm inclined to just say if you don't use our supported distributions then you're on your own.

We can do better by linking to the generic instructions on the rust-embedded website. That would basically have saved @Mandragorian from having to find this by himself.

mgeisler avatar May 12 '23 12:05 mgeisler

I created a PR in the rust-embedded repository to make the rules better there.

mgeisler avatar May 12 '23 12:05 mgeisler