skip to Main Content

I am trying to create an automated Ubuntu image with packer. Packer is successfully passing user-data to Autoinstaller, but is failing and I have not been able to determine why by looking at the installer, cloud-init, or curtin logs. Hoping someone else can help. Relevant error message appears to be in curtin-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

Here are my config files.

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

2

Answers


  1. Don’t ask me why (maybe related to https://bugs.launchpad.net/subiquity/+bug/1621378 or https://github.com/canonical/subiquity/pull/1411), but removing the keyboard section from the user data file did the trick for me.

    Login or Signup to reply.
  2. I am having the exact same problem with Proxmox 7.4-3, installing Ubuntu 22.04.2.

    Super happy I ran into your post and answer as removing the keyboard did the trick for me. So only comment out:

    keyboard: layout: en

    Thanks Èder!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search