Problem flashing esp32 for wifi

I am following the linux instructions found here to flash my R4 Wifi to support wifi (why isn't wifi flashed/enabled out of the box?). But when I run the ./update.sh and select the R4 port, I get the following:

$ ./update.sh 
Start flashing firmware
[2023-07-26T00:30:16Z INFO ] ๐Ÿš€ A new version of espflash is available: v2.0.1
[2023-07-26T00:30:16Z INFO ] Detected 3 serial ports
[2023-07-26T00:30:16Z INFO ] Ports which match a known common dev board are highlighted
[2023-07-26T00:30:16Z INFO ] Please select a port
โœ” Remember this serial port for future use? ยท no
[2023-07-26T00:30:35Z INFO ] Serial port: '/dev/ttyACM0'
[2023-07-26T00:30:35Z INFO ] Connecting...
[2023-07-26T00:30:35Z INFO ] Unable to connect, retrying with extra delay...
[2023-07-26T00:30:35Z INFO ] Unable to connect, retrying with default delay...
[2023-07-26T00:30:35Z INFO ] Unable to connect, retrying with extra delay...
[2023-07-26T00:30:35Z INFO ] Unable to connect, retrying with default delay...
[2023-07-26T00:30:35Z INFO ] Unable to connect, retrying with extra delay...
[2023-07-26T00:30:35Z INFO ] Unable to connect, retrying with default delay...
[2023-07-26T00:30:35Z INFO ] Unable to connect, retrying with extra delay...
Error: espflash::connection_failed

  ร— Error while connecting to device
  โ•ฐโ”€โ–ถ Failed to connect to the device
  help: Ensure that the device is connected and the reset and boot pins are not being held down

I have verified that it is the correct R4 port via the Arduino IDE, and I can successfully upload a sketch to the R4.

Is there something else I need to do to get this to work?

thanks,
-Mark

Well, I stand corrected. My R4 wifi does support wifi out of the box, I uploaded the WiFiWebClient example and it works. But there is still the problem with attempting to flash/update the esp32 with a new firmware as described above.

-Mark

Hi Mark, do you have a serial monitor open by any chance? Can you retry after closing all the IDE instances?

I tried to run the ./update.sh with no IDE open. Same result as above.

For reference, these are the choices I am shown for the usb ports. I don't know if the value for ttyACM0 is expected, but I know that is the Uno R4 port.

$ ./update.sh 
Start flashing firmware
[2023-07-26T18:23:01Z INFO ] ๐Ÿš€ A new version of espflash is available: v2.0.1
[2023-07-26T18:23:01Z INFO ] Detected 3 serial ports
[2023-07-26T18:23:01Z INFO ] Ports which match a known common dev board are highlighted
[2023-07-26T18:23:01Z INFO ] Please select a port
โฏ /dev/ttyACM0 - Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx Series USB xHCI Controller
  /dev/ttyS4
  /dev/ttyS0

-Mark

@mwomack what is the output of lsusb at this point of the script?

the device should be detected as:

Espressif USB JTAG/serial debug unit