Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't create VM image with packer in Proxmox #1

Open
UmanGarbag opened this issue Apr 23, 2021 · 5 comments
Open

Can't create VM image with packer in Proxmox #1

UmanGarbag opened this issue Apr 23, 2021 · 5 comments

Comments

@UmanGarbag
Copy link

Hello i'm want to create some ISO image with packer on my pve (pve-manager/6.3-6/2184247e), so i use your example for debian distro, but i have a problem when the installer want to download debconf file.

The VM can have a ip address via DHCP, but block in the debconfig task, and crash because of timeout ssh.

Have you ever had the same issue ?

Thanks.

@blz-ea
Copy link
Owner

blz-ea commented Apr 24, 2021

Hey @UmanGarbag,
I haven't had issue like that.
What do you see in the VM's console in Proxmox during image creation process ?
Is it able to pick up the answer's file ?

@UmanGarbag
Copy link
Author

Hi, where i launch my packer command the create process works, in the web interface i can see packer create and start the VM. In cluster log and task i don't have any error.

The installer block after network configuration :
block_load

The proxmox console :
console

I show you my configuration file :

Json file for template :

{ "builders": [ { "type": "proxmox", "proxmox_url": "{{user proxmox_hostname}}", "username": "{{user username}}", "password": "{{user password}}", "insecure_skip_tls_verify": true, "node": "pve", "vm_id": "{{ user vmid}}", "vm_name": "{{ username}}", "os": "l26", "cores": "{{user cpus}}", "sockets": "{{user sockets}}", "memory": "{{user memory}}", "communicator":"ssh", "network_adapters": [ { "model": "{{user net_model}}", "bridge": "{{user net_bridge`}}"
}
],

  "disks": [
    {
      "type": "{{ user `disk_type`}}",
      "disk_size": "{{user `disk_size`}}",
      "storage_pool": "{{user `disk_storage_pool`}}",
      "storage_pool_type": "{{ user `disk_storage_pool_type`}}",
      "format": "raw"
      }
  ],
  "http_directory": "../http",
  "boot_wait":"2s",
  "boot_command": [
    "<esc><wait>",
    "install <wait>",
    " preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed_test.cfg <wait>",
    "debian-installer=fr_FR.UTF-8  <wait>",
    "auto  <wait>",
    "locale=fr_FR.UTF-8  <wait>",
    "kbd-chooser/method=fr  <wait>",
    "keyboard-configuration/xkb-keymap=fr  <wait>",
    "netcfg/get_hostname=debian10 <wait> ",
    " netcfg/get_domain=localhost.local <wait>",
    " fb=false <wait>",
    " debconf/frontend=noninteractive <wait>",
    " console-setup/ask_detect=false <wait>",
    " console-keymaps-at/keymap=fr <wait>",
    " grub-installer/bootdev=/dev/vda <wait>",
    " netcfg/dhcp_timeout=120 <wait>",
    " username=root <wait>",
    " user_password=root <wait>",
    " time_zone=UTC <wait>",
    " passwd/username=root <wait>",
    " passwd/root-password=root <wait>",
    " passwd/root-password-again=root <wait>",
    " passwd/user-fullname=ansible <wait>",
    " passwd/user-password=ansible <wait>",
    " passwd/user-password-again=ansible <wait>",
    
    "<enter><wait>"
   ],

  "qemu_agent":"true",
  "scsi_controller":"virtio-scsi-pci",
  "iso_file": "{{ user `iso_name`}}",
  "iso_checksum": "{{ user `iso_checksum`}}",
  "unmount_iso": true,
  "template_name": "{{ user `template`}}",
  "template_description": "Debian10 template with low hardware caracteristic",
  "ssh_timeout": "20m",
  "ssh_username": "root",
  "ssh_password": "root",
  "ssh_port": 22
}

],
"description": "Small template for a little debian10 machine"
}`

And preceed.cfg :

Preseeding only locale sets language, country and locale.

d-i debian-installer/locale string fr_FR

The values can also be preseeded individually for greater flexibility.

d-i debian-installer/language string fr
d-i debian-installer/country string FR
d-i debian-installer/locale string fr_fr.UTF-8

Optionally specify additional locales to be generated.

d-i localechooser/supported-locales multiselect en_US.UTF-8, nl_NL.UTF-8

Keyboard selection.

d-i keyboard-configuration/xkb-keymap select fr

d-i keyboard-configuration/toggle select No toggling

Select network interface auto

d-i netcfg/choose_interface select auto

If you select ftp, the mirror/country string does not need to be set.

#d-i mirror/protocol string ftp
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.fr.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string

#Root Account
d-i passwd/root-login boolean true
d-i passwd/root-password password root
d-i passwd/root-password-again password root

To create a normal user account.

d-i passwd/user-fullname string ansible
d-i passwd/username string ansible

Normal user's password, either in clear text

d-i passwd/user-password password ansible
d-i passwd/user-password-again password ansible
#UID for the user
d-i passwd/user-uid string 1000

#Add the user account to initial groups
d-i passwd/user-default-groups string audio cdrom video

Controls whether or not the hardware clock is set to UTC.

d-i clock-setup/utc boolean true

You may set this to any valid setting for $TZ; see the contents of

/usr/share/zoneinfo/ for valid values.

d-i time/zone string Europe/Paris

Controls whether to use NTP to set the clock during the install

d-i clock-setup/ntp boolean true

NTP server to use

d-i clock-setup/ntp-server string 0.europe.pool.ntp.org

Partitioning

#Lvm auto

d-i partman-auto/method string lvm
d-i partman-auto-lvm/guided_size string max
d-i partman-auto/choose_recipe select multi

If one of the disks that are going to be automatically partitioned

contains an old LVM configuration, the user will normally receive a

warning. This can be preseeded away...

d-i partman-lvm/device_remove_lvm boolean true

The same applies to pre-existing software RAID array:

d-i partman-md/device_remove_md boolean true

And the same goes for the confirmation to write the lvm partitions.

d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true

d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i partman/mount_style select uuid

Apt setup

d-i apt-setup/use_mirror boolean true
d-i apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true

Select which update services to use; define the mirrors to be used.

d-i apt-setup/services-select multiselect security, updates, backports
d-i apt-setup/security_host string security.debian.org

Package selection

tasksel tasksel/first multiselect standard, ssh-server

d-i pkgsel/include string qemu-guest-agent bash-completion curl figlet wget git openssh-server build-essential vim
d-i pkgsel/install-language-support boolean false
d-i pkgsel/upgrade select safe-upgrade

Popularity Contest

popularity-contest popularity-contest/participate boolean false

Boot loader installation

This is fairly safe to set, it makes grub install automatically to the MBR

if no other operating system is detected on the machine.

d-i grub-installer/only_debian boolean true

This one makes grub-installer install to the MBR if it also finds some other

OS, which is less safe as it might not be able to boot that other OS.

d-i grub-installer/with_other_os boolean true

Due notably to potential USB sticks, the location of the MBR can not be

determined safely in general, so this needs to be specified:

d-i grub-installer/bootdev string /dev/sda

Avoid that last message about the install being complete.

d-i finish-install/reboot_in_progress note

d-i preseed/late_command string
in-target sed -e 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' -i /etc/ssh/sshd_config

@blz-ea
Copy link
Owner

blz-ea commented Apr 24, 2021

I'm not sure what is wrong with your preseed.cfgand your json config, but I can suggest you to try using debian template from this repo with included preseed.cfg and sources.pkr.hcl (<- instead of json), test it and modify later for your needs.

@UmanGarbag
Copy link
Author

Ok thanks , i gonna try this :)

@UmanGarbag
Copy link
Author

I try but i have the same error, i don't know why

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants