Closed Gaslys closed 1 month ago
脚本照计在alpine里会安装并使用 virt-what 替代 systemd-detect-virt ,不清楚为什么会出问题,你这样运行看看
wget -O sing-box.sh https://raw.githubusercontent.com/fscarmen/sing-box/main/sing-box.sh; sed -i '/clear/d' sing-box.sh; bash -x sing-box.sh
去到这个报错那里,把运行里的日志复制出来看看。
Varane:~# wget -O sing-box.sh https://raw.githubusercontent.com/fscarmen/sing-box/main/sing-box.sh; sed -i '/clear/d' sing-box.sh; bash -x sing-box.sh --2024-05-15 09:55:00-- https://raw.githubusercontent.com/fscarmen/sing-box/main/sing-box.sh Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 2606:50c0:8000::154, 2606:50c0:8001::154, 2606:50c0:8002::154, ... Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|2606:50c0:8000::154|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 155254 (152K) [text/plain] Saving to: 'sing-box.sh'
sing-box.sh 100%[===============================>] 151.62K --.-KB/s in 0.002s
2024-05-15 09:55:00 (87.5 MB/s) - 'sing-box.sh' saved [155254/155254]
echo -e '\033[33m\033[01m\n Language:\n 1. English (default) \n 2. 简体中文 \n\033[0m'
Language:
++ text 24 ++ grep -q '\$' ++ eval echo '${E[24]}' +++ echo Choose:
未全啊,还没有显示你报错那里的
+++ echo 'Language:\n' 1. English '(default)' '\n' 2. 简体中文
echo -e '\033[33m\033[01m\n Language:\n 1. English (default) \n 2. 简体中文 \n\033[0m'
Language:
++ text 24 ++ grep -q '\$' ++ eval echo '${E[24]}' +++ echo Choose:
reading ' Choose: ' LANGUAGE ++ info ' Choose: ' ++ echo -e '\033[32m\033[01m Choose: \033[0m'
read -rp ' Choose: ' LANGUAGE Choose:
'[' '' = 2 ']'
check_system_info ++ type -p systemd-detect-virt
'[' -x ']' ++ systemd-detect-virt sing-box.sh: line 606: systemd-detect-virt: command not found
VIRT=
'[' -s /etc/os-release ']' ++ awk -F '"' 'tolower($0) ~ /pretty_name/{print $2}' /etc/os-release
SYS='Alpine Linux edge'
[[ -z Alpine Linux edge ]]
[[ -z Alpine Linux edge ]]
[[ -z Alpine Linux edge ]]
[[ -z Alpine Linux edge ]]
[[ -z Alpine Linux edge ]]
REGEX=("debian" "ubuntu" "centos|red hat|kernel|alma|rocky" "arch linux" "alpine" "fedora")
RELEASE=("Debian" "Ubuntu" "CentOS" "Arch" "Alpine" "Fedora")
EXCLUDE=("")
MAJOR=("9" "16" "7" "3" "" "37")
PACKAGE_UPDATE=("apt -y update" "apt -y update" "yum -y update --skip-broken" "pacman -Sy" "apk update -f" "dnf -y update")
PACKAGE_INSTALL=("apt -y install" "apt -y install" "yum -y install" "pacman -S --noconfirm" "apk add --no-cache" "dnf -y install")
PACKAGE_UNINSTALL=("apt -y autoremove" "apt -y autoremove" "yum -y autoremove" "pacman -Rcnsu --noconfirm" "apk del -f" "dnf -y autoremove")
for int in "${!REGEX[@]}"
[[ alpine linux edge =~ debian ]]
for int in "${!REGEX[@]}"
[[ alpine linux edge =~ ubuntu ]]
for int in "${!REGEX[@]}"
[[ alpine linux edge =~ centos|red hat|kernel|alma|rocky ]]
for int in "${!REGEX[@]}"
[[ alpine linux edge =~ arch linux ]]
for int in "${!REGEX[@]}"
[[ alpine linux edge =~ alpine ]]
SYSTEM=Alpine
break
'[' -z Alpine ']'
for ex in "${EXCLUDE[@]}"
[[ ! {Alpine Linux edge,,} =~ '' ]]
'[' Alpine = CentOS ']'
ALL_PARAMETER=($(sed -E 's/(-c|-e|-C|-E) //; s/=([^"])/ \1/g; s/sudo cloudflared service install //' <<< $*)) ++ sed -E 's/(-c|-e|-C|-E) //; s/=([^"])/ \1/g; s/sudo cloudflared service install //'
[[ 0 > 13 ]]
check_root ++ id -u
'[' 0 '!=' 0 ']'
check_arch
case "$(uname -m)" in ++ uname -m ++ awk -F : '/flags/{print $2; exit}' /proc/cpuinfo
[[ fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm rep_good nopl cpuid extd_apicid tsc_known_freq pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt sha_ni xsaveopt xsavec xgetbv1 arat =~ avx2 ]]
SING_BOX_ARCH=amd64v3
JQ_ARCH=amd64
QRENCODE_ARCH=amd64
ARGO_ARCH=amd64
check_system_info ++ type -p systemd-detect-virt
'[' -x ']' ++ systemd-detect-virt sing-box.sh: line 606: systemd-detect-virt: command not found
VIRT=
'[' -s /etc/os-release ']' ++ awk -F '"' 'tolower($0) ~ /pretty_name/{print $2}' /etc/os-release
SYS='Alpine Linux edge'
[[ -z Alpine Linux edge ]]
[[ -z Alpine Linux edge ]]
[[ -z Alpine Linux edge ]]
[[ -z Alpine Linux edge ]]
[[ -z Alpine Linux edge ]]
REGEX=("debian" "ubuntu" "centos|red hat|kernel|alma|rocky" "arch linux" "alpine" "fedora")
RELEASE=("Debian" "Ubuntu" "CentOS" "Arch" "Alpine" "Fedora")
EXCLUDE=("")
MAJOR=("9" "16" "7" "3" "" "37")
PACKAGE_UPDATE=("apt -y update" "apt -y update" "yum -y update --skip-broken" "pacman -Sy" "apk update -f" "dnf -y update")
PACKAGE_INSTALL=("apt -y install" "apt -y install" "yum -y install" "pacman -S --noconfirm" "apk add --no-cache" "dnf -y install")
PACKAGE_UNINSTALL=("apt -y autoremove" "apt -y autoremove" "yum -y autoremove" "pacman -Rcnsu --noconfirm" "apk del -f" "dnf -y autoremove")
for int in "${!REGEX[@]}"
[[ alpine linux edge =~ debian ]]
for int in "${!REGEX[@]}"
[[ alpine linux edge =~ ubuntu ]]
for int in "${!REGEX[@]}"
[[ alpine linux edge =~ centos|red hat|kernel|alma|rocky ]]
for int in "${!REGEX[@]}"
[[ alpine linux edge =~ arch linux ]]
for int in "${!REGEX[@]}"
[[ alpine linux edge =~ alpine ]]
SYSTEM=Alpine
break
'[' -z Alpine ']'
for ex in "${EXCLUDE[@]}"
[[ ! {Alpine Linux edge,,} =~ '' ]]
'[' Alpine = CentOS ']'
check_dependencies
'[' Alpine = Alpine ']' ++ ++ wget head -n 1
local 'CHECK_WGET=wget: missing URL'
grep -qi busybox
DEPS_CHECK=('bash' 'rc-update' 'virt-what' 'python3' 'iptables' 'ip6tables')
local DEPS_CHECK
DEPS_INSTALL=('bash' 'openrc' 'virt-what' 'python3' 'iptables' 'ip6tables')
local DEPS_INSTALL
for g in "${!DEPS_CHECK[@]}" ++ type -p bash
'[' '!' -x /bin/bash ']'
for g in "${!DEPS_CHECK[@]}" ++ type -p rc-update
'[' '!' -x /sbin/rc-update ']'
for g in "${!DEPS_CHECK[@]}" ++ type -p virt-what
'[' '!' -x /usr/sbin/virt-what ']'
for g in "${!DEPS_CHECK[@]}" ++ type -p python3
'[' '!' -x /usr/bin/python3 ']'
for g in "${!DEPS_CHECK[@]}" ++ type -p iptables
'[' '!' -x /sbin/iptables ']'
for g in "${!DEPS_CHECK[@]}" ++ type -p ip6tables
'[' '!' -x /sbin/ip6tables ']'
'[' 0 -ge 1 ']' ++ type -p systemctl
'[' '!' -x /bin/systemctl ']'
DEPS_CHECK=('wget' 'tar' 'systemctl' 'ss' 'bash' 'openssl')
local DEPS_CHECK
DEPS_INSTALL=('wget' 'tar' 'systemctl' 'iproute2' 'bash' 'openssl')
local DEPS_INSTALL
for g in "${!DEPS_CHECK[@]}" ++ type -p wget
'[' '!' -x /usr/bin/wget ']'
for g in "${!DEPS_CHECK[@]}" ++ type -p tar
'[' '!' -x /bin/tar ']'
for g in "${!DEPS_CHECK[@]}" ++ type -p systemctl
'[' '!' -x /bin/systemctl ']'
for g in "${!DEPS_CHECK[@]}" ++ type -p ss
'[' '!' -x /sbin/ss ']'
for g in "${!DEPS_CHECK[@]}" ++ type -p bash
'[' '!' -x /bin/bash ']'
for g in "${!DEPS_CHECK[@]}" ++ type -p openssl
'[' '!' -x /usr/bin/openssl ']'
'[' '' = CentOS7 ']'
'[' '' = CentOS8 ']' ++ type -p iptables
'[' '!' -x /sbin/iptables ']' ++ type -p ip6tables
'[' '!' -x /sbin/ip6tables ']'
[[ 0 > 0 ]] ++ text 8 ++ grep -q '\$' ++ eval echo '${E[8]}' +++ echo All dependencies already exist and do not need to be installed additionally.
info '\n All dependencies already exist and do not need to be installed additionally. \n'
echo -e '\033[32m\033[01m\n All dependencies already exist and do not need to be installed additionally. \n\033[0m'
All dependencies already exist and do not need to be installed additionally.
check_system_ip ++ ++ ip route show default awk '/default/ {for (i=0; i<NF; i++) if ($i=="dev") {print $(i+1); exit}}'
local DEFAULT_LOCAL_INTERFACE=eth0
'[' -n eth0 ']' ++ ++ ip addr show eth0 sed -n 's#.inet ([^/]+)/[0-9]+.global.*#\1#gp'
local DEFAULT_LOCAL_IP4=185.151.146.163 ++ ++ ip addr show eth0 sed -n 's#.inet6 ([^/]+)/[0-9]+.global.*#\1#gp'
local DEFAULT_LOCAL_IP6=2407:d840:51:1::95
'[' -n 185.151.146.163 ']'
local BIND_ADDRESS4=--bind-address=185.151.146.163
'[' -n 2407:d840:51:1::95 ']'
local BIND_ADDRESS6=--bind-address=2407:d840:51:1::95 ++ wget -4 --bind-address=185.151.146.163 -qO- --bind-address=185.151.146.163 --no-check-certificate --user-agent=Mozilla --tries=2 --timeout=1 http://ip-api.com/json/
IP4='{"status":"success","country":"Singapore","countryCode":"SG","region":"03","regionName":"North West","city":"Singapore","zip":"858877","lat":1.35208,"lon":103.82,"timezone":"Asia/Singapore","isp":"WAP.AC LTD","org":"FatDisco Ltd","as":"AS198100 WAP.AC LTD","query":"185.151.146.163"}' ++ expr '{"status":"success","country":"Singapore","countryCode":"SG","region":"03","regionName":"North West","city":"Singapore","zip":"858877","lat":1.35208,"lon":103.82,"timezone":"Asia/Singapore","isp":"WAP.AC LTD","org":"FatDisco Ltd","as":"AS198100 WAP.AC LTD","query":"185.151.146.163"}' : '.query\":[ ]\"([^"]).'
WAN4=185.151.146.163 ++ expr '{"status":"success","country":"Singapore","countryCode":"SG","region":"03","regionName":"North West","city":"Singapore","zip":"858877","lat":1.35208,"lon":103.82,"timezone":"Asia/Singapore","isp":"WAP.AC LTD","org":"FatDisco Ltd","as":"AS198100 WAP.AC LTD","query":"185.151.146.163"}' : '.country\":[ ]\"([^"]).'
COUNTRY4=Singapore ++ expr '{"status":"success","country":"Singapore","countryCode":"SG","region":"03","regionName":"North West","city":"Singapore","zip":"858877","lat":1.35208,"lon":103.82,"timezone":"Asia/Singapore","isp":"WAP.AC LTD","org":"FatDisco Ltd","as":"AS198100 WAP.AC LTD","query":"185.151.146.163"}' : '.isp\":[ ]\"([^"]).'
ASNORG4='WAP.AC LTD'
[[ E = C ]] ++ wget -6 --bind-address=2407:d840:51:1::95 -qO- --bind-address=2407:d840:51:1::95 --no-check-certificate --user-agent=Mozilla --tries=2 --timeout=1 https://api.ip.sb/geoip
IP6='{"organization":"Nearoute","longitude":103.8014,"timezone":"Asia\/Singapore","isp":"Nearoute","offset":28800,"asn":51847,"asn_organization":"Nearoute Limited","country":"Singapore","ip":"2407:d840:51:1::95","latitude":1.3673,"continent_code":"AS","country_code":"SG"}' ++ expr '{"organization":"Nearoute","longitude":103.8014,"timezone":"Asia\/Singapore","isp":"Nearoute","offset":28800,"asn":51847,"asn_organization":"Nearoute Limited","country":"Singapore","ip":"2407:d840:51:1::95","latitude":1.3673,"continent_code":"AS","country_code":"SG"}' : '.ip\":[ ]\"([^"]).'
WAN6=2407:d840:51:1::95 ++ expr '{"organization":"Nearoute","longitude":103.8014,"timezone":"Asia\/Singapore","isp":"Nearoute","offset":28800,"asn":51847,"asn_organization":"Nearoute Limited","country":"Singapore","ip":"2407:d840:51:1::95","latitude":1.3673,"continent_code":"AS","country_code":"SG"}' : '.country\":[ ]\"([^"]).'
COUNTRY6=Singapore ++ expr '{"organization":"Nearoute","longitude":103.8014,"timezone":"Asia\/Singapore","isp":"Nearoute","offset":28800,"asn":51847,"asn_organization":"Nearoute Limited","country":"Singapore","ip":"2407:d840:51:1::95","latitude":1.3673,"continent_code":"AS","country_code":"SG"}' : '.isp\":[ ]\"([^"]).'
ASNORG6=Nearoute
[[ E = C ]]
check_install
[[ '' = \i\s_\s\u\b ]]
[[ -s /etc/sing-box/subscribe/qr ]]
IS_SUB=no_sub
ls '/etc/sing-box/conf/*hysteria2_inbounds.json'
'[' -s /etc/systemd/system/sing-box.service ']' ++ text 26 ++ grep -q '\$' ++ eval echo '${E[26]}' +++ echo Not install
STATUS[0]='Not install' ++ text 26 ++ grep -q '\$' ++ eval echo '${E[26]}' +++ echo Not install
'[' 'Not install' = 'Not install' ']'
'[' '!' -s /etc/sing-box/sing-box ']'
'[' '' '!=' noninteractive_install ']' ++ text 26 ++ grep -q '\$' ++ wget --no-check-certificate --tries=2 --timeout=3 -qO- https://api.github.com/repos/SagerNet/sing-box/releases ++ awk -F '["v-]' '/tag_name/{print $5}' ++ sort -r ++ eval echo '${E[26]}' +++ echo Not install ++ sed -n 1p
STATUS[1]='Not install'
IS_ARGO=no_argo
'[' -s /etc/systemd/system/argo.service ']'
'[' -s /etc/systemd/system/argo.service ']'
'[' '' = noninteractive_install ']'
menu_setting ++ text 27 ++ grep -q '\$' ++ text 26 ++ grep -q '\$' ++ eval echo '${E[27]}' +++ echo close ++ eval echo '${E[26]}' +++ echo Not install ++ text 28 ++ grep -q '\$'
[[ Not install = \N\o\t\ \i\n\s\t\a\l\l ]]
'[' '!' -s /etc/sing-box/cloudflared ']'
wget --no-check-certificate -qO /tmp/sing-box/cloudflared https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 ++ eval echo '${E[28]}' +++ echo open
[[ Not install =~ close|open ]] ++ text 34 ++ grep -q '\$' ++ eval echo '${E[34]}' +++ echo Install Sing-box ++ text 80 ++ grep -q '\$' ++ eval echo '${E[80]}' +++ echo subscribe ++ text 89 ++ grep -q '\$' ++ eval echo '${E[89]}' +++ echo '(' Additional dependencies: nginx ')'
OPTION[1]='1. Install Sing-box + Argo + subscribe ( Additional dependencies: nginx )' ++ text 34 ++ grep -q '\$' ++ eval echo '${E[34]}' +++ echo Install Sing-box ++ text 89 ++ grep -q '\$' ++ eval echo '${E[89]}' +++ echo '(' Additional dependencies: nginx ')'
OPTION[2]='2. Install Sing-box + Argo ( Additional dependencies: nginx )' ++ text 34 ++ grep -q '\$' ++ eval echo '${E[34]}' +++ echo Install Sing-box ++ text 80 ++ grep -q '\$' ++ eval echo '${E[80]}' +++ echo subscribe ++ text 89 ++ grep -q '\$' ++ eval echo '${E[89]}' +++ echo '(' Additional dependencies: nginx ')'
OPTION[3]='3. Install Sing-box + subscribe ( Additional dependencies: nginx )' ++ text 34 ++ grep -q '\$' ++ eval echo '${E[34]}' +++ echo Install Sing-box
OPTION[4]='4. Install Sing-box' ++ text 32 ++ grep -q '\$' ++ eval echo '${E[32]}' +++ echo Upgrade kernel, turn on BBR, change Linux system '(sb' '-b)'
OPTION[5]='5. Upgrade kernel, turn on BBR, change Linux system (sb -b)' ++ text 59 ++ grep -q '\$' ++ eval echo '${E[59]}' +++ echo Install ArgoX scripts '(argo' + 'xray)' '[https://github.com/fscarmen/argox]'
OPTION[6]='6. Install ArgoX scripts (argo + xray) [https://github.com/fscarmen/argox]' ++ text 69 ++ grep -q '\$' ++ eval echo '${E[69]}' +++ echo Install sba scripts '(argo' + 'sing-box)' '[https://github.com/fscarmen/sba]'
OPTION[7]='7. Install sba scripts (argo + sing-box) [https://github.com/fscarmen/sba]' ++ text 76 ++ grep -q '\$' ++ eval echo '${E[76]}' +++ echo Install TCP brutal
OPTION[8]='8. Install TCP brutal'
'[' 8 -ge 10 ']' ++ text 35 ++ grep -q '\$' ++ eval echo '${E[35]}' +++ echo Exit
OPTION[0]='0. Exit'
menu
++ text 17 ++ grep -q '\$' ++ eval echo '${E[17]}' +++ echo Version ++ text 18 ++ grep -q '\$' ++ eval echo '${E[18]}' +++ echo New features ++ text 1 ++ grep -q '\$' ++ eval echo '${E[1]}' +++ echo Add hysteria2 port hopping. Supported Clients: ShadowRocket / NekoBox / Clash ++ text 19 ++ grep -q '\$' ++ eval echo '${E[19]}' +++ echo System infomation ++ text 20 ++ grep -q '\$' ++ eval echo '${E[20]}' +++ echo Operating System ++ text 21 ++ grep -q '\$' ++ eval echo '${E[21]}' +++ echo Kernel ++ uname -r ++ text 22 ++ grep -q '\$' ++ eval echo '${E[22]}' +++ echo Architecture ++ text 23 ++ grep -q '\$' ++ eval echo '${E[23]}' +++ echo Virtualization
======================================================================================================================
read -rp ' Choose: ' CHOOSE
Choose: + local VERSION_LATEST=1.9.0 ++ ++ wget --no-check-certificate --tries=2 --timeout=3 -qO- https://api.github.com/repos/SagerNet/sing-box/releases awk -F '["v]' -v 'var=tag_name.*1.9.0' '$0 ~ var {print $5; exit}'
找到原因了,你稍等我10分钟,我更新一下脚本。
已更新了,你再运行一下看看。
已解决 非常感谢