AdguardTeam / AdGuardHome

Network-wide ads & trackers blocking DNS server
https://adguard.com/adguard-home.html
GNU General Public License v3.0
25.45k stars 1.83k forks source link

Invalid record in /etc/hosts leading to panics #5584

Closed CJM88888 closed 1 year ago

CJM88888 commented 1 year ago

Prerequisites

Operating system type

Linux, OpenWrt

CPU architecture

ARMv5

Installation

GitHub releases or script from README

Setup

On a router, DHCP is handled by the router

AdGuard Home version

liuux-armv5 AdGuard Home v0.107.26

Description

Hi I'm getting an internal error when I try to start the latest version manually. 屏幕截图 2023-03-10 192240

Thomas2500 commented 1 year ago

Hello! I'm also affected by this issue. I updated my instance and it crashed immediately. I reinstalled the entire instance and after fist restart the crash is happening again. I'm on Linux pve 5.15.74-1-pve (AdGuardHome installed within an LXC Ubuntu 22.04.2 container, amd64 processor).

AdGuardHome is currently unable to start.

2023/03/13 20:52:51 [info] AdGuard Home, version v0.107.26
2023/03/13 20:52:51 [info] service: control action: run
2023/03/13 20:52:51.245376 [info] AdGuard Home, version v0.107.26
2023/03/13 20:52:51.245387 [info] AdGuard Home is running as a service
2023/03/13 20:52:51.246917 [info] tls: using default ciphers
panic: unexpected error type errors.Error

goroutine 6 [running]:
github.com/AdguardTeam/golibs/netutil.replaceKind({0x190ce00?, 0x1907f40?}, {0xdd5333?, 0xc00003c79f?})
        github.com/AdguardTeam/golibs@v0.12.0/netutil/error.go:226 +0x174
github.com/AdguardTeam/golibs/netutil.ValidateTLDLabel({0xc00003c79f, 0x0})
        github.com/AdguardTeam/golibs@v0.12.0/netutil/addr.go:180 +0xdd
github.com/AdguardTeam/golibs/netutil.ValidateHostname({0xc00003c78d?, 0x15?})
        github.com/AdguardTeam/golibs@v0.12.0/netutil/addr.go:355 +0x211
github.com/AdguardTeam/AdGuardHome/internal/aghnet.(*hostsParser).parseLine(0xc0000c5378?, {0xc00003c780?, 0x2e?})
        github.com/AdguardTeam/AdGuardHome/internal/aghnet/hostscontainer.go:346 +0x1b4
github.com/AdguardTeam/AdGuardHome/internal/aghnet.(*hostsParser).parseFile(0xcb0860?, {0x190c7a0?, 0xc000012320?})
        github.com/AdguardTeam/AdGuardHome/internal/aghnet/hostscontainer.go:308 +0xa5
github.com/AdguardTeam/AdGuardHome/internal/aghos.checkFile({0x190de00?, 0xc0002edb00?}, 0xc0000c56f0, {0xdaf831?, 0x1?})
        github.com/AdguardTeam/AdGuardHome/internal/aghos/filewalker.go:52 +0x229
github.com/AdguardTeam/AdGuardHome/internal/aghos.FileWalker.Walk(0x203000?, {0x190de00, 0xc0002edb00}, {0xc0002edb70, 0x1, 0x1})
        github.com/AdguardTeam/AdGuardHome/internal/aghos/filewalker.go:104 +0x268
github.com/AdguardTeam/AdGuardHome/internal/aghnet.(*HostsContainer).refresh(0xc000292e00)
        github.com/AdguardTeam/AdGuardHome/internal/aghnet/hostscontainer.go:479 +0x17e
github.com/AdguardTeam/AdGuardHome/internal/aghnet.NewHostsContainer(0xffffffffffffffff, {0x190de00?, 0xc0002edb00}, {0x19129f0, 0xc0002edad0}, {0xc0000c5910?, 0x1, 0x0?})
        github.com/AdguardTeam/AdGuardHome/internal/aghnet/hostscontainer.go:192 +0x366
github.com/AdguardTeam/AdGuardHome/internal/home.setupHostsContainer()
        github.com/AdguardTeam/AdGuardHome/internal/home/home.go:271 +0x18f
github.com/AdguardTeam/AdGuardHome/internal/home.setupContext({{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0xda7ae9, 0x3}, ...})
        github.com/AdguardTeam/AdGuardHome/internal/home/home.go:184 +0x2d4
github.com/AdguardTeam/AdGuardHome/internal/home.run({{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0xda7ae9, 0x3}, ...}, ...)
        github.com/AdguardTeam/AdGuardHome/internal/home/home.go:430 +0x218
created by github.com/AdguardTeam/AdGuardHome/internal/home.(*program).Start
        github.com/AdguardTeam/AdGuardHome/internal/home/service.go:46 +0x150

My configuration:

bind_host: 127.0.0.1
bind_port: 8080
users:
  - name: Thomas2500
    password: [...]
auth_attempts: 5
block_auth_min: 15
http_proxy: ""
language: ""
theme: auto
debug_pprof: false
web_session_ttl: 720
dns:
  bind_hosts:
    - 10.23.23.242
  port: 53
  anonymize_client_ip: false
  protection_enabled: true
  blocking_mode: default
  blocking_ipv4: ""
  blocking_ipv6: ""
  blocked_response_ttl: 10
  parental_block_host: family-block.dns.adguard.com
  safebrowsing_block_host: standard-block.dns.adguard.com
  ratelimit: 20
  ratelimit_whitelist: []
  refuse_any: true
  upstream_dns:
    - https://dns10.quad9.net/dns-query
  upstream_dns_file: ""
  bootstrap_dns:
    - 9.9.9.10
    - 149.112.112.10
    - 2620:fe::10
    - 2620:fe::fe:10
  all_servers: false
  fastest_addr: false
  fastest_timeout: 1s
  allowed_clients: []
  disallowed_clients: []
  blocked_hosts:
    - version.bind
    - id.server
    - hostname.bind
  trusted_proxies:
    - 127.0.0.0/8
    - ::1/128
  cache_size: 4194304
  cache_ttl_min: 0
  cache_ttl_max: 0
  cache_optimistic: true
  bogus_nxdomain: []
  aaaa_disabled: false
  enable_dnssec: false
  edns_client_subnet:
    custom_ip: ""
    enabled: false
    use_custom: false
  max_goroutines: 300
  handle_ddr: true
  ipset: []
  ipset_file: ""
  filtering_enabled: true
  filters_update_interval: 24
  parental_enabled: false
  safesearch_enabled: false
  safebrowsing_enabled: true
  safebrowsing_cache_size: 1048576
  safesearch_cache_size: 1048576
  parental_cache_size: 1048576
  cache_time: 30
  rewrites: []
  blocked_services:
    - facebook
  upstream_timeout: 10s
  private_networks: []
  use_private_ptr_resolvers: true
  local_ptr_upstreams: []
  use_dns64: false
  dns64_prefixes: []
  serve_http3: false
  use_http3_upstreams: false
tls:
  enabled: false
  server_name: ""
  force_https: false
  port_https: 443
  port_dns_over_tls: 853
  port_dns_over_quic: 853
  port_dnscrypt: 0
  dnscrypt_config_file: ""
  allow_unencrypted_doh: false
  certificate_chain: ""
  private_key: ""
  certificate_path: ""
  private_key_path: ""
  strict_sni_check: false
querylog:
  enabled: true
  file_enabled: true
  interval: 168h
  size_memory: 1000
  ignored: []
statistics:
  enabled: true
  interval: 7
  ignored: []
filters:
  - enabled: true
    url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt
    name: AdGuard DNS filter
    id: 1
  - enabled: false
    url: https://adguardteam.github.io/HostlistsRegistry/assets/filter_2.txt
    name: AdAway Default Blocklist
    id: 2
whitelist_filters: []
user_rules: []
dhcp:
  enabled: false
  interface_name: ""
  local_domain_name: lan
  dhcpv4:
    gateway_ip: ""
    subnet_mask: ""
    range_start: ""
    range_end: ""
    lease_duration: 86400
    icmp_timeout_msec: 1000
    options: []
  dhcpv6:
    range_start: ""
    lease_duration: 86400
    ra_slaac_only: false
    ra_allow_slaac: false
clients:
  runtime_sources:
    whois: true
    arp: true
    rdns: true
    dhcp: true
    hosts: true
  persistent: []
log_file: ""
log_max_backups: 0
log_max_size: 100
log_max_age: 3
log_compress: false
log_localtime: false
verbose: false
os:
  group: ""
  user: ""
  rlimit_nofile: 0
schema_version: 17
ainar-g commented 1 year ago

That you for the reports. Since it connected to the /etc/hosts parser, setting clients.runtime_sources.hosts to false works around the issue, see #5579. We're working on a fix.

CJM88888 commented 1 year ago

@ainar-g Hello, I am waiting for the official fix now?

EugeneOne1 commented 1 year ago

@CJM88888, that's right. We're going to push it at least to the edge channel later today.

EugeneOne1 commented 1 year ago

@CJM88888, hello again. Could you please check the latest edge build? It should now work as intended and log the hosts that didn't pass the validation.

CJM88888 commented 1 year ago

@EugeneOne1 Hi, I tried the latest binary and the problem occurs as follows. 微信图片_20230317052955

EugeneOne1 commented 1 year ago

@CJM88888, it seems you're still on the release channel. If you used the install script, to reinstall AdGuard Home from the edge channel, you may simply enter the following:

curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -r -c edge -v

You may also simply use the direct link.

Note also, that there are few configuration changes been made, so you may want to backup your AdGuardHome.yaml configuration file before updating.

CJM88888 commented 1 year ago

@EugeneOne1 I downloaded the binary compressed package you gave and decompressed it in the original directory, but it still couldn't start. I also tried a single startup, and it showed illegal instructions. 屏幕截图 2023-03-18 030533

ppfeufer commented 1 year ago

You stated you have an ARMv5 architecture, might want to download the package or that » https://static.adtidy.org/adguardhome/edge/AdGuardHome_linux_armv5.tar.gz

EugeneOne1 commented 1 year ago

@CJM88888, sorry for confusing, the link @ppfeufer specified is indeed the correct one.

CJM88888 commented 1 year ago

@EugeneOne1 thanks!

CJM88888 commented 1 year ago

@ppfeufer thanks!

EugeneOne1 commented 1 year ago

@CJM88888, great to hear everything is alright. Closing the issue.