Skip to content

使用参数指定debian的源为阿里云后会出现的问题 #16

@rayblade

Description

@rayblade

使用参数指定debian的源为阿里云后,我这里出现了两个问题:
./apt-proxy --debian=cn:aliyun

1、无法加速security.debian.org开头的源
复现:
1、使用http_proxy=http://10.0.0.185:3142 apt-get -o pkgProblemResolver=true -o Acquire::http=true update更新源,能顺利通过。
2、使用http_proxy=http://10.0.0.185:3142 apt-get -o pkgProblemResolver=true -o Acquire::http=true install -y ffmpeg安装ffmpeg,deb.debian.org开头的源能顺利加速,security.debian.org开头的源加速失败,会在原地址缓慢下载包,最终安装成功。
apt-proxy部分日志如下:
2022/12/07 04:06:18 rewrote "http://deb.debian.org/debian/pool/main/x/xdg-user-dirs/xdg-user-dirs_0.17-2_amd64.deb" to "http://mirrors.aliyun.com/debian/pool/main/x/xdg-user-dirs/xdg-user-dirs_0.17-2_amd64.deb"
2022/12/07 04:06:18 172.17.0.1 "GET http://mirrors.aliyun.com/debian/pool/main/x/xdg-user-dirs/xdg-user-dirs_0.17-2_amd64.deb HTTP/1.1" (OK) 53788 MISS 126.554951ms
2022/12/07 04:06:50 172.17.0.1 "GET http://security.debian.org/debian-security/pool/updates/main/f/ffmpeg/libavcodec58_4.3.5-0%2bdeb11u1_amd64.deb HTTP/1.1" (OK) 4959652 MISS 2m29.051140757s
2022/12/07 04:07:48 172.17.0.1 "GET http://security.debian.org/debian-security/pool/updates/main/f/ffmpeg/libavformat58_4.3.5-0%2bdeb11u1_amd64.deb HTTP/1.1" (OK) 1054556 MISS 58.466707427s
2022/12/07 04:07:49 172.17.0.1 "GET http://security.debian.org/debian-security/pool/updates/main/f/ffmpeg/libpostproc55_4.3.5-0%2bdeb11u1_amd64.deb HTTP/1.1" (OK) 106644 MISS 1.20467607s
2022/12/07 04:07:57 172.17.0.1 "GET http://security.debian.org/debian-security/pool/updates/main/f/ffmpeg/libswscale5_4.3.5-0%2bdeb11u1_amd64.deb HTTP/1.1" (OK) 210156 MISS 7.871805842s

2、第二次使用apt-proxy更新源会失败
复现
1、新建一个debian镜像
2、使用http_proxy=http://10.0.0.185:3142 apt-get -o pkgProblemResolver=true -o Acquire::http=true update更新源,提示成功。
3、删除debian镜像,再新建一个debain镜像
4、使用http_proxy=http://10.0.0.185:3142 apt-get -o pkgProblemResolver=true -o Acquire::http=true update更新源,提示失败。
日志如下:
root@0a327c4a465e:/# http_proxy=http://10.0.0.185:3142 apt-get -o pkgProblemResolver=true -o Acquire::http=true update
Get:1 http://deb.debian.org/debian bullseye InRelease
Get:2 http://security.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Get:3 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [209 kB]
Err:1 http://deb.debian.org/debian bullseye InRelease
Undetermined Error [IP: 10.0.0.185 3142]
Get:4 http://deb.debian.org/debian bullseye-updates InRelease
Err:4 http://deb.debian.org/debian bullseye-updates InRelease
Undetermined Error [IP: 10.0.0.185 3142]
Fetched 257 kB in 10s (25.6 kB/s)
Reading package lists... Done
W: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease Undetermined Error [IP: 10.0.0.185 3142]
W: Failed to fetch http://deb.debian.org/debian/dists/bullseye-updates/InRelease Undetermined Error [IP: 10.0.0.185 3142]
W: Some index files failed to download. They have been ignored, or old ones used instead.
apt-proxy日志如下:
./apt-proxy --debian=cn:aliyun
2022/12/07 05:26:31 running apt-proxy
2022/12/07 05:26:31 using specify Debian mirror http://mirrors.aliyun.com/debian/
2022/12/07 05:26:31 proxy listening on 0.0.0.0:3142
2022/12/07 05:26:31 Program has been started 🚀
2022/12/07 05:27:10 rewrote "http://deb.debian.org/debian/dists/bullseye/InRelease" to "http://mirrors.aliyun.com/debian/dists/bullseye/InRelease"
2022/12/07 05:27:10 172.17.0.1 "GET http://mirrors.aliyun.com/debian/dists/bullseye/InRelease HTTP/1.1" (OK) 0 HIT 377.218µs
2022/12/07 05:27:11 172.17.0.1 "GET http://security.debian.org/debian-security/dists/bullseye-security/InRelease HTTP/1.1" (OK) 48374 SKIP 575.046574ms
2022/12/07 05:27:15 rewrote "http://deb.debian.org/debian/dists/bullseye-updates/InRelease" to "http://mirrors.aliyun.com/debian/dists/bullseye-updates/InRelease"
2022/12/07 05:27:15 172.17.0.1 "GET http://mirrors.aliyun.com/debian/dists/bullseye-updates/InRelease HTTP/1.1" (OK) 0 HIT 326.898µs
2022/12/07 05:27:18 172.17.0.1 "GET http://security.debian.org/debian-security/dists/bullseye-security/main/binary-amd64/by-hash/SHA256/d2f17fdd2e03844ff2fcd5f3d7589011522b7d61868b27f2a20e2a37698d1fa8 HTTP/1.1" (OK) 208600 SKIP 7.397849648s

并且apt install时有时会退出
apt-proxy日志如下:
2022/12/07 14:09:50 172.17.0.1 "GET http://security.debian.org/debian-security/pool/updates/main/f/ffmpeg/libavresample4_4.3.5-0%2bdeb11u1_amd64.deb HTTP/1.1" (OK) 105364 MISS 1.827807374s
panic: net/http: abort Handler

goroutine 2496 [running]:
net/http/httputil.(*ReverseProxy).ServeHTTP(0xc0001acf00, {0x79efb8?, 0xc0000638c0}, 0xc000232500)
/opt/hostedtoolcache/go/1.19.3/x64/src/net/http/httputil/reverseproxy.go:363 +0xee9
github.com/soulteary/apt-proxy/pkg/httpcache.(*Handler).passUpstream.func1()
/home/runner/work/apt-proxy/apt-proxy/pkg/httpcache/handler.go:253 +0x3d
created by github.com/soulteary/apt-proxy/pkg/httpcache.(*Handler).passUpstream
/home/runner/work/apt-proxy/apt-proxy/pkg/httpcache/handler.go:252 +0x1fb

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions