circuitpython: CIRCUITPY doesn't mount properly when there are multiples of a device type on USB macOS 13.1
CircuitPython version
CircuitPython version doesn't seem to matter.
Mostly I've tested with 8.0.0-beta.6 and 7.3.3,
but I've added devices with versions all the way back to 5.3.1.
Code/REPL
No code needed.
Behavior
I’ve tested Pico W, QT Py ESP32-S2, Feather M4, and RP2040. In each case, the first one or two will mount, then subsequent similar devices won’t mount at all or won’t mount properly: They don’t show up in Finder. They may not show up in ls -l /Volumes
, and if they do, they may not show up properly.
Here’s a case where (4) Pico W were connected to USB after flash-nuking them and installing 8.0.0-beta.6:
drwx------ 1 a staff 16384 Dec 31 1969 CP198PCOW
d--x--x--x 2 root wheel 64 Jan 2 14:11 CP201PICOW
(the 1st is good, the 2nd is bad, the other two are missing - but that’s the general pattern: when a device doesn’t mount correctly, it’s either not in the listing or has the “bad” file characteristics)
This seems to be largely a macOS 13.1 issue, but I’ve “fixed” it in two different ways that change the flash image:
-
I had 4 new QT Py ESP32S2 with 8.0.0-beta.6 installed. Thinking it might be a beta issue, I reverted them to 7.3.3 and they mounted, and continued to mount after re-updating to 8.0.0-beta.6. And they continued to mount after a
storage.erase_filesystem()
. In one case so far, this method didn’t work, but the next method did: -
In two cases (QT Py ESP32-S2), I extended the filesystem using
storage.erase_filesystem(extended=True)
, and these two devices have mounted every time since, regardless of other similar devices already mounted or connected on USB. Block size changes in this case from 512 to 1024 according toos.statvfs("/")
, but there doesn’t seem to be a correlation to block size, or to FAT12 vs. FAT16.
I’m at a loss with Raspberry Pi Pico W, since they only run 8.0.0-beta.x and have no capacity to extend filesystem. I’ve successfully mounted the same (4) Pico W on a Raspberry Pi 4 simultaneously (though couldn’t rename the drives).
Before macOS 13.1, this wasn’t an issue. Sometimes devices would unmount and stay unmounted after a hardfault or software reset, but a hard reset or power cycle almost always brought them back.
I’ve been testing on two different Macs, both Ventura 13.1, one was a relatively recent clean install. I’ve tried USB-A ports, USB-C ports, and various hubs, that doesn’t seem to make much difference. I can’t really correlate this to much other 13.1 + multiple similar devices (same CircuitPython port and usually same board).
Code on all of these boards runs, and serial console works. I tried a boot.py
that turned off HID and MIDI, but it made no difference.
This may seem to be a “doctor it hurts when I do this” issue (Dr.: “don’t do that”), but being able to have multiple devices active lets me run long-term tests to track down intermittent issues, and compare behavior on a number of fronts across ports and espressif board variants (e.g., S2 vs. S3). Almost from the start of CircuitPython, I’ve had multiple devices connected simultaneously (usually a dozen or more), often many of the same type.
Description
Data on degree of mounting success using the following tools:
Finder
# bottom line of whether a device is useful
ls -al /Volumes
# sometimes devices will show up here (sometimes incorrectly) but not in Finder
system_profiler -json SPUSBDataType
# useful to show if there’s a mount point
diskutil list
# devices seem to always show up correctly here
discotool
# device.volume doesn’t always correlate to either Finder or /Volumes
dmesg
# unfortunately cryptic and variable results
Additional information
Some previous discussion on Discord: https://discord.com/channels/327254708534116352/537365702651150357/1059572042552311949
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 25 (15 by maintainers)
@rsmets even if the volumes are not appearing, I think the serial will appear, and you can do
storage.erase_filesystem()
from there. You can also try on a host computer that is not a Mac.Closing, fixed by
storage.erase_filesystem()
with uniquevolume_uuid
. See #7410.reading the source, it looks (previous to #7410 ) like the device’s RTC time when you
storage.erase_filesystem()
will influence the resulting VolID. For instance, at apparently 16 seconds after boot, I ran erase_filesystem and got 5021-0008 instead of -0000. But when the device is blank (for instance, because it was nuked) the amount of time until it reaches the filesystem creation step will I guess be consistently under 2 seconds, and if so it’ll be 5021-0000 consistently.I’ll try some USB flash drives, working on getting a few identical ones.
It doesn’t seem to be a FAT12 vs. FAT16 issue. Or a block size issue (same with 512 and 1024 boards). Using (4) Adafruit Feather RP2040, no other storage devices connected to the Mac (just the display), processed each as follows.
One at a time:
(OK)
(OK)
Disk Utility & Finder: 7.3MB FAT16 (OK)
Plug in each board (edit: directly into a USB-C socket w/o external hub), leaving 5-10 seconds between. Only the first one mounts properly:
This was on an M1 Mac, which is relatively new and was cleanly installed (no system detritus imported from prior Mac). The behavior is the same (only the first CircuitPython device mounts properly) on an Intel Mac.