Problem with OTA stalling after 25-40%

Computer: Linux (Kubuntu 18.4).
Board: Robotdyn D1-R2
Arduino IDE 1.8.15

Using OTA on a esp8266 board fails after twenty or thirty dots and gives an "ERROR: Uploading."

I am aware that two different esp8266 packages exist, one from github and one from the board manager. I tried both in new Arduino IDE installs, uninstalling and deleting the other one before I installed the one in a completely clean Arduino installation with no other libraries installed. So it probably is not a bug in the esp8266 libraries. I use the BasicOTA sketch from the Examples 'as is'.

My computer has no firewall installed.

I have three APs in my house. They happily serve a lot of hosts, including some ESP8266's with websites on them. There are no performance problems with those websites. However, the OTA only starts when I use the nearest AP (three metres from the place where I try to perform the OTA) and as I said, the update peters out after forty or fifty dots. The APs further away do not even start.

The PC has a normal wired connection.

I have been wrestling with this problem for three years now, and this time I want to get to the core of it.

i have had similar problems with these

i purchased a bulk lot of them , the antenna design is defective and is quite directional.
my solution is to buy wemos d1 mini

Thank you. I don't think it is the antenne, because (a) the boards that are in use have webservers installed and they work satisfactory. And (b) every so often, after I tried enough combinations of different versions of arduino IDE, github and board managers, it suddenly works... for a few months.

But this time, I will not go through that hell again and stick to the newest libraries and find out what really is the problem.

(In any case, I attached an external antenna to the board, and it made no difference at all)

How is your Wifi configured? You say you have 3 APs are these setup as a roaming network or as an extended network? Are all these APs on different channels? Do any of the APs offer 5GHz as well as 2.4GHz?

Does turning off the remote 2 have any effect (you said it always uses the closest one)? If you cannot turn off the remote ones, can you install a forth nearby but use a different SSID so that you can be certain it only uses the one AP?

Do you have any other equipment on the 2,4GHz frequency that does not use Wifi? Could you neighbours have anything on the 2.4GHz frequency that might limit things (Wifi or otherwise)?

None of this may make any difference, but it is worth checking as it could be difficult to deermine otherwise.