Can't upload a sketch from the Arduino IDE running on Raspberry Pi4 to ESP32

I would really appreciate some help being able to upload a sketch from the Arduino IDE running on Raspberry Pi 4 to ESP32 board.

I can upload the same sketch from the Arduino IDE running on Windows, but can't seem to get it to work from the RPi 4.

It's not a problem with the sketch as I'm using this as a test sketch (which compiles fine):

void setup() {
// put your setup code here, to run once:

}

void loop() {
// put your main code here, to run repeatedly:

}

I've tested with three ESP32 boards and various USB cables.

I've tried holding down the flash button on the ESP32, but that doesn't help (and is not needed when uploading the sketch from the Arduino IDE running on Windows).

This is the error message that is generated:

Arduino: 1.8.10 (Linux), Board: "DOIT ESP32 DEVKIT V1, 80MHz, 921600, None"

Sketch uses 193188 bytes (14%) of program storage space. Maximum is 1310720 bytes.
Global variables use 12680 bytes (3%) of dynamic memory, leaving 315000 bytes for local variables. Maximum is 327680 bytes.
esptool.py v2.6
Serial port /dev/ttyUSB0
Connecting......................................_____

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

Also, I tried connecting the RPi4 and the ESP32 board using a 2.0 port on the Pi and 3.0 port on the Pi.

I also tried plugging in a regular thumb drive to the RPi USB port, just to ensure it was not a hardware problem with the RPI4 and its USB ports - this worked fine so that is not the problem.

Any help or suggestions would be appreciated.

Thanks in advance.

RobLatour's bug report:

I don't know whether it is of any help but I have had no trouble uploading code to an ESP-32 CAM using Linux Mint with IDE 1.8.6 on this laptop.

...R

I should also mention I am using the Ardunio IDE 1.8.10 on latest version of Raspbian from https://www.raspberrypi.org/downloads/