我正在尝试安装在 QEMU 上运行的 Alpine Linux,但出现以下错误(我将错误消息标记为<===
):
localhost:~# setup-alpine
Available keyboard layouts:
...
Which timezone are you in? ('?' for list) [UTC]
* Starting busybox acpid ...
[ ok ]
* Starting busybox crond ...
[ ok ]
HTTP/FTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [none] http://192.0.2.1:8080
wget: server returned error: HTTP/1.0 403 Forbidden <===
r) Add random from the above list
f) Detect and add fastest mirror from above list
e) Edit /etc/apk/repositories with text editor
Enter mirror number (1-0) or URL to add (or r/f/e/done) [f]: f
Finding fastest mirror...
Warning! No mirror found <===
r) Add random from the above list
f) Detect and add fastest mirror from above list
e) Edit /etc/apk/repositories with text editor
Enter mirror number (1-0) or URL to add (or r/f/e/done) [f]: r
/sbin/setup-apkrepos: line 30: divide by zero <===
Which SSH server? ('openssh', 'dropbear' or 'none') [openssh]
* service sshd added to runlevel default
* Caching service dependencies ...
[ ok ]
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
* Starting sshd ...
[ ok ]
Available disks are:
sda (107.4 GB ATA QEMU HARDDISK )
Which disk(s) would you like to use? (or '?' for help or 'none') [none] sda
The following disk is selected:
sda (107.4 GB ATA QEMU HARDDISK )
How would you like to use it? ('sys', 'data', 'lvm' or '?' for help) [?] sys
ERROR: unsatisfiable constraints: <===
sfdisk (missing): <===
required by: world[sfdisk] <===
syslinux (missing): <===
required by: world[syslinux] <===
localhost:~#
看到/sbin/setup-apkrepos:30
(对应这里)和grep -rn wget /sbin/
,发现我办公室的代理服务器(http://192.0.2.1:8080
)403 Forbidden
在请求镜像列表时返回:
localhost:~# export http_proxy=http://192.0.2.1:8080; export https_proxy=http://192.0.2.1:8080; export ftp_proxy=http://192.0.2.1:8080
localhost:~# wget https://mirrors.alpinelinux.org/mirrors.txt
Connecting to 192.0.2.1:8080 (192.0.2.1:8080)
wget: server returned error: HTTP/1.0 403 Forbidden
localhost:~#
虽然我不是代理服务器的管理员,但有什么解决方法吗?
wget
您可以通过将环境变量设置为https://mirrors.alpinelinux.org/mirrors.txtMIRRORS
的内容来绕过,例如:这个解决方案是从源头推断出来的。