On Fri, Apr 16, 2021 at 5:09 AM John Paul Adrian Glaubitz <adrian.glaubitz@suse.com> wrote:
On 4/16/21 10:49 AM, John Paul Adrian Glaubitz wrote:
> I'm regularly running into the issue that DNS lookups fail on the first attempt
> while they succeed on the second or third attempt. Multiple Debian machines on
> the same network don't have any DNS problems and lookups always succeed on the
> first attempt.

Another instance of that issue:

glaubitz@suse-laptop:~> ssh pettersson.debian.org
ssh: Could not resolve hostname pettersson.debian.org: Name or service not known
glaubitz@suse-laptop:~> ssh pettersson.debian.org
Linux pettersson 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64

(...)

DNS lookup for SSH fails for the first login attempt, succeeds on the second attempt.

Adrian

Are you sure your DNS servers have reliable behaviour ?  that all accept TCP and UDP DNS queries.. what are you seeing might be the case of unreliability being shown immediately rather than hang around and timeout, is IPv6 enabled or disabled?