我使用 .pcengines.ch (apu2) 硬件并设置了 pxe 环境自动安装,可与 ubuntu-20.04.3-live-server-amd64.iso 配合使用,但升级到 ubuntu-20.04.4-live-server-amd64.iso 时失败。
ubuntu-20.04.3-live-server-amd64.iso 的 www-server 日志:
2022/07/26 11:52:59 [notice] 1#1: start worker process 27
192.168.41.20 - - [26/Jul/2022:11:54:16 +0000] "GET /ksfiles/ubuntu-20.04.3-live-server-amd64.iso HTTP/1.1" 200 1261371392 "-" "Wget" "-"
192.168.41.20 - - [26/Jul/2022:11:55:23 +0000] "GET /ksfiles/ubuntu-20.04.3-live-server-amd64.iso HTTP/1.1" 200 1261371392 "-" "Cloud-Init/21.2-3-g899bfaa9-0ubuntu2~20.04.1" "-"
192.168.41.20 - - [26/Jul/2022:11:56:03 +0000] "GET /ksfiles/ubuntu-20.04.3-live-server-amd64.iso HTTP/1.1" 200 1261371392 "-" "Cloud-Init/21.2-3-g899bfaa9-0ubuntu2~20.04.1" "-"
192.168.41.20 - - [26/Jul/2022:11:56:08 +0000] "GET /ksfiles/apu21/meta-data HTTP/1.1" 200 0 "-" "Cloud-Init/21.2-3-g899bfaa9-0ubuntu2~20.04.1" "-"
192.168.41.20 - - [26/Jul/2022:11:56:08 +0000] "GET /ksfiles/apu21/user-data HTTP/1.1" 200 1916 "-" "Cloud-Init/21.2-3-g899bfaa9-0ubuntu2~20.04.1" "-"
192.168.41.20 - - [26/Jul/2022:11:56:08 +0000] "GET /ksfiles/apu21/vendor-data HTTP/1.1" 301 169 "-" "Cloud-Init/21.2-3-g899bfaa9-0ubuntu2~20.04.1" "-"
192.168.41.20 - - [26/Jul/2022:11:56:08 +0000] "GET /ksfiles/apu21/vendor-data/ HTTP/1.1" 200 198 "-" "Cloud-Init/21.2-3-g899bfaa9-0ubuntu2~20.04.1" "-"
ubuntu-20.04.4-live-server-amd64.iso 的 www-server 日志:
192.168.41.20 - - [26/Jul/2022:12:24:49 +0000] "GET /ksfiles/ubuntu-20.04.4-live-server-amd64.iso HTTP/1.1" 200 1331691520 "-" "Wget" "-"
192.168.41.20 - - [26/Jul/2022:12:25:59 +0000] "GET /ksfiles/ubuntu-20.04.4-live-server-amd64.iso HTTP/1.1" 200 1331691520 "-" "Cloud-Init/21.4-0ubuntu1~20.04.1" "-"
192.168.41.20 - - [26/Jul/2022:12:26:36 +0000] "GET /ksfiles/ubuntu-20.04.4-live-server-amd64.iso HTTP/1.1" 200 1331691520 "-" "Cloud-Init/21.4-0ubuntu1~20.04.1" "-"
我在控制台的启动日志中发现错误消息:
[ OK ] Reached target Host and Network Name Lookups.
[ 138.071529] Out of memory: Killed process 1125 (cloud-init) total-vm:2661804kB, anon-rss:2475148kB, file-rss:2784kB, shmem-rss:0kB, UID:0 pgtables:4916kB oom_score_adj:0
[FAILED] Failed to start Initial cl…ob (metadata service crawler).
See 'systemctl status cloud-init.service' for details.
我的 pxe 配置文件如下:pxelinux.cfg/01-XX-XX-XX-XX-XX-XX 的内容:
DEFAULT install
LABEL install
KERNEL vmlinuz
INITRD initrd
APPEND root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url=http://192.168.41.5/ksfiles/ubuntu-20.04.4-live-server-amd64.iso autoinstall ds=nocloud-net;s=http://192.168.41.5/ksfiles/apu21/ console=ttyS0,115200n8 earlyprint=serial,ttyS0,115200
在我看来,cloud-init 进程似乎是由于 OOM 在启动过程中被终止的。20.04.03 和 20.04.04 之间有显著差异吗?我该如何解决这个问题?
答案1
这显然是内存不足的问题。减少内存需求的一个简单方法是将APPEND
参数添加到行中cloud-config-url=/dev/null
。此参数将防止 iso 被下载cloud-init
两次。
借助该cloud-config-url
参数,我能够可靠地通过 PXE 自动安装具有 2GB RAM 的 20.04(我相信这包括 20.04.4),以及具有 3GB RAM 的 22.04。少于这个数量的 RAM 往往不可靠。
也可以看看
答案2
我的硬件有 4 GB——不应该是一般的内存问题......
我将 APPEND 参数更改为
APPEND root=/dev/ram0 ramdisk_size=2000000 fsck.mode=skip ip=dhcp url=http://192.168.41.5/ksfiles/ubuntu-20.04.4-live-server-amd64.iso autoinstall ds=nocloud-net cloud-config-url=http://192.168.41.5/ksfiles/apu21/user-data s=http://192.168.41.5/ksfiles/apu21 console=ttyS0,115200n8 earlyprint=serial,ttyS0,115200
www 日志看起来像
192.168.41.20 - - [27/Jul/2022:18:12:43 +0000] "GET /ksfiles/ubuntu-20.04.4-live-server-amd64.iso HTTP/1.1" 200 1331691520 "-" "Wget" "-"
192.168.41.20 - - [27/Jul/2022:18:13:18 +0000] "GET /ksfiles/apu21/user-data HTTP/1.1" 200 1916 "-" "Cloud-Init/21.4-0ubuntu1~20.04.1" "-"
192.168.41.20 - - [27/Jul/2022:18:13:24 +0000] "GET /ksfiles/apu21/user-data HTTP/1.1" 200 1916 "-" "Cloud-Init/21.4-0ubuntu1~20.04.1" "-"
自动安装开始 :-)