ESP32 Uploads no longer possible

I’ve been using PlatformIO for VS Code successfully for several months, and suddenly I am no longer able to upload programs to any of my Espressif boards. The program will compile, but then when I try to upload it, it times out and throws error 2 “timed out waiting for packet header”. I am using a Pixelbook with Debian 10 installed. Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 5.4.64-08224-g7c5e01902547
Architecture: x86-64
I have tried backdating the OS to Debian 9, removing, and reinstalling VS Code and PlatformIO, and even powerwashing the Pixelbook and staring over completely. None of these have had any effect at all. I’m able to communicate with all of the ESP32 boards I have using Beagle Terminal through ChromeOS, so I know that my cables and USB ports are functioning correctly. I’ve added my Linux username to the dialout group, and have also changed the permissions for the /dev/ttyUSB0 port to include read and write access, but this has had no effect. I’m at a loss for what has happened, mostly because everything was working fine, and then just literally stopped being able to upload the next day. I’m using two different NodeMCU-32s boards as well as a Heltec WIFI kit 32 board, and they are all behaving the same way.

Here is the PlatformIO Project Configuration File

;

; Build options: build flags, source filter

; Upload options: custom upload port, speed and extra flags

; Library options: dependencies, extra library storages

; Advanced options: extra scripting

;

; Please visit documentation for the other options and examples


[env:nodemcu-32s]

platform = espressif32

board = nodemcu-32s

framework = arduino

monitor_speed = 115200

And here is a screen capture from the terminal when trying to upload:

> Executing task: platformio run --target upload <

Processing nodemcu-32s (platform: espressif32; board: nodemcu-32s; framework: arduino)
-----------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/nodemcu-32s.html
PLATFORM: Espressif 32 (2.0.0) > NodeMCU-32S
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 3.10004.200129 (1.0.4) 
 - tool-esptoolpy 1.20600.0 (2.6.0) 
 - tool-mkspiffs 2.230.0 (2.30) 
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 26 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Retrieving maximum program size .pio/build/nodemcu-32s/firmware.elf
Checking size .pio/build/nodemcu-32s/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.7% (used 15436 bytes from 327680 bytes)
Flash: [==        ]  16.7% (used 218261 bytes from 1310720 bytes)
Configuring upload protocol...
AVAILABLE: esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: /dev/ttyUSB0
Uploading .pio/build/nodemcu-32s/firmware.bin
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
*** [upload] Error 2
======================================= [FAILED] Took 29.22 seconds =======================================
The terminal process "platformio 'run', '--target', 'upload'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Use the FLASH and RESET buttons to get the ESP32 into bootloader mode (hold down FLASH, press RESET, release FLASH). See here if your board doesn’t have these two buttons. Does uploading work now?

Does uploading work more reliably when doing upload_speed = 115200 in the terminal?

If none of those work you will want to open miniterm.py at the serial device at 115200 baud and put the ESP32 into bootloader mode. Does text appear? If there’s none, the serial drivers are broken.

Thanks for your reply maxgerhardt. Entering into flash mode had no effect on the upload, and initially changing the upload speed to 115200 had no effect either. I installed minicom, and checked for any serial communication on /dev/ttyUSB0 port, and found none. The port couldn’t even be accessed from the linux terminal, although it was working fine when using a chromeOS based terminal. I ended up getting it working again by wiping my linux install, and reinstalling a fresh image, then resetting permissions to include dialout group access, and rebooting the system a few times. For whatever reason that has restored access to the /dev/ttyUSB port and PlatformIO is again able to upload code to the ESP32 boards. I’m a bit bothered that I still don’t really know what went wrong in the first place, but hopefully this has fixed the problem permanently. Again, thank you for your quick reply and your assistance!