user48730: I installed a fresh copy of Ubuntu 20.04, and Arduino IDE1.8.16. At the beginning adding user to dialout group enabled uploading sketch to Aruino AVR family, and ESP32, but still ESP8266 gives this error:
Sketch uses 260889 bytes (24%) of program storage space. Maximum is 1044464 bytes.
Global variables use 27980 bytes (34%) of dynamic memory, leaving 53940 bytes for local variables. Maximum is 81920 bytes.
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____
Traceback (most recent call last):
  File "/home/guy/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/upload.py", line 66, in <module>
    esptool.main(cmdline)
  File "/home/guy/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool/esptool.py", line 3552, in main
    esp.connect(args.before, args.connect_attempts)
  File "/home/guy/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool/esptool.py", line 529, in connect
    raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

So I tried to erase flash using esptool.py :
guy@desktop:~$ esptool --chip  auto --port /dev/ttyUSB0 erase_flash
esptool.py v2.8
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____

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

Since AVR's and ESP32 work properly using USB's and ACM's I can guess that is is not a problem with the ability to access serial comm.
What might it be ?

user70436: There is something wrong with some new kernels of Ubuntu 20.04 LTS, interfering with ESP8266 core uploading process
5.4.0-88-generic #99-Ubuntu SMP Thu Sep 23 17:29:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
I had the same issue and downgraded the kernel to
5.4.0-86-generic #97-Ubuntu SMP Fri Sep 17 19:19:40 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
solved the issue


The issue happens to ESP8266 core uploading process, with the following tested Ubuntu cores

linux-5.11.0-37-generic
linux-5.4.0-89-generic
linux-5.4.0-88-generic

and tested OK with

linux-5.11.0-38-generic
linux-5.11.0-36-generic
linux-5.8.0-48-generic
linux-5.4.0-90-generic
linux-5.4.0-86-generic


Temporarily fix
To temporarily fix the issue by using working kernel, e.g. linux-5.4.0-86-generic
A. Select from GNU GRUB boot menu

Advanced options for Ubuntu

Ubuntu, with Linux 5.4.0-86-generic


If you don't have that kernel, install by


sudo apt install linux-image-5.4.0-86-generic


Reboot and select 5.4.0-86-generic from GNU GRUB boot menu



To save the selected GRUB settings
More info GRUB Simple-configuration

Edit /etc/default/grub by

$ sudo gedit /etc/default/grub


Add to the file

 GRUB_DEFAULT=saved
 GRUB_SAVEDEFAULT=true


Activate the change so that last selected value is used for the next boot.

$ sudo update-grub

Update
Just testing OK with latest kernel

linux-5.11.0-38-generic
linux-5.4.0-90-generic

It seems recent kernel release has fixed the issue

48730: <p>I installed a fresh copy of Ubuntu 20.04, and Arduino IDE1.8.16. At the beginning adding user to <code>dialout</code> group enabled uploading sketch to Aruino AVR family, and ESP32, but still ESP8266 gives this error:</p>
<pre><code>Sketch uses 260889 bytes (24%) of program storage space. Maximum is 1044464 bytes.
Global variables use 27980 bytes (34%) of dynamic memory, leaving 53940 bytes for local variables. Maximum is 81920 bytes.
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____
Traceback (most recent call last):
  File &quot;/home/guy/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/upload.py&quot;, line 66, in &lt;module&gt;
    esptool.main(cmdline)
  File &quot;/home/guy/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool/esptool.py&quot;, line 3552, in main
    esp.connect(args.before, args.connect_attempts)
  File &quot;/home/guy/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool/esptool.py&quot;, line 529, in connect
    raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header
</code></pre>
<p>So I tried to erase flash using <code>esptool.py</code> :</p>
<pre><code>guy@desktop:~$ esptool --chip  auto --port /dev/ttyUSB0 erase_flash
esptool.py v2.8
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to Espressif device: Timed out waiting for packet header
</code></pre>
<p>Since AVR's and ESP32 work properly using USB's and ACM's I can guess that is is not a problem with the ability to access serial comm.</p>
<p>What might it be ?</p>
 70436: <p>There is something wrong with some new kernels of Ubuntu 20.04 LTS, interfering with ESP8266 core uploading process</p>
<p><code>5.4.0-88-generic #99-Ubuntu SMP Thu Sep 23 17:29:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux</code></p>
<p>I had the same issue and downgraded the kernel to</p>
<p><code>5.4.0-86-generic #97-Ubuntu SMP Fri Sep 17 19:19:40 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux</code></p>
<p>solved the issue</p>
<hr />
<hr />
<p>The issue happens to ESP8266 core uploading process, with the following tested Ubuntu cores</p>
<ul>
<li><code>linux-5.11.0-37-generic</code></li>
<li><code>linux-5.4.0-89-generic</code></li>
<li><code>linux-5.4.0-88-generic</code></li>
</ul>
<p>and tested OK with</p>
<ul>
<li><code>linux-5.11.0-38-generic</code></li>
<li><code>linux-5.11.0-36-generic</code></li>
<li><code>linux-5.8.0-48-generic</code></li>
<li><code>linux-5.4.0-90-generic</code></li>
<li><code>linux-5.4.0-86-generic</code></li>
</ul>
<hr />
<h3>Temporarily fix</h3>
<p>To temporarily fix the issue by using working kernel, e.g. <code>linux-5.4.0-86-generic</code></p>
<p>A. Select from GNU GRUB boot menu</p>
<ul>
<li><p>Advanced options for Ubuntu</p>
<ul>
<li>Ubuntu, with Linux 5.4.0-86-generic</li>
</ul>
</li>
<li><p>If you don't have that kernel, install by</p>
</li>
</ul>
<pre><code>sudo apt install linux-image-5.4.0-86-generic
</code></pre>
<ul>
<li>Reboot and select <code>5.4.0-86-generic</code> from GNU GRUB boot menu</li>
</ul>
<hr />
<hr />
<h3>To save the selected GRUB settings</h3>
<p>More info <a href="https://www.gnu.org/software/grub/manual/grub/grub.html#Simple-configuration" rel="nofollow noreferrer"><strong>GRUB Simple-configuration</strong></a></p>
<ol>
<li>Edit <code>/etc/default/grub</code> by</li>
</ol>
<pre><code>$ sudo gedit /etc/default/grub
</code></pre>
<ol start="2">
<li>Add to the file</li>
</ol>
<pre><code> GRUB_DEFAULT=saved
 GRUB_SAVEDEFAULT=true
</code></pre>
<ol start="3">
<li>Activate the change so that last selected value is used for the next boot.</li>
</ol>
<pre><code>$ sudo update-grub
</code></pre>
<h3>Update</h3>
<p>Just testing OK with latest kernel</p>
<ul>
<li><code>linux-5.11.0-38-generic</code></li>
<li><code>linux-5.4.0-90-generic</code></li>
</ul>
<p>It seems recent kernel release has fixed the issue</p>
