标签 debian 下的文章

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 的目的了。

参考:

使用 grub4dos 来引导硬盘上的 grml.iso livecd - debian

需求:将 LiveCD grml.iso 保存在 ntfs 分区上,使用 grub4dos 来引导,加载 grml.iso 文件。

本例,硬盘是 MBR 分区,只有一个 NTFS 分区,已经安装有 Windows 22H2。grml.iso 保存在 C:\iso\grml.iso。

尝试:

  1. 先安装 grub4dos, 将 grub4dos ,用 bcdedit 将 grub4dos 添加到启动菜单中
  2. 这里的 C:\menu.lst 文件内容,其中 findiso 参数是让它能在设备中查找iso文件,toram=grml.squashfs 是避免 ntfs-3g 自动将 ntfs 分区挂载为“可读写”,导致重启或关机时会挂死

    title grml
    find --set-root --ignore-floppies --ignore-cd /iso/grml.iso
    map /iso/grml.iso (0xff)
    map --hook
    set opts=" toram=grml.squashfs dns=8.8.8.8 ip=192.168.1.108::192.168.1.1:255.255.255.0:testbox:eth0:off ssh=mima "
    kernel (0xff)/boot/grml/vmlinuz apm=power-off boot=live live-media-path=/live/grml/ bootid=grml001 findiso=/iso/grml.iso  nomce net.ifnames=0 %opts%
    initrd (0xff)/boot/grml/initrd.img
    map --unhook
    boot
    savedefault --wait=2

参考:

testdisk 恢复磁盘分区后无法进入系统 - 1234F: - 错误

现象:一台机子,在 fdisk 里查看,没有分区。尝试使用 testdisk,盲猜是 gpt 分区类型,自动分析出有三个分区。写入、保存磁盘分区信息后,机子无法自动引导到操作系统,提示 1234F:

尝试:估计磁盘的原有分区是 mbr ,并不是 gpt ,因为里边没有 EFI 分区,且原系统中,没有 efi 相关的文件。然后再次运行 testdisk ,将分区信息保存为 mbr 。再次重启机子,依然是 1234F: ,无法引导系统。最后,在急救系统里,grub-install 到磁盘,重新安装 grub 。之后,就可以看到 grub 的引导信息,顺利进入到 debian 系统了。

参考:

debian 12.2系统里安装 iredmail-enterprise-1.0-beta1-linux-amd64 的两个问题

尝试在debian 12.2系统里安装 iredmail-enterprise-1.0-beta1-linux-amd64。发现有两个问题:

  1. web安装程序报错。搜索得,ntp 包对应的服务名是 ntpsec ,不是ntp 。 服务配置文件是:/lib/systemd/system/ntpsec.service
    TASK [ntp] Install ntp/chrony server to sync local time.
    ok: ntp

    TASK [ntp] Enable and restart ntp/chrony service.
    failed: ntp
    [ERROR] task error: failed in restarting service ntp: exit status 5, Failed to restart ntp.service: Unit ntp.service not found.

  2. 通过web/admin 管理添加的用户,外网发信到这个用户会报错:said: 550 5.1.1 mailto:liu@iredmail.anqun.org: Recipient address rejected: User unknown (in reply to RCPT TO command) 这个用户是能登录到 roundcube。从服务器的shell里,也能通过命令行成功发信。作为对比,用web/iredadmin添加的用户,正常。删除之前报错的域,重新使用iredadmin添加回同一个域和用户,能从外网收信。尝试的解决方法是手动补上缺失的 forwardings 表内容:
    INSERT INTO forwardings (address, forwarding, domain, dest_domain, is_forwarding)
    VALUES ('liu@iredmail.anqun.org', 'liu@iredmail.anqun.org','iredmail.anqun.org', 'iredmail.anqun.org', 1);

参考:

在grml debian 的 livecd overlay 文件系统里启动 mariadb-server

问题:在 grml 的急救系统里无法启动 mariadb-server,报错:/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=killed, signal=ABRT)

尝试:在 mysqld 的配置内容中,增加一行 innodb_flush_method = fsync

参考: