mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-12-03 19:50:19 +07:00
[GH-ISSUE #2575] Ubuntu 24.04: DNS not configured on amn0 after connect (race condition with systemd-resolved restart) #1166
Open
opened 2026-10-14 03:35:34 +07:00 by bsakaguchi
·
14 comments
No Branch/Tag specified
dev
feat/pages-ui-tests
feat/otp-free-users-login
fix/refresh-external-ip-and-proxy-config-in-start-sh
fix/ios-keep-nav-bar-below-status-bar-and-lift-rename-sheet-over-keyboard
fix/ios-stop-hev-before-restarting-xray-tunnel
feat/whatsapp-proxy
fix/keep-socks-and-pfx-secrets-out-of-command-lines
fix/pass-the-tunnel-config-over-a-named-pipe
feat/test-xray-pages-ui
fix/expect-server-xray-v26.10.31
fix/align-xray-settings-with-core-defaults-and-add-contract-tests
feat/xtun
feat/separated-ui-models-and-controllers-tests
fix/keep-default-godebug-when-disabling-async-preemption
feat/otp-login
feat/android-tests
fix/server-removal-navigation-and-sheet-reopen
feat/add-deep-link
feat_copy_docker_configs
fix/gateway-requests-on-slow-or-blocked-dns
fix/bypass-proxy
feat/api-tests
fix/serialize-log-record-writes-and-pin-log-date-format-locale
fix/libagw-review-fixes
fix/ios-xray-ipv6-leak
fix/macos-xray-ipv6-leak
feat/add-support-include-split-tunnel
fix/win-xray-app-split-tunneling
fix/bug-when-saving-after-canceling
fix/xray-reconnect-crash
fix/share-empty-config-on-ssh-timeout
fix/ssh-credentials-input
fix/updater-verify-signature
fix/async-ssh-threading
fix/xray-check-inet-and-liveness-monitor
fix/selfhosted-server-installations
feat/add-support-ikev2-macos
fix/icons-different-color-themes
feat/add_support_arm_windows
feat/fixed-push-notifications-on-VPN-connect-disconnect-2
feat/implement-QR-code-generation-and-scanning
feat/file-password-protection
feat/add-support-split-tunnel-macos
feat/tests
fix/android-register-unacknowledged-purchase
fix/share_on_linux
mirroring-to-outside
feat/self-diagnostics-log
feat/amnezia-free-vless-switch
fix/conan_build_android_on_win
fix/linux-reconnect-dns-reliability
fix/windows-connection-stability
fix/linux-reconnect-refactoring
fix/ios-groupidentifier-order
feat/xray-subscription-link
fix/minor-fixes
fix/xray-config-inplace-edit
feat/amnezia-sdk-typed-api
feat/amnezia-sdk-integration
feat/force-update-native
refactor/marketplace-update-popup
feat/force-update
fix/valnurability_dev
chore-xcode-version
fix/empty-i1-i5
build_qt_6_10_1
master
feat/protocol-selection
fix/openvpn_install
feat/locations_change
feat/locations_change_rework
feature/local-proxy-integration
fix/filepicker_atv
fix_valnurability
fix/macos-ne-codesign-4.8.19.0
temp-branch-for-testing
fix/rebased_4_8_19_linux_fix_error
feat/proxy-storage-cache
fix/zeroed-params
fix/killswitch-blocknets-linux
update/translation_RU
fix/self_hosted_reinstall_error
feat/selfhosted-dns
fix/agp_version_up
feat/switch_to_alive_protocol
feat/support_multipeer
server_scripts_update
fix/extended-vless-configuration
chore/apple-ci-cd-macos-versions
feat/add-telemt
fix/android_keystore_read_error
feat/add-mtproxy
chore/bump-qt-version
fix/make_dbus_async
feature/dns
rebase/apple-tv-target-on-conan
fix/outbound_freedom_xray_with_dns_fix
feat/apk_support
feat/fallback-proxy
feat/apple-tv-target
fix/dns_reconnection_issue
feat/fixed-push-notifications-on-VPN-connect-disconnect
fix/linux-firewall
docker-regional-locks
appstore-review-popup
feat/storekit2
fix/uninstall-split-tunnelling-driver
revert-2376-chore/license-file
support_16kb_android
bump_version
feat_add_review_android
bugfix/translation-absence-on-subscription-key-page
feat/location-separation-by-region
bugfix/text-moving-when-resing-window
fix_backup
feature/add-purchase-android
bugfix/moved-text-while-resizing-window
bugfix/incorrect-killswitch-restore-from-backup
fix/backup-exclude-secondary-api-configs
feat/proxy-fields-for-dev-console
bugfix/ovpn-ios-fix
bugfix/linux-bundle-libraries
fix/xray-app-split-win
fix/upload-to-s3
chore/add-release-date-upload
feat_add_webview_support
feature/configuration-transfer-through-qr
feat/bot-key-unlink-device
fix/ad-link-lang-support
fix/qsecuresettings-with-android
feat/add-support-arm64-win
spanish-translations
fix/context-menu
feat/add-system-dns-support
fix/qt6-9-support
fix/qt6_9_support
bugfix/strict-killswitch-ui
android-7
chore/minor-bugfixes
feature/awg-net-fix-macos-wakeup
fixbug/ios18
bugfix/ios-ne-crash
fix/linux-tray-quit-button
cryptpad-support
bugfix/disable-linux-killswitch
fix/minor-ui-fixes
feature/setup-guid-tun2socks
feature/linux-ipsec
feature/ipsec-linux
refactoring/server-config-in-classes
feature/macos-ipsec
fix/ui-fixes-after-merge-with-d20ed4a
chore/focus_control_after_qt_6.9_migration
feature/integrate-xray-as-a-library
maxos-awg-fix
feature/add-new-awg-docker-image
chore/update-3rd-prebuild
feature/test-news
fix/api-conf-files
bugfix/split-tunneling-with-api-config
bugfix/ios-awg-new-fields
feature/special-handshake-2
feat/xray-api-support
fix/desktop-entry
bugfix/shadowsocks-cipher-setting-not-changing
feature/update-tap
bugfix/openvpn_import_fix
feature/ability-to-change-port-after-installing-xray
bugfix/strict-mode-ovpn
bugfix/win-ipv6-ovpn
bugfix/subnet-adress-setting
exception-podman-docker
bugfix/fix-listviewtype-scrolling
bugfix/win-disabled-ipv6
bugfix/win-ipv6-disabled-ovpn
feature/killswitch-strict-mode
feature/awg-network-check
feature/empty-split-tunneling-list
feature/support-info
chore/update-go-version
checking-Linux-version
update_server_scripts
bugfix/button-selection-easy-setup-page
feature/old-api-proxy
patch/user-checking
fix/correcting-version
support-podman
support_podman
user-checking-patch
feature/check-docker-version
feature/allowed-dns-list
without_lsof
chore/error-body
Update-amneziavpn_ru_RU
shiroow-patch-8
shiroow-patch-7
shiroow-patch-6
shiroow-patch-5
shiroow-patch-4
shiroow-patch-3
shiroow-patch-2
shiroow-patch-1
check_sudo_permissions
feature/euphoria
add_next_octet_to_ip_settings
bugfix/mobile-controllers-init
euphoria
bugfix/android-crush
feature/macox-network-extension
bugfix/pre-release-hotfixes
bugfix/ipsec-pfs
chore/ios-site-links
checking_sudo_permissions
feature/android-tv
improve_navigation_cpp
bugfix/linux-firewall-install
fixbug/wireguard-handshake-time
ReadmeRu_full
feature/xray-user-management
feature/subscription-end-date
chore/clang-format
feature/ru-in-readme
chore/increased-api-timeout
chore/deploy-workflow
bugfix/services-list-scroll
wheel_group_suppor
chore/bump-xcode-version
fixbug/mac-network-extension
feature/android-gpb
feature/page-home-drawer-country-selection
checking-sudo-users
bugfix/service-info-from-response
fixbug/build-macos-ne-2
android-qt-6.7.3
fixbug/build-macos-ne
bugfix/wg-windows-log-folder
feature/psk-key-api-request
bugfix/user-management-qml-warnings
fix/macos-network-extension
fixbug/macos-NE-build
bugfix/fixed-isDevEnv-initialization
bugfix/revert-ios-ovpn
feature/tun2socksSrv
fix/disable_singleapp
feature/awg-wg-name-resolving
feature/disable-dhcp
bugfix/allowed-ips-old-configs
feature/goodbyedpi
feature/add-exception-log
refactoring/remove-ipv6-from-default-routes
refactoring/singleapplication-submodule
macos-dirty-build
test/gateway
Update-amneziavpn_fa_IR.ts
bugfix/ipsec-win
fix/xray-custom-port
improve-tab-navigation
test-win-11
feature/android-tv-remote-control-support
KsZnak-patch-1
feature/awg-wg-qr
bugfix/fix-loopback-splittunel
fix/setup_host_firewall
feature/android-xray
feature/openvpn-pass
feature/connection-string
fix/clickable-errors
bugfix/api_1100_fix
feature/graphview
testsvg
feature/update-win-awg
feature/open-as-amnezia
feature/update-mozilla-upstream
bugfix/qr-code-cutting
feature/native-wg-psk
test/awg-centos
bugfix/hide_error
feature/add-uninstaller-checkbox
bugfix/cancel-button-on-install-page
bugfix/anchors-page-home-warning
awg-udptlspipe
button-focus-fix
revert-677-fix/logger
bugfix/Revert_PR_596
bugfix/allowed-ips-api-configs
bugfix/on-escape-pressed
feature/auto-scroll-for-server-selection-list
fix/ui-fixes
translations/update_fa_IR.ts
feature/new-awg-docker-container
bugfix/awg_ipv6_fix
feature/tab-navigation
fix/username-no-autocapitalization
sure
refactoring/servers-model-cleanup
feature/wg-mtu-setup-ios
3rd_adaptation_to_diff_OS
sudo_not_found
test/docker-ce
bugfix/double_clear_server_from_amnezia
fix/android
client/3rd-prebuilt
revert-559-KsZnak-translation-ru-ex
KsZnak-translation-ru-ex
KsZnak-br1
KsZnak-text-change
feature/api-awg
feature/error-code-output
feature/win_x32_builds
text/debug-output
feature/ovpn3-desktop-cli
bugfix/secureqsettings-deadlock
refactoring/change-settings-when-connected
files_check
ArchLinux-support
second_adaptation_to_diff_os
sudo
refactoring/android-build
adaptation_to_different_os
feature/online_installer_for_v4
update_to_r2
bugfix/return-after-installation
feature/custom_drawer_component
bugfix/split-tunneling
bugfix/existing-awg-container
revert-370-feature/custom_drawer_component
bugfix/adapted_awg_questiondrawer
bugfix/updated_drawer_height_pageserverdata
bugfix/translated_new_source_strings_to_chinese
feature/split-tunneling-config
feature/accessibility-support
branch_connectivity_change_fix
feature/ikev2_android
android_ss_transport
bugfix/macos_fixes
feature/nextcloud-support
feature/macos_network_extension
android_pt_transport_source
feature/ios-openvpn3-pluggable-transport-Cloak
bugfix/cloak_for_desktops_fix
arm-build-macos
fix-macos-build-brew
bugfix/ios-build-openvpnadapter-from-source
feature/download-native-wireguard-config-on-connect
feature/v2ray-container
bugfix/dpkg-busy-checking-stuck
feature/online-installer
dev-killswitch
dev-netadapters
5.1.0.6
5.0.4.2
5.0.4.1
5.0.4.0
5.0.3.0
5.0.2.1
5.0.2.0
5.0.1.5
5.0.0.5
5.0.0.2
4.8.21.0
4.8.19.0
4.8.18.0
4.8.17.0
4.8.16.0
4.8.15.4
4.8.15.0
4.8.14.5
4.8.14.1
4.8.12.9
4.8.12.8
4.8.12.7
4.8.12.6
4.8.11.4
4.8.11.3
4.8.11.2
4.8.11.1
4.8.11.0
4.8.10.0
4.8.9.2
4.8.9.1
4.8.9.0
4.8.8.3
4.8.8.2
4.8.8.1
4.8.7.2
4.8.7.1
4.8.7.0
4.8.6.0
4.8.5.0
4.8.4.5
4.8.4.4
4.8.4.3
4.8.4.2
4.8.4.1
4.8.4.0
4.8.3.2
4.8.3.1
4.8.2.3
4.8.1.9
4.8.1.0
4.8.0.5
4.7.0.0
4.6.0.3
4.6.0.1
4.5.3.0
4.5.0.0
4.4.0.0
4.3.0.0
4.2.1.0
4.2.0.1
4.1.2.0_cloak_pt_experimental
4.1.0.1
4.0.8
3.1.0
3.0.8
3.0.7
3.0.5
2.1.2
2.1.0
2.0.10
2.0.9
2.0.8
2.0.7
2.0.6
2.0.5
2.0.1
2.0
1.9.1
1.9
1.8
1.7
1.6
1.5
1.4
1.3
1.2
1.1
1.0
No labels
pull-request
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
amnezia-vpn/amnezia-client#1166
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @akonovaloff on GitHub (May 6, 2026).
Original GitHub issue: https://github.com/amnezia-vpn/amnezia-client/issues/2575
Environment
Problem
After connecting, the VPN tunnel is up but internet doesn't work.
ping 8.8.8.8succeeds (tunnel is alive)ping google.comhangs (DNS broken)resolvectl statushangs withConnection timed outresolvectl status amn0showsCurrent Scopes: noneinstead ofDNSHappens on most connects, especially noticeable right after the first connection attempt.
Root cause
AmneziaVPN restarts
systemd-resolvedand immediately tries to configure DNS on amn0 via DBus. The service hasn't fully initialized its DBus interface yet, so the call fails silently and DNS is never set on amn0.Visible in
/var/log/AmneziaVPN/AmneziaVPN-service.logright after connect:Workaround
Note:
systemctl restart systemd-resolvedhangs when resolved is stuck — usekill+startinstead.Manual fix (run after connecting when DNS doesn't work):
Permanent automated fix — udev rule that triggers a systemd service on amn0 creation:
/etc/udev/rules.d/99-amnezia-dns.rules:/etc/systemd/system/amnezia-fix-dns.service:/usr/local/bin/amnezia-fix-dns.sh:Expected behavior
DNS should be correctly configured on amn0 immediately after connecting.
@akonovaloff commented on GitHub (May 6, 2026):
For anyone hitting this issue, here's a step-by-step fix:
Quick manual fix
Run this after connecting when internet doesn't work:
Permanent fix (runs automatically on every connect)
After this, DNS will be fixed automatically every time you connect.
@tiaga commented on GitHub (May 8, 2026):
Found that disabling KillSwitch can be also used as a workaround.
@dimadze1337 commented on GitHub (Jun 22, 2026):
This bug still persist
@DenisDudnik commented on GitHub (Aug 15, 2026):
ver 5.0.0.5.
This bug still persist
@garry0garry commented on GitHub (Aug 19, 2026):
ver 5.0.0.5.
This bug still persist
@DmitriyTischenko commented on GitHub (Aug 21, 2026):
ver 5.0.0.5.
This bug still persist
@rasolAAaa commented on GitHub (Aug 21, 2026):
باکمال تشکر از مدیریت محترم بله راهاندازی ش
در تاریخ جمعه 21 اوت 2026، 14:48 Dmitriy Tischenko <
@.***> نوشت:
@garry0garry commented on GitHub (Aug 21, 2026):
Workaround: Manually configure DNS using AmneziaVPN addresses and specify a static IP address on the interface.
@madpower2000 commented on GitHub (Aug 26, 2026):
I was able to reproduce and investigate this issue in detail on Ubuntu 24.04 / systemd 255 with AmneziaVPN 5.0.1.5, and I believe there is an important additional detail beyond a simple DBus race condition.
Environment
7.0.0-30-generic5.0.1.5amn0I also have Hiddify 4.1.1 installed, but I verified that the problem reproduces from a completely clean networking baseline, with Hiddify not involved at all.
Symptom
Amnezia connects successfully and creates the tunnel, but immediately after connection all normal hostname-based Internet access stops working.
For example:
all fail.
However, the VPN tunnel itself is still functional.
Traffic sent directly by IP through the tunnel works, so this is not a tunnel/routing failure. The failure is specifically in the local DNS path.
What happens during Amnezia connection
When Amnezia connects, I observe the following:
amn0is created.amn0, including DNS servers such as:and domain:
systemd-resolved.The important part is what happens next.
systemd-resolvedgets stuck at ~100% CPUAfter Amnezia restarts
systemd-resolved, the process enters a persistent busy loop at approximately 100% CPU.This is not just a brief startup race.
I inspected the stuck process with both
gdbandstrace.The stack/runtime behavior points to the
sd_eventloop, with activity aroundtimerfd_settime,epoll_wait, andread.straceshows extremely high repeated syscall activity on the order of tens of thousands of calls per second.While
systemd-resolvedis in this state, the local stub resolver:stops answering DNS requests.
That explains why all browsers and normal applications report that the Internet is unavailable even though the VPN tunnel itself is healthy.
Restarting
systemd-resolveddoes not fix itI also tested:
while Amnezia is connected.
The newly started
systemd-resolvedprocess goes back into the same ~100% CPU loop, so restarting the service is not sufficient.This makes me think the problem is more than just "Amnezia calls DBus before resolved is ready."
There appears to be a reproducible interaction between Amnezia's DNS setup / resolved restart sequence and systemd 255 that leaves
systemd-resolvedin a broken state.Amnezia log errors
At the same time, Amnezia logs DNS-related DBus errors such as:
This is consistent with Amnezia attempting to configure DNS over DBus while
systemd-resolvedis already wedged.Tunnel data plane remains healthy
The key observation is that the tunnel itself continues to work.
With DNS bypassed, HTTPS traffic through
amn0succeeds.For example, a direct-IP HTTPS request through the Amnezia tunnel returns a valid HTTP response.
The upstream DNS servers assigned to the tunnel also respond normally when queried directly.
So the failure can be classified as:
Temporary workaround that confirms the diagnosis
As a diagnostic workaround, I temporarily bypassed the broken
127.0.0.53stub and pointed/etc/resolv.confdirectly at the live DNS servers used by the Amnezia tunnel:Immediately after doing that:
started working normally again.
The public IP also correctly changed to the Amnezia VPN exit IP.
So the workaround restores connectivity without touching:
ip ruleamn0interfaceIt only bypasses the stuck local
systemd-resolvedstub.When Amnezia disconnects, restoring the original
/etc/resolv.confsymlink to:returns the machine to the normal baseline state.
Hiddify was ruled out
Initially I suspected a conflict with Hiddify because both clients are installed on the same machine.
I tested this explicitly.
Hiddify creates:
while connected.
After disconnecting Hiddify:
tun0disappears2022disappearsip ruleentries disappearsing-boxexits/etc/resolv.confremains unchangedI repeated this multiple times.
More importantly, the Amnezia DNS failure also occurs from a clean baseline where Hiddify was never connected.
So at least in my case, this is not caused by stale state from another VPN client.
Full reproduction
A simplified reproduction sequence is:
amn0exists and full-tunnel routes are present.systemd-resolvedat ~100% CPU.127.0.0.53fail.DnsUtilsLinuxDBus errors.127.0.0.53and use the tunnel DNS servers directly.No reboot is required to reproduce this.
My current workaround
For my system I implemented a small temporary keep-alive workaround:
amn0appears,/etc/resolv.confis temporarily pointed at the DNS servers reported for the live tunnel;amn0disappears, the original/etc/resolv.confis restored byte-for-byte;This makes Amnezia usable, but I consider this only a workaround, not an appropriate upstream fix.
Possible area to investigate
I think it would be useful to inspect the Linux DNS lifecycle around
DnsUtilsLinux, especially:systemd-resolved;org.freedesktop.resolve1;systemd-resolvedto become fully usable after restart;sd_eventbehavior on systemd 255;~.routing domain is relevant.I would be cautious about fixing this with only a sleep or retry loop, because in my reproduction
systemd-resolvedis not merely slow to start — it remains permanently stuck at ~100% CPU until Amnezia is disconnected / the state changes.Summary
On my Ubuntu 24.04 system, the failure is reproducibly:
Directly bypassing the local stub and using the tunnel's DNS servers restores connectivity immediately.
If useful, I can provide additional
strace,gdb,resolvectl, route/rule, and Amnezia log output from the failing state.@garry0garry commented on GitHub (Aug 26, 2026):
I can confirm the same failure on Ubuntu 24.04 with systemd 255.4-1ubuntu8.17, kernel 7.0.0-30-generic, AmneziaVPN 5.0.0.5, and AWG.
In our case, amn0 was created and the tunnel remained up, but after Amnezia restarted systemd-resolved, the resolver became unresponsive: busctl, resolvectl, and normal DNS queries timed out.
As a diagnostic workaround, we added a PATH wrapper only to AmneziaVPN.service that turns exactly
systemctl restart systemd-resolvedinto a no-op. All other systemctl calls remain unchanged. Since suppressing this restart, DNS has remained stable without changing /etc/resolv.conf, routes, or the VPN configuration.This suggests that the systemd-resolved restart itself should be removed from the Linux DNS lifecycle, rather than handled only with a delay or retry after restarting it.
@madpower2000 commented on GitHub (Sep 3, 2026):
Still reproducible on AmneziaVPN 5.0.2.0.
I tested this on 2026-09-03 with the local DNS workaround completely stopped, using 5 consecutive connect/disconnect cycles. The failure reproduced 5/5 times.
Environment
7.0.0-30-generic255(255.4-1ubuntu8.17)5.0.2.0Linux x64amn0The installed version was verified from both
/opt/AmneziaVPN/components.xmland the application binary.Reproduction
On every connect:
amn0comes up normally and the AWG data plane is healthy.AmneziaVPN-servicelogs:Immediately afterwards it logs:
The restarted
systemd-resolvedprocess enters a persistent ~97–99% CPU busy loop.The local
127.0.0.53stub stops responding.For example:
and:
The VPN tunnel itself is still healthy
This is specifically a DNS-path failure, not a tunnel/routing failure.
While hostname resolution is completely broken:
returns HTTP
301.And:
also returns HTTP
301.So TCP/HTTPS through the Amnezia tunnel continues to work while the local resolver is dead.
systemd-resolved busy loop
I captured the spinning
systemd-resolvedprocess withstrace.A representative loop is:
A 5-second sample contained approximately:
That is roughly 30k loop iterations/sec, or about 90k syscalls/sec across those three core calls.
Because
TFD_TIMER_ABSTIMEis used, the{0,1ns}absolute expiration is effectively already in the past, so the timer becomes immediately readable again and the process spins continuously.Disconnect behavior
The problem also affects disconnect.
On every disconnect Amnezia again logs:
After
amn0is removed, the restartedsystemd-resolvedprocess can remain at ~99% CPU for another 1–2 minutes before eventually settling back to normal.During that period DNS may remain unavailable even though the VPN has already been disconnected.
DNS configuration
Amnezia attempts to push:
to
amn0, as visible in the service log:The upstream DNS servers themselves work correctly when bypassing the broken local stub.
Comparison with 5.0.1.5
The behavior on 5.0.2.0 is effectively unchanged from 5.0.1.5:
systemd-resolved~100% CPU after Amnezia connection127.0.0.53stops answeringDnsUtilsLinuxDBus errorssystemd-resolvedis still restarted by AmneziaThe same restart → systemd-resolved failure → DBus failure → dead local DNS sequence is therefore still present in 5.0.2.0.
Workaround confirmation
As a control test, I re-enabled my local workaround which bypasses
127.0.0.53whileamn0exists and points/etc/resolv.confdirectly to the tunnel DNS servers.With that workaround active:
So the workaround restores connectivity without fixing the underlying
systemd-resolvedproblem.Suggested area to investigate
The Linux client still appears to restart
systemd-resolvedas part of DNS handling.I would strongly suggest investigating whether the client needs to restart
systemd-resolvedat all.Ideally DNS configuration should be performed through
org.freedesktop.resolve1(SetLinkDNS,SetLinkDomains,RevertLink, etc.) without restarting the resolver daemon.If a restart is unavoidable, the client should at least verify that
org.freedesktop.resolve1is healthy and responsive before issuing subsequent DBus calls.However, this does not appear to be only a short DBus initialization delay: in this reproduction the new
systemd-resolvedprocess itself enters a persistent CPU busy loop and stops servicing the local DNS stub.@HeisLuka commented on GitHub (Sep 9, 2026):
I traced this through the current
devsource. The race is real, but there appears to be an even more fundamental lifecycle problem than simply "we restart resolved and configure DNS too early".Current ordering
During
Daemon::activate()the WireGuard/AWG path calls:before activation completes.
On Linux,
maybeUpdateResolvers()reachesDnsUtilsLinux::updateResolvers(), which schedules:SetLinkDNSSetLinkDefaultRouteGet(Domains)followed bySetLinkDomainsagainst
org.freedesktop.resolve1.However,
DnsUtilsLinux::updateResolvers()returnstrueimmediately after scheduling those asynchronous calls:Actual D-Bus failures are handled later only by logging:
so resolver configuration failure does not fail activation.
Then, after the VPN reaches
Connected,VpnConnection::onConnectionStateChanged()callsflushDns()through the service.On Linux
RouterLinux::flushDns()currently does:So the current sequence is effectively:
That means
systemd-resolvedcan be restarted after the per-link DNS state has already been configured.Even if all of the original
SetLink*calls succeeded, restarting the service can invalidate the transient resolver state that was just installed.And if a D-Bus call happens while resolved is unavailable/restarting, it can fail asynchronously while the VPN activation path has already considered DNS setup successful.
Suggested first fix: do not restart systemd-resolved to flush its cache
systemd-resolvedalready exposes the native:D-Bus method.
So for the
systemd-resolvedbranch,RouterLinux::flushDns()should useFlushCaches()rather than:A CLI equivalent would be:
but since
DnsUtilsLinuxalready owns a D-Bus interface toorg.freedesktop.resolve1, using the D-Bus API directly seems cleaner.Conceptually:
and then the Linux router/service layer can delegate to that instead of restarting the daemon.
The existing
nscdbranch can remain separate if restarting nscd is actually required there.A readiness wait alone is not sufficient
Adding something like:
after
systemctl restartwould fix only one half of the problem.It would make the restarted service ready, but it would not restore per-link DNS state that was configured before the restart.
So I would avoid the restart entirely rather than adding a sleep/poll after it.
Second fix: make resolver configuration observable
DnsUtilsLinux::updateResolvers()currently has fire-and-forget semantics.A stronger invariant would be:
This could be implemented either with bounded synchronous D-Bus calls or a small async completion barrier/state machine.
The important part is that a D-Bus error should propagate back to activation rather than only producing:
after activation has already succeeded.
If
org.freedesktop.resolve1is temporarily unavailable, a bounded readiness/retry step before applying the resolver state also makes sense.There is also an error-reporting problem in
flushDns()RouterLinux::flushDns()currently does not use the result ofwaitForFinished()or thesystemctlexit status to determine its return value.It eventually returns:
even if restart did not complete successfully.
So today
"Flush dns completed"/truedoes not really establish the postcondition "DNS service is usable".Regression coverage
I would test the behavior by state/postcondition instead of adding timing sleeps:
systemd-resolved.systemd-resolved.service.amn0survives the cache-flush path.SetLinkDNSD-Bus failure and verify DNS configuration/activation does not silently report success.org.freedesktop.resolve1unavailable and verify bounded readiness/retry behavior.systemd-resolvedrestarts.This may also explain or share a root cause with #2869, where repeated transitions eventually cause:
because the current implementation turns a logical DNS cache flush into a full service restart.
So I think the narrowest safe first change is:
replace the
systemd-resolvedrestart in LinuxflushDns()withorg.freedesktop.resolve1.Manager.FlushCaches(), then separately make theSetLink*configuration path observable instead of fire-and-forget.@HeisLuka commented on GitHub (Sep 9, 2026):
I rechecked this against current
dev, and the failure mode is still present.There is one important clarification to the original root-cause description:
the current code does not only risk configuring DNS too soon after restarting
systemd-resolved; it can configure the VPN link first and then restartsystemd-resolvedafterwards.That makes the lifecycle problem even more direct.
Current activation ordering
For WireGuard / AmneziaWG,
Daemon::activate()currently reaches:maybeUpdateResolvers()calls:On Linux,
DnsUtilsLinux::updateResolvers()does:However, all of those resolver operations are asynchronous D-Bus operations.
For example,
SetLinkDNSis sent through:and completion is handled later by
dnsCallCompleted().If D-Bus returns an error, the current handler only does:
There is no propagation back to the activation transaction.
So currently:
does not mean:
Then
Connectedrestarts the resolverWhen the desktop client receives:
VpnConnection::onConnectionStateChanged()immediately calls:On Linux that eventually reaches
RouterLinux::flushDns().For a system using
systemd-resolved, the current implementation is:So the effective lifecycle can be:
This means even successfully applied transient per-link state can be destroyed immediately after activation.
And if the asynchronous D-Bus operations are still in flight when the restart starts, they can fail against the disappearing/restarting resolver service.
That directly matches the log sequence reported here:
flushDns()also does not verify success correctlyThere is another smaller problem in the same function.
The return value from:
is ignored.
The process exit status is also not checked.
The implementation logs:
when stdout/stderr is empty and then returns:
regardless of whether restarting the resolver actually produced the intended postcondition.
So:
currently does not establish:
Restarting
systemd-resolvedis unnecessary for cache flushingsystemd-resolvedalready exposes a dedicated D-Bus method:and the corresponding command is:
The systemd documentation also explicitly describes using:
for VPN per-link DNS configuration.
So the narrow fix does not need a sleep around
systemctl restart.I think the stronger fix is:
for a DNS cache flush.
For example:
Why adding a delay alone is insufficient
A workaround such as:
could reduce the D-Bus readiness race.
But it keeps an unnecessary destructive lifecycle operation in the connection path.
More importantly, simply waiting after the current restart would not solve the ordering where the VPN DNS state was already configured before the restart.
The invariant should instead be:
Suggested implementation direction
systemd-resolved, replace:with:
or
resolvectl flush-caches.Keep the existing restart behavior for
nscdseparate if it is genuinely required there.Make
DnsUtilsLinux::updateResolvers()observable rather than fire-and-forget:If
org.freedesktop.resolve1is temporarily unavailable, use bounded readiness/retry rather than declaring resolver configuration successful.Do not declare the connection fully healthy until the DNS configuration postcondition is known.
Regression cases
Connect AWG/WG on a
systemd-resolvedhost:systemd-resolved.servicePID does not change because of DNS cache flush.After
Connected:still shows the expected DNS servers, routing domain and default-route state.
Inject
SetLinkDNSD-Bus failure:Temporarily make
org.freedesktop.resolve1unavailable:Repeated connect/disconnect/reconnect:
systemd-resolvedservice restarts.Cache flushing:
Split-tunnel transitions:
This may also explain part of #2869, where repeated split-tunnel activity can drive
systemd-resolvedintostart-limit-hit: the current implementation turns a logical DNS-cache flush into a service restart.So I think the core issue is source-confirmed in current
dev:cache invalidation is implemented as destruction of the resolver service that owns the per-link DNS state, while the DNS actuation itself is asynchronous and has no success barrier.
@Spiceman161 commented on GitHub (Oct 23, 2026):
I can confirm the same issue on Linux Mint with AmneziaVPN 5.0.3.0 (
de93650, Sep 18 2026).The VPN profile itself contains valid DNS servers:
During the failure:
At the same time
systemd-resolvedwas still reported as active, but was clearly stuck:The VPN data path itself was working correctly. Direct DNS queries through the tunnel to
8.8.8.8succeeded over both UDP and TCP:The journal also showed several
systemd-resolvedrestarts within a short period:Restarting
systemd-resolvedrestored responsiveness, but the DNS configuration foramn0was gone. Manually configuring DNS and the catch-all routing domain fixed name resolution immediately:After that:
After a later normal reconnect, Amnezia successfully configured the interface itself:
So the issue is intermittent and appears to be related to the Linux client /
systemd-resolvedintegration rather than the VPN profile itself.