Quantcast
Viewing all articles
Browse latest Browse all 6112

Getting stuck at ==> hyperv-iso: Waiting for SSH to become available.... while automating installation of ubuntu 22.04.4 live server

Hi am new to devops hence please help me out.While writing the below command

    packer build -force packer.json

I am trying to run a config file which should automatically install ubuntu in a vm.

packer.json

{"variables": {"vm_name": "ubuntu-live","cpu": "4","ram_size": "8192","disk_size": "81920","hyperv_switchname": "ExternalNetwork","username": "vagrant123","password": "vagrant123","iso_url": "https://example.net/OS/Ubuntu/ubuntu-22.04.4-live-server-amd64.iso", #the link has been changed"iso_checksum": "125022addbe20d3a9e3b71e04653f67b","memory": "2048","cpus": "2","ssh_username": "vagrant123","ssh_password": "vagrant123","packer_temp_directory": "C:/Users/Def/PackerTemp"    },"builders": [      {"vm_name": "{{user `vm_name`}}","type": "hyperv-iso","disk_size": "{{user `disk_size`}}","guest_additions_mode": "disable","iso_url": "{{user `iso_url`}}","iso_checksum": "{{user `iso_checksum`}}","communicator": "ssh","ssh_username": "{{user `username`}}","ssh_password": "{{user `password`}}","ssh_port": 22,"ssh_timeout": "10m","boot_wait": "5s","http_directory": "linux/ubuntu/http/","http_port_min": 8000,"http_port_max": 8000,"boot_command": ["<esc><wait><esc><wait><esc><wait>","<c><wait><bs>","set gfxpayload=keep<enter>","linux /casper/vmlinuz autoinstall ds=nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/ auto<enter>","initrd /casper/initrd<enter>","boot<enter>"        ],"shutdown_command": "echo {{user `password`}} | sudo -S -E shutdown -P now","memory": "{{user `ram_size`}}","cpus": "{{user `cpu`}}","generation": 2,"switch_name": "{{user `hyperv_switchname`}}","enable_secure_boot": false,"output_directory": "./BaseVM","temp_path": "{{user `packer_temp_directory`}}"    }    ],"provisioners": [      {"type": "shell","inline": ["echo 'Provisioning VM...'"        ]      }    ]  }

In the VM I can see that the screen is stuck at language select during the installation.

user-data

#cloud-configautoinstall:  version: 1  identity:    hostname: ubuntu-live    password: "$6$rounds=4096$EUdW2xPr0W$cE.RQJUylIf1MV0ntiav5NT3y6efs0FItmuX42Xlk0vUJRylFKZkodOM7hwcQDwIDEiPw92P1WSJ3oeBGm.tp."    username: vagrant123  locale: en_US  keyboard:    layout: us    variant: us  ssh:    install-server: true  time:    timezone: Canada/Eastern    package_update: true  packages:    - ntp     - cryptsetup    - build-essential    - libssl-dev    - libreadline-dev    - zlib1g-dev    - linux-virtual    - linux-tools-virtual    - linux-cloud-tools-virtual    - cifs-utils    - zip    - unzip    - git    - curl    - net-tools    - openjdk-8-jdk-headless    - openjdk-11-jdk-headless    - nfs-common    - byobu  late-commands:    - sed -i 's/^#*\(send dhcp-client-identifier\).*$/\1 = hardware;/' /target/etc/dhcp/dhclient.conf    - echo 'vagrant ALL=(ALL) NOPASSWD:ALL'> /target/etc/sudoers.d/vagrant    - curtin in-target -- apt-get -y dist-upgrade    - curtin in-target -- apt-get clean    - curtin in-target -- sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java    - curtin in-target -- sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac    - curtin in-target -- sudo shutdown -r now

I have tried adding preseed.cfg.

# Locale settingsd-i debian-installer/locale string en_USd-i console-setup/ask_detect boolean falsed-i keyboard-configuration/layoutcode string us# Network configurationd-i netcfg/choose_interface select auto# Set up the clockd-i clock-setup/utc boolean trued-i time/zone string US/Eastern# Package selectiontasksel tasksel/first multiselect standard, ubuntu-server# Boot loader

I was expecting it to be installed but instead it is stuck at

==> hyperv-iso: Starting HTTP server on port 8000==> hyperv-iso: Creating switch 'ExternalNetwork' if required...==> hyperv-iso:     switch 'ExternalNetwork' already exists. Will not delete on cleanup...==> hyperv-iso: Creating virtual machine...==> hyperv-iso: Enabling Integration Service...==> hyperv-iso: Setting boot drive to os dvd drive C:\Users\snpandey\Desktop\Work\Scripts\packer_cache\68f7cd2a3e05131791161a91f61f45d30271bb7a.iso ...==> hyperv-iso: Mounting os dvd drive C:\Users\Def\Scripts\packer_cache\68f7cd2a3e05131791161a91f61f45d30271bb7a.iso ...==> hyperv-iso: Skipping mounting Integration Services Setup Disk...==> hyperv-iso: Mounting secondary DVD images...==> hyperv-iso: Configuring vlan...==> hyperv-iso: Determine Host IP for HyperV machine...==> hyperv-iso: Host IP for the HyperV machine: 192.168.2.12==> hyperv-iso: Attempting to connect with vmconnect...==> hyperv-iso: Starting the virtual machine...==> hyperv-iso: Waiting 5s for boot...==> hyperv-iso: Typing the boot command...==> hyperv-iso: Waiting for SSH to become available...

and a vm screen with select language.


Viewing all articles
Browse latest Browse all 6112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>