creation of ami from iso

65 views
Skip to first unread message

shruthi kv

unread,
Feb 25, 2021, 11:55:08 PM2/25/21
to Packer
Hi Team,

i am trying to conversion to ova file using packer virtual box. but this s not happening it is stuck in ssh connection. Any idea what needs to be done. What should be the authentication method for ssh
==> virtualbox-iso: Retrieving Guest additions checksums
==> virtualbox-iso: https://download.virtualbox.org/virtualbox/5.2.42/SHA256SUMS => /home/ubuntu/####/ac7a9
==> virtualbox-iso: Retrieving Guest additions
==> virtualbox-iso: Retrieving ISO
==> virtualbox-iso: Starting HTTP server on port 8952
==> virtualbox-iso: Creating virtual machine...
==> virtualbox-iso: Creating hard drive...
==> virtualbox-iso: Mounting ISOs...
    virtualbox-iso: Mounting boot ISO...
==> virtualbox-iso: Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port 4412)
==> virtualbox-iso: Executing custom VBoxManage commands...
    virtualbox-iso: Executing: modifyvm CentOS-7.5-netinstall-new --memory 512
    virtualbox-iso: Executing: modifyvm CentOS-7.5-netinstall-new --cpus 1
    virtualbox-iso: Executing: modifyvm CentOS-7.5-netinstall-new --nic1 hostonly
    virtualbox-iso: Executing: modifyvm CentOS-7.5-netinstall-new --hostonlyadapter1 vboxnet0
==> virtualbox-iso: Starting the virtual machine...
    virtualbox-iso: The VM will be run headless, without a GUI. If you want to
    virtualbox-iso: view the screen of the VM, connect via VRDP without a password to
    virtualbox-iso: rdp://127.0.0.1:5955
==> virtualbox-iso: Waiting 5s for boot...
==> virtualbox-iso: Typing the boot command...
==> virtualbox-iso: Using ssh communicator to connect: 127.0.0.1
==> virtualbox-iso: Waiting for SSH to become available...

Megan Marsh

unread,
Feb 26, 2021, 12:13:03 PM2/26/21
to packe...@googlegroups.com
The SSH credentials will be whatever you set in your preseed file. Without looking at your template I don't know what the sticking point is, but here's a basic guide on what your preseed file needs to contain for Packer to connect.




--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/a809a30e-8565-4b27-8f28-088d9975b657n%40googlegroups.com.
Message has been deleted

Megan Marsh

unread,
Mar 5, 2021, 5:25:24 PM3/5/21
to packe...@googlegroups.com
Given that your username/password is centos centos you may need to set "d-i user-setup/allow-password-weak" in your preseed since that's not a strong password. Try to manually SSH into your instance using that username/password combo during the time Packer is trying to connect. Does it work? If not, set "headless": false in your Packer template and see where the preseed is getting stuck.

On Fri, Mar 5, 2021 at 2:19 PM KVS <kv.sh...@gmail.com> wrote:
Please check and let me know what i am missing here
My Template:
{
  "builders": [
    {
      "boot_command": [
        "<enter><wait>",
        "<f6><esc>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs><bs><bs><bs><bs><bs><bs><bs>",
        "<bs><bs><bs>",
        "/install/vmlinuz ",
        "initrd=/install/initrd.gz ",
        "net.ifnames=0 ",
        "auto-install/enable=true ",
        "debconf/priority=critical ",
        "console-setup/ask_detect=false<wait>",
        "console-setup/layoutcode=us<wait>",
        "console-setup/modelcode=pc105<wait>",
        "debconf/frontend=noninteractive<wait>",
        "debian-installer=en_US.UTF-8<wait>",
        "fb=false<wait>",
        "initrd=/install/initrd.gz<wait>",
        "kbd-chooser/method=us<wait>",
        "keyboard-configuration/layout=USA<wait>",
        "keyboard-configuration/variant=USA<wait>",
        "locale=en_US.UTF-8<wait>",
        "netcfg/get_domain=vm<wait>",
        "netcfg/get_hostname=centos<wait>",
        "noapic<wait>",
        "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg"
      ],
      "boot_wait": "5s",
      "skip_nat_mapping": false,
      "disk_size": 20480,
      "guest_os_type": "Ubuntu_64",
      "headless": "true",
      "http_directory": "http",
      "iso_checksum": "sha256:937bf0a7b0932817f84f7230f15ed88911bbbd85c0c958680792b7f8d8f9c1a9",
      "output_directory": "output-centos7.5-NetInstall-1",
      "shutdown_command" : "echo 'centos' | sudo -S shutdown -P now",
      "ssh_password": "centos",
      "ssh_timeout": "10000s",
      "ssh_username": "centos",
      "ssh_port": 22,
      "ssh_wait_timeout": "10000s",
      "ssh_host": "centos",
      "ssh_agent_auth":"false",
      "type": "virtualbox-iso",
      "format": "ovf",
      "vboxmanage": [
        [
          "modifyvm",
          "{{.Name}}",
          "--memory",
          "512"
        ],
        [
          "modifyvm",
          "{{.Name}}",
          "--cpus",
          "1"
        ],
        ["modifyvm", "{{.Name}}", "--natpf1", "centos,tcp,,3022,,22"]
      ],
      "vm_name": "CentOS-7.5-netinstall-new1"
    }
 
preseed file:
d-i network-console/password-again password centos

### Mirror settings
# 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 http.us.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string

# Suite to install.
#d-i mirror/suite string testing
# Suite to use for loading installer components (optional).
#d-i mirror/udeb/suite string testing

### Account setup
# Skip creation of a root account (normal user account will be able to
# use sudo).
#d-i passwd/root-login boolean false
# Alternatively, to skip creation of a normal user account.
#d-i passwd/make-user boolean false

# Root password, either in clear text
d-i passwd/root-password password centos
d-i passwd/root-password-again password centos
# or encrypted using a crypt(3)  hash.
#d-i passwd/root-password-crypted password [crypt(3) hash]

# To create a normal user account.
d-i passwd/user-fullname string centos
d-i passwd/username string centos
d-i passwd/user-uid string 1000
# Normal user's password, either in clear text
d-i passwd/user-password password centos
d-i passwd/user-password-again password centos
# or encrypted using a crypt(3) hash.
#d-i passwd/user-password-crypted password [crypt(3) hash]

# Create the first user with the specified UID instead of the default.
#d-i passwd/user-uid string 1010

# The user account will be added to some standard initial groups. To
# override that, use this.
#d-i passwd/user-default-groups string audio cdrom video

### Clock and time zone setup
# 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 US/Eastern

# Controls whether to use NTP to set the clock during the install
d-i clock-setup/ntp boolean true
# NTP server to use. The default is almost always fine here.
#d-i clock-setup/ntp-server string ntp.example.com
d-i partman-auto/method string lvm

# You can define the amount of space that will be used for the LVM volume
# group. It can either be a size with its unit (eg. 20 GB), a percentage of
# free space or the 'max' keyword.
d-i partman-auto-lvm/guided_size string max

# 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-lvm/confirm_nooverwrite boolean true


# You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home:   separate /home partition
# - multi:  separate /home, /var, and /tmp partitions
d-i partman-auto/choose_recipe select atomic
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-md/confirm 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 apt-setup/non-free boolean true
d-i apt-setup/contrib boolean true
d-i apt-setup/services-select multiselect security, updates
d-i apt-setup/security_host string security.debian.org
d-i debian-installer/allow_unauthenticated boolean true
d-i pkgsel/include string openssh-server
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
d-i finish-install/reboot_in_progress note
d-i debian-installer/exit/halt boolean true
# This will power off the machine instead of just halting it.
d-i debian-installer/exit/poweroff boolean true
d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh


Reply all
Reply to author
Forward
0 new messages