Debian Installer - 启动参数 - 镜像站点的一组信息配置 - mirror/http/hostname
问题:如下例是下载 Debian bookworm 的网络启动文件,再在当前 Linux 系统里用 kexec 启动。
wget http://ftp.cn.debian.org/debian/dists/bullseye/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz
wget http://ftp.cn.debian.org/debian/dists/bullseye/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux
kexec --command-line="priority=critical mirror/http/hostname=ftp.cn.debian.org interface=auto language=en country=US locale=en_US.UTF-8 keymap=us modules=network-console network-console/password=taobao925 network-console/password-again=taobao925 DEBIAN_FRONTEND=text" --initrd=initrd.gz linux
但在国内阿里云 ECS 里实践操作是失败的,sshd 没成功连接。查看 /var/log/syslog 日志,有如下的信息:
Feb 7 08:06:39 main-menu[259]: (process:1632): udhcpc: lease of 172.30.118.192 obtained from 172.30.127.253, lease time 315360000
Feb 7 08:06:39 main-menu[259]: INFO: Falling back to the package description for brltty-udeb
Feb 7 08:06:39 main-menu[259]: INFO: Falling back to the package description for brltty-udeb
Feb 7 08:06:39 main-menu[259]: INFO: Menu item 'choose-mirror' selected
Feb 7 08:06:39 anna-install: Queueing udeb apt-mirror-setup for later installation
Feb 7 08:06:39 choose-mirror[1719]: DEBUG: command: wget --no-verbose http://deb.debian.org/debian/dists/oldstable/Release -O - | grep -E '^(Suite|Codename|Architectures):'
Feb 7 08:08:50 choose-mirror[1719]: DEBUG: command: wget --no-verbose http://deb.debian.org/debian/dists/stable/Release -O - | grep -E '^(Suite|Codename|Architectures):'
Feb 7 08:08:53 choose-mirror[1719]: DEBUG: command: wget --no-verbose http://deb.debian.org/debian/dists/bookworm/Release -O - | grep -E '^(Suite|Codename|Architectures):'
Feb 7 08:08:59 choose-mirror[1719]: DEBUG: command: wget --no-verbose http://deb.debian.org/debian/dists/testing/Release -O - | grep -E '^(Suite|Codename|Architectures):'
Feb 7 08:11:09 choose-mirror[1719]: DEBUG: command: wget --no-verbose http://deb.debian.org/debian/dists/unstable/Release -O - | grep -E '^(Suite|Codename|Architectures):'
Feb 7 08:13:20 choose-mirror[1719]: INFO: suite/codename set to: stable/bookworm
Feb 7 08:13:20 choose-mirror[1719]: DEBUG: command: wget --no-verbose http://deb.debian.org/debian//dists/bookworm/main/binary-amd64/Release -O - | grep ^Architecture:
Feb 7 08:13:21 anna-install: Queueing udeb bookworm-support for later installation
Feb 7 08:13:21 main-menu[259]: (process:1712): failed: Connection timed out.
Feb 7 08:13:21 main-menu[259]: (process:1712): failed: Network is unreachable.
Feb 7 08:13:21 main-menu[259]: (process:1712): 2024-02-07 08:08:53 URL:http://deb.debian.org/debian/dists/stable/Release [149229/149229] -> "-" [1]
Feb 7 08:13:21 main-menu[259]: (process:1712): 2024-02-07 08:08:59 URL:http://deb.debian.org/debian/dists/bookworm/Release [149229/149229] -> "-" [1]
Feb 7 08:13:21 main-menu[259]: (process:1712): failed: Connection timed out.
Feb 7 08:13:21 main-menu[259]: (process:1712): failed: Network is unreachable.
Feb 7 08:13:21 main-menu[259]: (process:1712): failed: Connection timed out.
Feb 7 08:13:21 main-menu[259]: (process:1712): failed: Network is unreachable.
Feb 7 08:13:21 main-menu[259]: (process:1712): 2024-02-07 08:13:21 URL:http://deb.debian.org/debian//dists/bookworm/main/binary-amd64/Release [116/116] -> "-" [1]
Feb 7 08:13:21 main-menu[259]: INFO: Falling back to the package description for brltty-udeb
Feb 7 08:13:21 main-menu[259]: INFO: Falling back to the package description for brltty-udeb
Feb 7 08:13:21 main-menu[259]: INFO: Menu item 'download-installer' selected
Feb 7 08:13:21 net-retriever: regular: dists/bookworm/Release /tmp/net-retriever-1776-Release
Feb 7 08:15:31 anna[1774]: failed: Connection timed out.
Feb 7 08:15:31 anna[1774]: failed: Network is unreachable.
Feb 7 08:17:14 anna[1774]: WARNING **: bad d-i Packages file
大概是尝试连接默认的 deb.debian.org 仓库站失败了。搜索得, deb.debian.org 站是由 Fastly 提供的 CDN 站。估计,deb.debian.org 在国内访问有问题。但为什么启动参数里指定的 mirror/http/hostname=ftp.cn.debian.org 无效呢?查看 preseed 文件和说明举例,知道镜像站的配置是有几个参数必须同时指定,如 mirror/country=manual 和 mirror/http/directory=/debian。那么修改一下启动的参数,如 kexec --command-line="priority=critical mirror/country=manual mirror/http/hostname=ftp.cn.debian.org mirror/http/directory=/debian interface=auto locale=en_US.UTF-8 keymap=us modules=network-console network-console/password=taobao925 network-console/password-again=taobao925 DEBIAN_FRONTEND=text" --initrd=initrd.gz linux 就能达到安装时使用 ftp.cn.debian.org 的目的了。
参考:
- https://www.debian.org/releases/stable/i386/apbs02.zh-cn.html#idm3216
- https://www.debian.org/releases/stable/i386/apbs04.en.html
- https://www.debian.org/releases/bookworm/example-preseed.txt
- https://wiki.debian.org/DebianInstaller/FAQ#Q:_How_do_I_copy_d-i_logfiles_to_a_remote_host.3F
- https://deb.debian.org/