Closed vesubramanian closed 1 year ago
@SwampDragons Can you please help?
If you check the network section in the documentation from ubuntu, using 2 network attributes is correct.
Ubuntu installation used to fail when there were nested network: even though the documentation said to have it. It's most likely fixed (was broken in testing for 20.04) but either appears to work fine, the most important part in that was the ens192.
Problem here with getting support from hashicorp, especially from swapdragons I think is this isn't a problem with packer. It's an Ubuntu problem as you get the same with a manual install. I do not know what the problem is on your setup.
Thank you. Although, I have tried interactive install, I was trying that also via packer itself. In the interactive install, when I encountered the issue with curtin install command, one of the forums suggested to disable the network adapter in the beginning and enable it again at the end. I tried that with interactive option and it seemed to work. However, upon removing the interactive option, the error started occurring again. But, in all these cases, I was trying everything through packer only.
With that said, can you please tell me whom should I approach for help? I tried searching a lot, but couldn't find anything.
Also, can this error occur during partitioning? Can disk size configuration in builder json (or RAM or CPU) cause this? I also saw many people using Admin user for vSphere. Is it mandatory?
I have another question. Where is this http directory, on the host machine where packer build runs or in the ISO? In my case, i have it as {{template_dir}}/http? Will this be a problem? I have something like this in my builder.
"http_directory": "{{template_dir}}/http",
"cd_files": ["{{template_dir}}/http/user-data", "{{template_dir}}/http/meta-data"],
"cd_label": "cidata",
I also observed a message on the Console which says "can't open blockdev". Any idea about these?
can this error occur during partitioning? Can disk size configuration in builder json (or RAM or CPU) cause this?
unsure, but problems can occur if there isn't the space for the drive on the datastore used. If creating a disk thin provisioned, and there isn't enough space space, you will get IO blocked and the VM will be paused. As the VM is still running it shouldn't be that.
Admin user for vSphere. Is it mandatory?
No, you just need the correct permissions to create a VM in the cluster you selected, to access the (d)vswitch networks and read/write to the datastores you are using. Using admin is just a quick (lazy/insecure) way.
Where is this http directory, on the host machine where packer build runs or in the ISO
"http_directory": "{{template_dir}}/http"
That is saying the directory http will be the source (which will be available via the builtin http server is at where ever you have your json files running in packer in a sub directory called http. That is on the build / packer computer. If your boot command points to the http source it will be used, if it points to using the ISO the ISO below will be used.
"cd_files": ["{{template_dir}}/http/user-data", "{{template_dir}}/http/meta-data"]
That is copying the data in that directory that is also available over http to an ISO, they will be in the root of the ISO.
"cd_label": "cidata"
That is giving the ISO a label called cidata so that it will be loaded by ubuntu for install.
Thank you. So, in my boot command, should I use "cidata"?
If you want to use an ISO / CD as the config source, you create an ISO and have its label cidata (which you have packer doing) have it mounted after uploading to a datastore (which packer should be doing) and then in the boot command the datasource just needs to be set to nocloud
ds=nocloud
which if you are using what was in the config post of yours, you are doing.
https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html
Thank you once again. Please excuse me for my ignorance. So, you mean to say, I am doing something wrong in my builder? I want to just make it working somehow. Can you please guide me with the correct steps? In my case, if I just add cd_files without http_directory, it doesn't work and vice versa. Also, in my http_directory, I have to provide {{template_dir}}/http as the path. Hope this won't be a problem Since we are using http_directory, do we need to configure web server in the packer build machine?
Surprisingly, it calls the early commands, but doesn't seem to be reaching the late commands, probably erroring out before that itself.
Ok. One more observation. I tried the following command.
PACKER_LOG=1 packer build -debug -force -on-error=ask virtual-environments/images/linux/ubuntu2004.json
After a certain point, I keep getting this message on the terminal. "ssh handshake failed. unable to authenticate, attempted methods [none password], no supported methods remain. Detected authentication error. Increasing handshake attempts". I am a little surprised to see this because, I have set ssh_username and ssh_password in the json file. Please let me know how to address this?
Any help?
Ok. If I use ens33, I was able to proceed further, but it is stuck at one stage, as below. cc_final_message.py - Used fallback datasource.
It remains on the above step forever. But on packer, it is stuck at Waiting for IP.
Did you figure out what was causing the problem?
Thank you for checking. Unfortunately no, since I don't have any expertise on Linux or VMWare. Also, I searched a lot but couldn't find a solution and didn't get any further help from anyone.
My IT team has moved the vSphere to a different location. Now, the version is 6.7.0.50000. Also, I updated version of packer to 1.7.7. Took help from IT team. But here, I was not seeing the subiquity error. However, there was only one manual prompt. IT team also asked me to increase the boot wait time to 120 s. After all this, it seems to be creating the VM properly. Following is the builder used.
"builders": [ { "type": "vsphere-iso", "vcenter_server": "my-vcenter-server", "username": "domain\\vc-user", "password": "vc-user-pwd", "insecure_connection": "true", "datacenter": "myDC", "cluster": "my/Cluster", "datastore": "my-DS", "guest_os_type": "ubuntu64Guest", "host": "my.host", "CPUs": 2, "RAM": 2048, "firmware": "bios", "disk_controller_type": "pvscsi", "storage": [{ "disk_size": 20480, "disk_thin_provisioned":true }], "network_adapters": [{ "network": "my/network", "network_card": "my-NIC" }], "name": "Ubuntu-20.04", "vm_name": "packer-ubuntu", "folder": "My/Folder", "notes": "Built via Packer", "convert_to_template": false, "ssh_username": "ssh-user", "ssh_password": "ssh-user-pwd", "ssh_timeout": "20m", "ssh_handshake_attempts": "100000", "iso_paths": ["[myFolder]ubuntu-20.04.3-live-server-amd64.iso"], "iso_checksum": "sha256:f8e3086f3cea0fb3fefb29937ab5ed9d19e767079633960ccb50e76153effc98", "http_directory": "{{template_dir}}/http", "create_snapshot": "false", "boot_wait": "120s", "boot_order": "disk,cdrom", "cd_files": [ "{{template_dir}}/http/meta-data", "{{template_dir}}/http/user-data" ], "cd_label": "cidata", "boot_command": [ "yes<enter>" ] } ]
In the above boot command, we are only giving yes (thanks to the suggestion from my IT team), because only at one place it is prompting us to enter yes. Also, they asked me to increase the wait time to 2 minutes for this to work. However, it looks like it is not executing the late commands from the user-data file, not sure why. Also, I have provisioners section. While trying to execute that (probably), I am getting a new error.
Any help with the above error, please?
It does however look like the guest OS is failing to install and I'd suggest reviewing the user-data configuration.
I generate mine on demand m but check out https://github.com/rainpole/packer-vsphere/blob/main/builds/linux/ubuntu-server-20-04-lts/http/user-data.pkrtpl.hcl.
Ryan
unfort your link does';t exist anymore. Ryan - is there a new link you can share please?
unfort your link does';t exist anymore. Ryan - is there a new link you can share please?
Hi @lincolnfenner -
It's now and official project: vmware-samples/packer-examples-for-vsphere
Ryan Johnson Staff II Solutions Architect | VMware, Inc.
cc @nywilken - pretty aged issue.
Ryan Johnson Senior Staff Solutions Architect | Product Engineering @ VMware, Inc.
For general questions, we recommend reaching out to the community forum for greater visibility. The GitHub issue tracker is only watched by a small group of maintainers and collaborators and is typically reserved for bug reports and enhancement request. You will typically have more success finding assistance on the forum.
If you find the forum to be more helpful or if you've found the answer to your question elsewhere, please comment and close the issue. If there is no further activity on this question within the next 30 days it will be closed.
Ryan Johnson Senior Staff Solutions Architect | Product Engineering @ VMware, Inc.
Ubuntu Version : 20.04.3 (Focal) Packer Version: 1.7.4 vSphere Client Version: 6.7.0.48000 Builder Type: vSphere-iso
I have tried so many options and articles, but I couldn't build an ISO for Ubuntu 20.04.3. I get stuck at "Waiting for SSH server to become available". It will be great, if I can get a working example. Especially, I need the builder section inside ubuntu2004.json and the content of the user-data file which will be inside the http directory. It would be really nice if there is a step-by-step example, as I am not at all knowledgeable on Linux. Please help. I am also tagging @dbond007.
PFB a few links I followed, but didn't have any luck. https://github.com/dbond007/Packer/tree/master/ubuntu_base https://github.com/rainpole/packer-vsphere https://virtjo.com/2020/build-ubuntu-vm-with-packer-on-vsphere/
Upon monitoring the console, I had some observations. I am attaching some screen shots for reference.