AdguardTeam / AdguardForAndroid

Open bug tracker for Android version of AdGuard.
https://adguard.com/
1.31k stars 89 forks source link

AdGuard protection not starting while selecting DNS server different than system one #4428

Closed McGyver1979 closed 1 year ago

McGyver1979 commented 1 year ago

Please answer the following questions for yourself before submitting an issue.

AdGuard version

4.0 Nightly 41

Environment

- OS: Android 12 (Magic UI 6.0)
- Device: Honor 50 5G
- Firmware: NTH-NX9

Root access

What filters do you have enabled?

AdGuard Base filter, AdGuard Chinese filter, AdGuard Russian filter, AdGuard Social Media filter, AdGuard Annoyances filter

What Stealth Mode options do you have enabled?

No response

Issue Details

Steps to reproduce:

  1. Be sure AdGuard and AdGuard VPN are open
  2. Select a DNS Server other than system predefined one
  3. set DSN Protection switch ON
  4. Try to enable AdGuard's protection

Expected Behavior

I can enable protection with selected DNS

Actual Behavior

If previously connected (without DNS protection) it self disconnects and is no more connecting unless I disable DNS protection (or I set system predefined server option). If not yet connected, no chance to do that.

I guess it could be the same issue notified by 'aespapa' last week, issue #4389, but with more details

Screenshots

A short video: https://drive.google.com/file/d/1GOFmbz3Md8THd3zE_hqodH4fLOQhBiMe/view?usp=sharing

Additional Information

Just a note: Adguard VPN is running on compatibilty mode as well, together with AdGuard

I hope you can find the following log's portion useful: Adguard log - DNS.txt

Please don't hesitate to contact me in case you need more info.

Thanks.

honeykkk commented 1 year ago

Available Another DNS Server when the default language is set to English.

innit86 commented 1 year ago

Same problem here. Can't enable protection at all if "DNS protection" is turned on. Only solution is to disable DNS filtering, after that AG protection can be turned on.

Same issue on Galaxy Tab S8+ (A12) & Pixel 7 Pro (A13), both rooted with Magisk.

Squall-Leonhart commented 1 year ago

Adguard VPN isn't a a factor of this issue, happens with Adguard on its own.

maxikuzmin commented 1 year ago

@McGyver1979 @honeytheyeon @innit86 @Squall-Leonhart please check the low-level settings -> Bootstrap upstream. Most likely, the problem is what is written there. Try clearing Bootstrap upstream, and repeat the steps

innit86 commented 1 year ago

@McGyver1979 @honeytheyeon @innit86 @Squall-Leonhart please check the low-level settings -> Bootstrap upstream. Most likely, the problem is what is written there. Try clearing Bootstrap upstream, and repeat the steps

Bootstrap upstreams & fallback upstreams are both empty so it can't be it.

McGyver1979 commented 1 year ago

@McGyver1979 @honeytheyeon @innit86 @Squall-Leonhart please check the low-level settings -> Bootstrap upstream. Most likely, the problem is what is written there. Try clearing Bootstrap upstream, and repeat the steps

Bootstrap upstreams & fallback upstreams are both empty so it can't be it.

Same to me, Bootstrap upstreams textarea is empty

maxikuzmin commented 1 year ago

@innit86 @McGyver1979 to troubleshoot this issue, we need to get additional logs.

Here's what we need you to do:

McGyver1979 commented 1 year ago

@maxikuzmin Unfortunately I'm not able to do what you ask, at least at the moment: after the previous answer I had done a test by uninstalling the nightly build, performed a system clean with a specific app, installed and run the latest Adguard beta version with all flags set except 'language specific', 'other' and 'custom' (only filters recommended by AdGuard, HTTPS, DNS server got from Adguard DNS console) and then upgraded again to nightly: unluckily (for troubleshooting purposes) now it works with the "DNS protection" feature activated as well. I'm sorry. I will try to do something to reproduce again conditions where issue was present.

Squall-Leonhart commented 1 year ago

the issue manifests from a clean install, however for a moment i was able to use adguard dns from the clean install (but not cloduflare dns), until i restarted the phone

honeykkk commented 1 year ago

I solved that dns sever issue. I think This is a language setting issue. If it's set to default lang without english, you're in trouble.

McGyver1979 commented 1 year ago

I solved that dns sever issue. I think This is a language setting issue. If it's set to default lang without english, you're in trouble.

In the days when I experienced the problem I switched between "system (italian)" and "english" and back, without noticing any changes. Now that, after yesterday's uninstalls and new installs, I no longer have problems and I also connect with dns protection, the language is still on "system (italian)".

It could be a different case that produces the same final disservice... interesting. :)

innit86 commented 1 year ago

@innit86 @McGyver1979 to troubleshoot this issue, we need to get additional logs.

Here's what we need you to do:

  • Collect the debug log as it's explained here;
  • Remember the exact time when the issue was reproduced. We will need it to find the corresponding records in the log file;
  • Additionally, capture the system bug report after reproducing the issue. Here's the instruction;
  • Send both files to devteam@adguard.com. Mention the Github issue number and the exact time when the issue was reproduced.

I removed AdGuard and all corresponding files completely, rebooted and installed the newest nightly (4.0.585). Protection can be enabled even with dns filtering on but websites are not opening (ERR_NAME_NOT_RESOLVED). The only way to get Internet back is to either disable dns filtering completely or to use Cloudflare (DNS over TLS) which is the only resolver that works. All other resolvers (Adguard, Google etc.) & protocols (Quic, DNS over Https) are not working. Time: 11:41-11:43

Logs have been deleted for privacy reasons.

maxikuzmin commented 1 year ago

@innit86 thanks, we'll check your logs. If anyone manages to repeat this problem, please send your logs to devteam@adguard.com or you can put the logs right here in the comments. Please enable Logging level -> Debug beforehand

maxikuzmin commented 1 year ago

@McGyver1979 @honeytheyeon @Squall-Leonhart has this problem still recurred?

Rtizer-9 commented 1 year ago

Quick solution for this problem - uninstall completely then reinstall adguard. I was having same problem and then I realized nightlies had several bugs and those bugs was kinda of getting re-transferred to the incremental updates we all guys were doing with all these back to back nightlies. Since this is a really big release with major changes under the hood, not all settings were imported correctly to the first nightly update we got.

PS - if your exact setting export and import works then great otherwise try setting them manually to not introduce the same bugs again.

honeykkk commented 1 year ago

@McGyver1979 @honeytheyeon @Squall-Leonhart has this problem still recurred?

it cools now. does not repeat this problem now for me 🫢

innit86 commented 1 year ago

@innit86 thanks, we'll check your logs. If anyone manages to repeat this problem, please send your logs to devteam@adguard.com or you can put the logs right here in the comments. Please enable Logging level -> Debug beforehand

@maxikuzmin Were you able to identify the cause of the issue?

maxikuzmin commented 1 year ago

@innit86 no, it is very likely that the problem was in one of the very first nightly updates. Now the problem does not recur, but it would be better to observe for now and not close the issue

innit86 commented 1 year ago

@innit86 no, it is very likely that the problem was in one of the very first nightly updates. Now the problem does not recur, but it would be better to observe for now and not close the issue

@maxikuzmin Well the issue is still there even after all the nightlies that have been released recently. I'm not an expert but there's something wrong with iptables/ip6tables, dns forwarder & dnslibs as you can see in the excerpt from the log:

11:41:08.115 [main] INFO j4.d - Resolved ID for theme=System isContrast=false: 2131951756 11:41:08.115 [main] INFO j4.d - No needs to set theme 11:41:08.116 [main] INFO k5.b - Request 'register the subscriber com.adguard.android.ui.activity.MainActivity' received 11:41:08.116 [main] WARN k5.b - Subscriber com.adguard.android.ui.activity.MainActivity doesn't contain any Subscribe methods, do nothing 11:41:08.870 [main] DEBUG k5.b - Bus received an event 'unregister a subscriber' with the com.adguard.android.ui.fragment.preferences.AdvancedPreferencesFragment class 11:41:08.871 [main] ERROR l7.c - The error occurred while making the snackbar java.lang.IllegalArgumentException: No suitable parent found from the given view. Please provide a valid view. at com.google.android.material.snackbar.Snackbar.makeInternal(Snackbar.java:9) at com.google.android.material.snackbar.Snackbar.make(Snackbar.java:2) at l7.c.e(AbstractSnackBuilder.kt:1) at l7.d.e(AbstractSnackBuilder.kt:1) at y7.a.b(ProgressSnackWrapper.kt:7) at y7.a.a(ProgressSnackWrapper.kt:1) at com.adguard.android.ui.fragment.preferences.AdvancedPreferencesFragment.onDestroyView(AdvancedPreferencesFragment.kt:2) at androidx.fragment.app.Fragment.performDestroyView(Fragment.java:7) at androidx.fragment.app.FragmentStateManager.destroyFragmentView(FragmentStateManager.java:5) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:40) at androidx.fragment.app.SpecialEffectsController$FragmentStateManagerOperation.complete(SpecialEffectsController.java:2) at androidx.fragment.app.SpecialEffectsController$Operation.completeSpecialEffect(SpecialEffectsController.java:2) at androidx.fragment.app.DefaultSpecialEffectsController$SpecialEffectsInfo.completeSpecialEffect(DefaultSpecialEffectsController.java:1) at androidx.fragment.app.DefaultSpecialEffectsController.startAnimations(DefaultSpecialEffectsController.java:8) at androidx.fragment.app.DefaultSpecialEffectsController.executeOperations(DefaultSpecialEffectsController.java:23) at androidx.fragment.app.SpecialEffectsController.executePendingOperations(SpecialEffectsController.java:23) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:37) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:10) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:4) at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:1) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7872) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

The '/system/bin/iptables -t nat -D OUTPUT -j ADGUARD_OUTPUT' command output| +––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ | iptables v1.8.7 (legacy): Couldn't find target ADGUARD_OUTPUT'| | Tryiptables -h' or 'iptables --help' for more information. | +––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ 11:41:01.678 [DefaultDispatcher-worker-3] INFO x1.h -

+––––––––––––––––––––––––––––––––––––––––––––––+ |The '/system/bin/iptables -t nat -F ADGUARD_OUTPUT' command output| +––––––––––––––––––––––––––––––––––––––––––––––+ | iptables: No chain/target/match by that name.| +––––––––––––––––––––––––––––––––––––––––––––––+ 11:41:01.699 [DefaultDispatcher-worker-3] INFO x1.h -

+––––––––––––––––––––––––––––––––––––––––––––––+ |The '/system/bin/iptables -t nat -X ADGUARD_OUTPUT' command output| +––––––––––––––––––––––––––––––––––––––––––––––+ | iptables: No chain/target/match by that name.| +––––––––––––––––––––––––––––––––––––––––––––––+ 11:41:01.708 [DefaultDispatcher-worker-3] INFO x1.h -

+––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ |The '/system/bin/iptables -D OUTPUT -j ADGUARD_OUTPUT' command output| +––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ | iptables v1.8.7 (legacy): Couldn't find target ADGUARD_OUTPUT'| | Tryiptables -h' or 'iptables --help' for more information. | +––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ 11:41:01.719 [DefaultDispatcher-worker-3] INFO x1.h -

+––––––––––––––––––––––––––––––––––––––––––––––+ |The '/system/bin/iptables -F ADGUARD_OUTPUT' command output| +––––––––––––––––––––––––––––––––––––––––––––––+ | iptables: No chain/target/match by that name.| +––––––––––––––––––––––––––––––––––––––––––––––+ 11:41:01.730 [DefaultDispatcher-worker-3] INFO x1.h -

+––––––––––––––––––––––––––––––––––––––––––––––+ |The '/system/bin/iptables -X ADGUARD_OUTPUT' command output| +––––––––––––––––––––––––––––––––––––––––––––––+ | iptables: No chain/target/match by that name.| +––––––––––––––––––––––––––––––––––––––––––––––+ 11:41:01.737 [DefaultDispatcher-worker-3] INFO x1.h -

+–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ |The '/system/bin/iptables -D INPUT -j ADGUARD_INPUT' command output| +–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ | iptables v1.8.7 (legacy): Couldn't find target ADGUARD_INPUT'| | Tryiptables -h' or 'iptables --help' for more information. | +–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ 11:41:01.746 [DefaultDispatcher-worker-3] INFO x1.h -

+––––––––––––––––––––––––––––––––––––––––––––––+ |The '/system/bin/iptables -F ADGUARD_INPUT' command output| +––––––––––––––––––––––––––––––––––––––––––––––+ | iptables: No chain/target/match by that name.| +––––––––––––––––––––––––––––––––––––––––––––––+ 11:41:01.755 [DefaultDispatcher-worker-3] INFO x1.h -

+––––––––––––––––––––––––––––––––––––––––––––––+ |The '/system/bin/iptables -X ADGUARD_INPUT' command output| +––––––––––––––––––––––––––––––––––––––––––––––+ | iptables: No chain/target/match by that name.| +––––––––––––––––––––––––––––––––––––––––––––––+

The '/system/bin/ip6tables -t mangle -D OUTPUT -j ADGUARD_OUTPUT' command output| +–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ | ip6tables v1.8.7 (legacy): Couldn't find target ADGUARD_OUTPUT'| | Tryip6tables -h' or 'ip6tables --help' for more information. | +–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ 11:41:02.415 [DefaultDispatcher-worker-3] INFO x1.h -

+–––––––––––––––––––––––––––––––––––––––––––––––+ |The '/system/bin/ip6tables -t mangle -F ADGUARD_OUTPUT' command output| +–––––––––––––––––––––––––––––––––––––––––––––––+ | ip6tables: No chain/target/match by that name.| +–––––––––––––––––––––––––––––––––––––––––––––––+ 11:41:02.424 [DefaultDispatcher-worker-3] INFO x1.h -

+–––––––––––––––––––––––––––––––––––––––––––––––+ |The '/system/bin/ip6tables -t mangle -X ADGUARD_OUTPUT' command output| +–––––––––––––––––––––––––––––––––––––––––––––––+ | ip6tables: No chain/target/match by that name.| +–––––––––––––––––––––––––––––––––––––––––––––––+ 11:41:02.433 [DefaultDispatcher-worker-3] INFO x1.h -

+–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ | The '/system/bin/ip6tables -t nat -D OUTPUT -j ADGUARD_OUTPUT' command output | +–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ | ip6tables v1.8.7 (legacy): can't initialize ip6tables table `nat': Table does not exist (do you need to insmod?)| | Perhaps ip6tables or your kernel needs to be upgraded. | +–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ 11:41:02.445 [DefaultDispatcher-worker-3] INFO x1.h -

+–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ | The '/system/bin/ip6tables -t nat -F ADGUARD_OUTPUT' command output | +–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––+ | ip6tables v1.8.7 (legacy): can't initialize ip6tables table `nat': Table does not exist (do you need to insmod?)| | Perhaps ip6tables or your kernel needs to be upgraded.

11:41:22.298 [Thread-29] DEBUG com.adguard.dnslibs.proxy.DnsProxy - UdpSocket connect: [id=10] connect(): Failed to connect: Error at ag::dns::UdpSocket::connect:56: host is unreachable:

11:41:23.298 [Thread-29] DEBUG com.adguard.dnslibs.proxy.DnsProxy - DNS forwarder finalize_processed_event: Error at ag::dns::DnsForwarder::handle_message_internal:616: Upstream exchange error: Caused by: Error at ag::dns::PlainUpstream::exchange:91: Timed out: Timed out while waiting for DNS reply via UDP.

artemiv4nov commented 1 year ago

Please turn off the IPv6 filtering in the Low-Level settings

innit86 commented 1 year ago

Please turn off the IPv6 filtering in the Low-Level settings

It is off and was never on. Went back to 4.0.82 which is the last properly working nightly version and all problems are gone.

maxikuzmin commented 1 year ago

For the moment, I’m closing this issue. You can reopen the issue in the future if the problem persists

eseiler commented 1 year ago

I also had this bug (couldn't select any DNS-over-HTTPS server). Setting the bootstrap DNS explicitly as suggested in this comment fixed it for me.

In nightly we have a bug when sometimes system DNS is not used as bootstrap, and secure DNS fails.

We are working on a fix of this issue.

As a workaround, you may set 1.1.1.1 or 94.140.14.140 as bootstrap upstream in low-level settings

Originally posted in https://github.com/AdguardTeam/AdguardForAndroid/issues/4468#issuecomment-1446914183

Squall-Leonhart commented 1 year ago

I also had this bug (couldn't select any DNS-over-HTTPS server). Setting the bootstrap DNS explicitly as suggested in this comment fixed it for me.

Works for me too.