Skip to content

Mass storage upload fails on linux64 when no 32-bit loader is installed #42

@matthijskooijman

Description

@matthijskooijman

On a 64-bit Ubuntu Disco system, mass-storage uploads fail. In the IDE window, I get:

java.io.IOException: Cannot run program "/home/matthijs/.arduino15/packages/STM32/tools/STM32Tools/1.3.1/tools/linux/massStorageCopy": error=2, No such file or directory

Closer inspection shows that the file referenced actually does exist, but is a 32-bit binary. Executing it fails with a ENOENT, which is expected (according to https://unix.stackexchange.com/a/13409/233460) when no 32-bit loader is installed.

Manually starting the binary also fails, and strace shows it is the actual execve systemcall that fails:

execve("/home/matthijs/.arduino15/packages/STM32/tools/STM32Tools/1.3.1/tools/linux/massStorageCopy", ["/home/matthijs/.arduino15/packages/STM32/tools/STM32Tools/1.3.1/tools/linux/massStorageCopy"], 0x7ffe812fecd8 /* 95 vars */) = -1 ENOENT (No such file or directory)

A linux64 version is included, which does run and work as expected (tested by editing platform.txt).

Looking at the platform.txt, at first glance it looks like there is a typo in the linux64 version: https://github.com/stm32duino/Arduino_Core_STM32/blob/6808f06a3c183f22784f0486a3034644535c5b2b/platform.txt#L160-L161

As you can see, both refer to the 32-bit version. However, on closer inspection, it turns out that the Arduino IDE does not actually distinguish between linux32 and linux64 currently, so to really fix this, I guess the IDE needs to be changed (I'll file a bug report for that as well).

As a workaround, you can enable execution of 32-bit binaries on a 64-bit Linux Debian-derived (e.g. Ubuntu) system by enabling multiarch and installing a 32-bit libc:

dpkg --add-architecture i386
apt-get update
apt-get install libc6:i386

With that, things work as expected again. But ideally, you would use the 64-bit version on a 64-bit system, if Arduino adds support for that.

To Reproduce

  1. Get a 64-bit system without 32-bit compatibility enabled (default on Ubuntu, it seems).
  2. Get any sketch, and select any STM32 board (e.g. Nucleo63 -> F401RE)
  3. Select upload method mass storage
  4. Press upload

Desktop (please complete the following information):

  • OS: Linux Ubuntu Disco
  • Arduino IDE version: Git master (a1448876a1115c9d3ee9e88f29a15bb081a27816), bit newer than 1.8.11
  • STM32 core version: 1.7.0
  • Upload method: Mass Storage

Board (please complete the following information):

  • Name: Nucleo F401RE

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions