vernesong / OpenClash

A Clash Client For OpenWrt
MIT License
16.81k stars 3.1k forks source link

[Bug] OpenClash in OpenWrt docker instance for x86_64, Get DNS 'listen' Option Error, OpenClash Can Not Start With Raw Config File #2853

Closed yusian closed 1 year ago

yusian commented 1 year ago

Verify Steps

OpenClash Version

v0.45.70-beta

Bug on Environment

Docker

Bug on Platform

Linux-amd64(x86-64)

To Reproduce

Basic info:

OS: Ubuntu 22.04.01 LTS Docker version 20.10.21, build baeda1f Docker Image: openwrtorg/rootfs:x86-64-openwrt-22.03

My steps:

  1. run docker script:
    docker run -it -p 22:22 -p 80:80 openwrtorg/rootfs:x86-64-openwrt-22.03

    terminal output:

    
    Failed to resize receive buffer: Operation not permitted
    /etc/preinit: line 5: can't create /sys/devices/system/cpu/microcode/reload: Read-only file system
    ip: RTNETLINK answers: Operation not permitted
    Press the [f] key and hit [enter] to enter failsafe mode
    Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level

ip: can't send flush request: Operation not permitted ip: SIOCSIFFLAGS: Operation not permitted

Please press Enter to activate this console.

BusyBox v1.35.0 (2022-10-14 22:44:41 UTC) built-in shell (ash)

/bin/ash: can't access tty; job control turned off


| |.-----.-----.-----.| | | |.----.| | | - || | -| || | | || || | |___|| |_||||____||| |__| |__| W I R E L E S S F R E E D O M

OpenWrt 22.03.2, r19803-9a599fee93

=== WARNING! ===================================== There is no root password defined on this device! Use the "passwd" command to set up a new password in order to prevent unauthorized SSH logins.

root@4f2ef91c5d81:/#


2. install openclash
```shell
root@4f2ef91c5d81:/# opkg update
Downloading https://downloads.openwrt.org/releases/22.03.2/targets/x86/64/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_core
Downloading https://downloads.openwrt.org/releases/22.03.2/targets/x86/64/packages/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/22.03.2/packages/x86_64/base/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_base
Downloading https://downloads.openwrt.org/releases/22.03.2/packages/x86_64/base/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/22.03.2/packages/x86_64/luci/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_luci
Downloading https://downloads.openwrt.org/releases/22.03.2/packages/x86_64/luci/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/22.03.2/packages/x86_64/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_packages
Downloading https://downloads.openwrt.org/releases/22.03.2/packages/x86_64/packages/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/22.03.2/packages/x86_64/routing/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_routing
Downloading https://downloads.openwrt.org/releases/22.03.2/packages/x86_64/routing/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/releases/22.03.2/packages/x86_64/telephony/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_telephony
Downloading https://downloads.openwrt.org/releases/22.03.2/packages/x86_64/telephony/Packages.sig
Signature check passed.
root@4f2ef91c5d81:/# 
root@4f2ef91c5d81:/# opkg install coreutils-nohup bash iptables dnsmasq-full curl ca-certificates ipset ip-full iptables-mod-tproxy iptables-mod-extra libcap libcap-bin ruby ruby-yaml kmod-tun kmod-inet-diag unzi
p luci-compat luci luci-base

In this process I get a error:

Collected errors:
 * check_data_file_clashes: Package dnsmasq-full wants to install file /etc/hotplug.d/ntp/25-dnsmasqsec
    But that file is already provided by package  * dnsmasq
 * check_data_file_clashes: Package dnsmasq-full wants to install file /etc/init.d/dnsmasq
    But that file is already provided by package  * dnsmasq
 * check_data_file_clashes: Package dnsmasq-full wants to install file /usr/lib/dnsmasq/dhcp-script.sh
    But that file is already provided by package  * dnsmasq
 * check_data_file_clashes: Package dnsmasq-full wants to install file /usr/sbin/dnsmasq
    But that file is already provided by package  * dnsmasq
 * check_data_file_clashes: Package dnsmasq-full wants to install file /usr/share/acl.d/dnsmasq_acl.json
    But that file is already provided by package  * dnsmasq
 * check_data_file_clashes: Package dnsmasq-full wants to install file /usr/share/dnsmasq/dhcpbogushostname.conf
    But that file is already provided by package  * dnsmasq
 * check_data_file_clashes: Package dnsmasq-full wants to install file /usr/share/dnsmasq/rfc6761.conf
    But that file is already provided by package  * dnsmasq
 * opkg_install_cmd: Cannot install package dnsmasq-full.
 * resolve_conffiles: Existing conffile /etc/config/luci is different from the conffile in the new package. The new conffile will be placed at /etc/config/luci-opkg.

then, I remove the dnsmasq and try it again:

root@4f2ef91c5d81:/# opkg remove dnsmasq
Removing package dnsmasq from root...
Not deleting modified conffile /etc/config/dhcp.
root@4f2ef91c5d81:/# opkg install coreutils-nohup bash iptables dnsmasq-full curl ca-certificates ipset ip-full iptables-mod-tproxy iptables-mod-extra libcap libcap-bin ruby ruby-yaml kmod-tun kmod-inet-diag unzi
p luci-compat luci luci-base
Package coreutils-nohup (9.0-2) installed in root is up to date.
Package bash (5.1.16-1) installed in root is up to date.
Package iptables-nft (1.8.7-7) installed in root is up to date.
Installing dnsmasq-full (2.86-15) to root...
Downloading https://downloads.openwrt.org/releases/22.03.2/packages/x86_64/base/dnsmasq-full_2.86-15_x86_64.ipk
Package curl (7.86.0-2) installed in root is up to date.
Package ca-certificates (20211016-1) installed in root is up to date.
Package ipset (7.15-2) installed in root is up to date.
Package ip-full (5.15.0-3) installed in root is up to date.
Package iptables-mod-tproxy (1.8.7-7) installed in root is up to date.
Package iptables-mod-extra (1.8.7-7) installed in root is up to date.
Package libcap (2.63-1) installed in root is up to date.
Package libcap-bin (2.63-1) installed in root is up to date.
Package ruby (3.0.4-1) installed in root is up to date.
Package ruby-yaml (3.0.4-1) installed in root is up to date.
Package kmod-tun (5.10.146-1) installed in root is up to date.
Package kmod-inet-diag (5.10.146-1) installed in root is up to date.
Package unzip (6.0-8) installed in root is up to date.
Package luci-compat (git-22.069.45071-03bb0e2) installed in root is up to date.
Package luci (git-20.074.84698-ead5e81) installed in root is up to date.
Package luci-base (git-22.304.65171-ec905e6) installed in root is up to date.
Configuring dnsmasq-full.
Collected errors:
 * resolve_conffiles: Existing conffile /etc/config/dhcp is different from the conffile in the new package. The new conffile will be placed at /etc/config/dhcp-opkg.
root@4f2ef91c5d81:/# 

download and install openclash.ipk

root@4f2ef91c5d81:/# opkg install luci-app-openclash_0.45.70-beta_all.ipk 
Installing luci-app-openclash (0.45.70-beta) to root...
Configuring luci-app-openclash.
cfg117882
root@4f2ef91c5d81:/# 

Somes like it's success, I restart the docker instance

Describe the Bug

after startup, I created a config file, all of other settings is default, then clicked Enable OpenClash.

2022-11-27 04:55:23 Step 6: Delete OpenClash Residue File...
2022-11-27 04:55:23 Step 5: Restart Dnsmasq...
2022-11-27 04:55:23 Step 4: Close The Clash Core Process...
2022-11-27 04:55:23 Step 3: Close The OpenClash Daemons...
2022-11-27 04:55:23 Step 2: Delete OpenClash Firewall Rules...
2022-11-27 04:55:23 Step 1: Backup The Current Groups State...
2022-11-27 04:55:23 OpenClash Stoping...
2022-11-27 04:55:20 Error: Get General 'redir-port' Option Error, OpenClash Can Not Start With Raw Config File
2022-11-27 04:55:18 Error: Get DNS 'enhanced-mode' Option Error, OpenClash Can Not Start With Raw Config File
2022-11-27 04:55:16 Error: Get DNS 'listen' Option Error, OpenClash Can Not Start With Raw Config File
2022-11-27 04:55:16 Error: OpenClash Can Not Start, Try Use Raw Config Restart Again...
2022-11-27 04:55:16 Step 6: Wait For The File Downloading...
2022-11-27 04:55:13 Step 5: Check The Core Status...
Unable to set capabilities [--caps=cap_sys_resource,cap_dac_override,cap_net_raw,cap_net_bind_service,cap_net_admin,cap_sys_ptrace+eip]
2022-11-27 04:55:12 Tip: No Special Configuration Detected, Use Dev Core to Start...
2022-11-27 04:55:12 Step 4: Start Running The Clash Core...
2022-11-27 04:55:11 Tip: You have seted the authentication of SOCKS5/HTTP(S) proxy with【Clash:itN9D7MN】
2022-11-27 04:55:11 Step 3: Modify The Config File...
2022-11-27 04:55:11 CN Domains List Update Successful!
2022-11-27 04:55:11 CN Domains List Has Been Updated, Starting To Replace The Old Version...
2022-11-27 04:55:11 CN Domains List Download Success, Check Updated...
2022-11-27 04:55:10 Start Downloading The CN Domains List...
2022-11-27 04:55:10 Chnroute6 Cidr List Update Successful!
2022-11-27 04:55:10 Chnroute6 Cidr List Has Been Updated, Starting To Replace The Old Version...
2022-11-27 04:55:10 Chnroute6 Cidr List Download Success, Check Updated...
2022-11-27 04:55:10 Start Downloading The Chnroute6 Cidr List...
2022-11-27 04:55:10 Chnroute Cidr List Update Successful!
2022-11-27 04:55:10 Chnroute Cidr List Has Been Updated, Starting To Replace The Old Version...
2022-11-27 04:55:09 Chnroute Cidr List Download Success, Check Updated...
2022-11-27 04:55:09 Start Downloading The Chnroute Cidr List...
2022-11-27 04:55:09 Tip: Detected that the Chnroute Cidr List Format is wrong, Ready to Reformat...
2022-11-27 04:55:09 Step 2: Check The Components...
2022-11-27 04:55:09 Step 1: Get The Configuration...
2022-11-27 04:55:09 OpenClash Start Running...
2022-11-27 04:55:09 Step 6: Delete OpenClash Residue File...
2022-11-27 04:55:09 Step 5: Restart Dnsmasq...
2022-11-27 04:55:09 Step 4: Close The Clash Core Process...
2022-11-27 04:55:09 Step 3: Close The OpenClash Daemons...
2022-11-27 04:55:09 Step 2: Delete OpenClash Firewall Rules...
2022-11-27 04:55:09 Step 1: Backup The Current Groups State...
2022-11-27 04:55:09 OpenClash Stoping...
2022-11-27 04:52:52 Step 6: Delete OpenClash Residue File...
2022-11-27 04:52:52 Step 5: Restart Dnsmasq...
2022-11-27 04:52:52 Step 4: Close The Clash Core Process...
2022-11-27 04:52:52 Step 3: Close The OpenClash Daemons...
2022-11-27 04:52:52 Step 2: Delete OpenClash Firewall Rules...
2022-11-27 04:52:52 Step 1: Backup The Current Groups State...
2022-11-27 04:52:52 OpenClash Stoping...
2022-11-27 04:52:52 【Dev】Core Update Successful!
2022-11-27 04:52:52 【Dev】Core Download Successful, Start Update...
2022-11-27 04:51:19【/tmp/clash.tar.gz】Download Failed:【curl: (28) Operation timed out after 30000 milliseconds with 720896 out of 2728919 bytes received】
2022-11-27 04:51:19【/tmp/clash.tar.gz】Download Failed:【curl: (28) Operation timed out after 30001 milliseconds with 1114112 out of 2728919 bytes received】
2022-11-27 04:51:19【/tmp/clash.tar.gz】Download Failed:【curl: (28) Operation timed out after 30000 milliseconds with 1114112 out of 2728919 bytes received】
2022-11-27 04:50:49【/tmp/clash.tar.gz】Download Failed:【curl: (28) Operation timed out after 30000 milliseconds with 575717 out of 2728919 bytes received】
2022-11-27 04:50:49 【Dev】Core Downloading, Please Try to Download and Upload Manually If Fails
2022-11-27 04:50:47 Tip: Detected that the Core is not Installed, Ready to Download...
2022-11-27 04:50:47 Step 2: Check The Components...
2022-11-27 04:50:47 Step 1: Get The Configuration...
2022-11-27 04:50:47 OpenClash Start Running...
2022-11-27 04:50:47 Step 6: Delete OpenClash Residue File...
2022-11-27 04:50:47 Step 5: Restart Dnsmasq...
2022-11-27 04:50:47 Step 4: Close The Clash Core Process...
2022-11-27 04:50:47 Step 3: Close The OpenClash Daemons...
2022-11-27 04:50:47 Step 2: Delete OpenClash Firewall Rules...
2022-11-27 04:50:47 Step 1: Backup The Current Groups State...
2022-11-27 04:50:47 OpenClash Stoping...
2022-11-27 04:45:03 Warning: OpenClash Now Disabled, Need Start From Luci Page, Exit...

OpenClash Log

2022-11-27 04:55:23 Step 6: Delete OpenClash Residue File... 2022-11-27 04:55:23 Step 5: Restart Dnsmasq... 2022-11-27 04:55:23 Step 4: Close The Clash Core Process... 2022-11-27 04:55:23 Step 3: Close The OpenClash Daemons... 2022-11-27 04:55:23 Step 2: Delete OpenClash Firewall Rules... 2022-11-27 04:55:23 Step 1: Backup The Current Groups State... 2022-11-27 04:55:23 OpenClash Stoping... 2022-11-27 04:55:20 Error: Get General 'redir-port' Option Error, OpenClash Can Not Start With Raw Config File 2022-11-27 04:55:18 Error: Get DNS 'enhanced-mode' Option Error, OpenClash Can Not Start With Raw Config File 2022-11-27 04:55:16 Error: Get DNS 'listen' Option Error, OpenClash Can Not Start With Raw Config File 2022-11-27 04:55:16 Error: OpenClash Can Not Start, Try Use Raw Config Restart Again... 2022-11-27 04:55:16 Step 6: Wait For The File Downloading... 2022-11-27 04:55:13 Step 5: Check The Core Status... Unable to set capabilities [--caps=cap_sys_resource,cap_dac_override,cap_net_raw,cap_net_bind_service,cap_net_admin,cap_sys_ptrace+eip] 2022-11-27 04:55:12 Tip: No Special Configuration Detected, Use Dev Core to Start... 2022-11-27 04:55:12 Step 4: Start Running The Clash Core... 2022-11-27 04:55:11 Tip: You have seted the authentication of SOCKS5/HTTP(S) proxy with【Clash:itN9D7MN】 2022-11-27 04:55:11 Step 3: Modify The Config File... 2022-11-27 04:55:11 CN Domains List Update Successful! 2022-11-27 04:55:11 CN Domains List Has Been Updated, Starting To Replace The Old Version... 2022-11-27 04:55:11 CN Domains List Download Success, Check Updated... 2022-11-27 04:55:10 Start Downloading The CN Domains List... 2022-11-27 04:55:10 Chnroute6 Cidr List Update Successful! 2022-11-27 04:55:10 Chnroute6 Cidr List Has Been Updated, Starting To Replace The Old Version... 2022-11-27 04:55:10 Chnroute6 Cidr List Download Success, Check Updated... 2022-11-27 04:55:10 Start Downloading The Chnroute6 Cidr List... 2022-11-27 04:55:10 Chnroute Cidr List Update Successful! 2022-11-27 04:55:10 Chnroute Cidr List Has Been Updated, Starting To Replace The Old Version... 2022-11-27 04:55:09 Chnroute Cidr List Download Success, Check Updated... 2022-11-27 04:55:09 Start Downloading The Chnroute Cidr List... 2022-11-27 04:55:09 Tip: Detected that the Chnroute Cidr List Format is wrong, Ready to Reformat... 2022-11-27 04:55:09 Step 2: Check The Components... 2022-11-27 04:55:09 Step 1: Get The Configuration... 2022-11-27 04:55:09 OpenClash Start Running... 2022-11-27 04:55:09 Step 6: Delete OpenClash Residue File... 2022-11-27 04:55:09 Step 5: Restart Dnsmasq... 2022-11-27 04:55:09 Step 4: Close The Clash Core Process... 2022-11-27 04:55:09 Step 3: Close The OpenClash Daemons... 2022-11-27 04:55:09 Step 2: Delete OpenClash Firewall Rules... 2022-11-27 04:55:09 Step 1: Backup The Current Groups State... 2022-11-27 04:55:09 OpenClash Stoping... 2022-11-27 04:52:52 Step 6: Delete OpenClash Residue File... 2022-11-27 04:52:52 Step 5: Restart Dnsmasq... 2022-11-27 04:52:52 Step 4: Close The Clash Core Process... 2022-11-27 04:52:52 Step 3: Close The OpenClash Daemons... 2022-11-27 04:52:52 Step 2: Delete OpenClash Firewall Rules... 2022-11-27 04:52:52 Step 1: Backup The Current Groups State... 2022-11-27 04:52:52 OpenClash Stoping... 2022-11-27 04:52:52 【Dev】Core Update Successful! 2022-11-27 04:52:52 【Dev】Core Download Successful, Start Update... 2022-11-27 04:51:19【/tmp/clash.tar.gz】Download Failed:【curl: (28) Operation timed out after 30000 milliseconds with 720896 out of 2728919 bytes received】 2022-11-27 04:51:19【/tmp/clash.tar.gz】Download Failed:【curl: (28) Operation timed out after 30001 milliseconds with 1114112 out of 2728919 bytes received】 2022-11-27 04:51:19【/tmp/clash.tar.gz】Download Failed:【curl: (28) Operation timed out after 30000 milliseconds with 1114112 out of 2728919 bytes received】 2022-11-27 04:50:49【/tmp/clash.tar.gz】Download Failed:【curl: (28) Operation timed out after 30000 milliseconds with 575717 out of 2728919 bytes received】 2022-11-27 04:50:49 【Dev】Core Downloading, Please Try to Download and Upload Manually If Fails 2022-11-27 04:50:47 Tip: Detected that the Core is not Installed, Ready to Download... 2022-11-27 04:50:47 Step 2: Check The Components... 2022-11-27 04:50:47 Step 1: Get The Configuration... 2022-11-27 04:50:47 OpenClash Start Running... 2022-11-27 04:50:47 Step 6: Delete OpenClash Residue File... 2022-11-27 04:50:47 Step 5: Restart Dnsmasq... 2022-11-27 04:50:47 Step 4: Close The Clash Core Process... 2022-11-27 04:50:47 Step 3: Close The OpenClash Daemons... 2022-11-27 04:50:47 Step 2: Delete OpenClash Firewall Rules... 2022-11-27 04:50:47 Step 1: Backup The Current Groups State... 2022-11-27 04:50:47 OpenClash Stoping... 2022-11-27 04:45:03 Warning: OpenClash Now Disabled, Need Start From Luci Page, Exit...

OpenClash Config

No response

Expected Behavior

What went wrong and how can I try. Thanks a lot.

Screenshots

No response

vernesong commented 1 year ago

For 22.03 openwrt

#nftables
opkg update
opkg install coreutils-nohup bash dnsmasq-full curl ca-certificates ipset ip-full libcap libcap-bin ruby ruby-yaml kmod-tun kmod-inet-diag unzip kmod-nft-tproxy luci-compat luci luci-base

issue:

Unable to set capabilities [--caps=cap_sys_resource,cap_dac_override,cap_net_raw,cap_net_bind_service,cap_net_admin,cap_sys_ptrace+eip]

You need to reinstall the libcap & libcap-bin

yusian commented 1 year ago

Thanks for your response, I reinstalled the libcap and libcap-bin but it doesn't work.

Except that, I can't install app in the Software view。 Screenshot from 2022-11-28 09-44-25

Is there something wrong in Docker or something configuration needs to be done? I installed everything fine in VirtualBox.

yusian commented 1 year ago

I'm sorry, It may be a problem with docker.

yangyaofei commented 1 year ago

I got same problem, bug I have a container without this problem.

But I forgot how to config that, I try to use that image but got same error.

Another thing different is that successful docker router using macnet not bridge

yangyaofei commented 1 year ago

@yusian I get success! the container need privilege

https://github.com/yangyaofei/docker-openclash you can see this

docker build -t openclash .
docker run --privileged openclash
github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days