我正在尝试创建一个自动化的Ubuntu镜像与 Package 。Packer成功地将用户数据传递到Autoinstaller,但失败了,我无法通过查看安装程序,cloud-init或科廷日志来确定原因。希望其他人能帮忙。相关错误消息显示在科廷-install.log中。
curtin-install.log
Running command ['mount', '--make-private', '/target/proc'] with allowed return codes [0] (capture=False)
Running command ['umount', '/target/proc'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/target/dev'] with allowed return codes [0] (capture=False)
Running command ['umount', '/target/dev'] with allowed return codes [0] (capture=False)
finish: cmd-install/stage-curthooks/002-setupcon-save-only/cmd-in-target: FAIL: curtin command in-target
curtin: Installation failed with exception: Unexpected error while running command.
Command: ['curtin', 'in-target', '--', 'setupcon', '--save-only']
Exit code: 1
Reason: -
Stdout: start: cmd-install/stage-curthooks/002-setupcon-save-only/cmd-in-target: curtin command in-target
Running command ['mount', '--bind', '/dev', '/target/dev'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/proc', '/target/proc'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/run', '/target/run'] with allowed return codes [0] (capture=False)
Running command ['mount', '--bind', '/sys', '/target/sys'] with allowed return codes [0] (capture=False)
Running command ['unshare', '--help'] with allowed return codes [0] (capture=True)
Running command ['unshare', '--fork', '--pid', '--', 'chroot', '/target', 'setupcon', '--save-only'] with allowed return codes [0] (capture=False)
/usr/bin/ckbcomp: Can not find file "symbols/en" in any known directory
Running command ['udevadm', 'settle'] with allowed return codes [0] (capture=False)
TIMED subp(['udevadm', 'settle']): 0.055
Running command ['mount', '--make-private', '/target/sys'] with allowed return codes [0] (capture=False)
Running command ['umount', '/target/sys'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/target/run'] with allowed return codes [0] (capture=False)
Running command ['umount', '/target/run'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/target/proc'] with allowed return codes [0] (capture=False)
Running command ['umount', '/target/proc'] with allowed return codes [0] (capture=False)
Running command ['mount', '--make-private', '/target/dev'] with allowed return codes [0] (capture=False)
Running command ['umount', '/target/dev'] with allowed return codes [0] (capture=False)
finish: cmd-install/stage-curthooks/002-setupcon-save-only/cmd-in-target: FAIL: curtin command in-target
这是我的配置文件。
ubuntu.pkr.hcl
source "hyperv-iso" "ubuntu-desktop" {
boot_command = [
"c",
"set gfxpayload=keep",
"<enter><wait>",
"linux /casper/vmlinuz autoinstall quiet ds=\"nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\"",
"<enter><wait>",
"initrd /casper/initrd<enter><wait>",
"boot<enter>",
]
boot_wait = "5s"
iso_url = "ubuntu-22.04.2-live-server-amd64.iso"
iso_checksum = "sha256:5e38b55d57d94ff029719342357325ed3bda38fa80054f9330dc789cd2d43931"
cpus = 2
enable_secure_boot = false
disk_size = 128000
memory = 4096
mac_address = "00:15:5D:01:73:0D"
shutdown_command = "echo 'ubuntu' | sudo -S shutdown -P now"
ssh_password = "ubuntu"
ssh_username = "ubuntu"
ssh_timeout = "1h"
ssh_host = "192.168.1.100"
ssh_handshake_attempts = 500
switch_name = "Hyper-V External Switch"
vm_name = "test-desktop"
http_directory = "http"
http_port_max = 9987
http_port_min = 9987
}
build {
sources = ["source.hyperv-iso.ubuntu-desktop"]
}
user-data
#cloud-config
autoinstall:
version: 1
# early-commands:
# workaround to stop ssh for packer as it thinks it timed out
# - sudo systemctl stop ssh
refresh-installer:
update: yes
locale: en_US
keyboard:
layout: en
packages:
- ubuntu-desktop
- net-tools
- nfs-common
- net-tools
- linux-virtual
- linux-cloud-tools-virtual
- linux-tools-virtual
snaps:
- name: firefox
- name: gnome-3-38-2004
- name: gtk-common-themes
- name: snap-store
- name: snapd-desktop-integration
package_update: true
package_upgrade: true
storage:
layout:
name: direct
early-commands:
- echo 'linux-generic-hwe-22.04' > /run/kernel-meta-package
identity:
hostname: test-desktop
username: ubuntu
password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0"
ssh:
install-server: yes
allow-pw: yes
user-data:
disable_root: false
1条答案
按热度按时间fnvucqvd1#
不要问我为什么(可能与https://bugs.launchpad.net/subiquity/+bug/1621378或https://github.com/canonical/subiquity/pull/1411有关),但从用户数据文件中删除
keyboard
部分对我来说是个好办法。