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

No way to build Ubuntu 22.04 with vSphere 7.0 #325

Closed
s0uky opened this issue Jun 22, 2023 · 9 comments
Closed

No way to build Ubuntu 22.04 with vSphere 7.0 #325

s0uky opened this issue Jun 22, 2023 · 9 comments
Labels

Comments

@s0uky
Copy link

s0uky commented Jun 22, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

With vSphere 7.0 is not possible to use floppy drive and option "floppy_dirs" because floppy drive is gone from this version. Same with cloud-init settings 'ds='nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/22.04/' in boot_command isn't possible to use if you don't have DHCP server deployed. Static IP configuration still isn't seems to be solved regards to this issue hashicorp/packer#9115 .

Debian installer preseed option is gone from Ubuntu 22 and there is no way how to provide config file for cloud-init.

Is there any way how to use USB device instead of floppy drive in configuration?

Reproduction Steps

Run similar command with specifing vSphere API settings in vsphere.json:
/usr/bin/packer build -except=local -only=vsphere-iso -var-file="image-builder-0.1.16/extras/capi_image_adds_v1.21.json" -only=vsphere packer/ova/packer-node.json

Packer version

Packer v1.9.1

Simplified Packer Template

All in default configuration.

Operating system and Environment details

vSphere 7.0 -> Oracle Linux Server 8.7 (run packer), Ubuntu 22.04 (ISO to be provisioned)

Log Fragments and crash.log files

Nothing interesting in packer logs, but in build VM there are lot of errors regards to floppy.

@s0uky s0uky added the bug label Jun 22, 2023
@umashankar1988
Copy link

@s0uky have you tried using cd_files?

  cd_files                = [
    "source/packer/preseed/ubuntuserver22/user-data",
    "source/packer/preseed/ubuntuserver22/meta-data"
  ]

@afretwell
Copy link

This does work, look into subiquity: https://ubuntu.com/server/docs/install/autoinstall-reference This is how ubuntu handles their auto unattend, make a folder specifically called cidata and put your user-data file in that, you can use boot command or http server to grab it and load it into memory using initramd in your boot command and it will work. I went through all of the work to get it working then swapped to debian a month later cause server stability issues with Ubuntu. Point is, it will work, you just have to use Ubuntu's new process to get it to work as expected.

@afretwell
Copy link

afretwell commented Aug 25, 2023

This is the boot command you want

http_directory            = "./cidata"
boot_command              = [
    "c<wait3s>",
    "set gfxpayload=keep<enter>",
    "linux /casper/vmlinuz autoinstall \"ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/\" ",
    "hostname={{.Name}} boot=casper fsck.mode=skip auto=true noprompt noeject<enter>",
    "initrd /casper/initrd<enter>",
    "boot<enter>"
  ]

This is the basic user-data:

#cloud-config
autoinstall:
  version: 1
  early-commands:
    - systemctl stop ssh  
  identity:
    hostname: ubuntu2204
    realname: ubuntu2204
    username: -----secret-----
    password: '$6$9-----secret-----'
  keyboard:
    layout: en
    variant: us
  late-commands:
    - ssh-import-id-gh -----secret-----
    - "echo 'packer ALL=(ALL) NOPASSWD: ALL' > /target/etc/sudoers.d/-----secret-----"
    - curtin in-target --target=/target -- chmod 440 /etc/sudoers.d/-----secret-----
  locale: en_US
  reporting:
    builtin:
      type: print
  ssh:
    install-server: true
    allow-pw: true
    authorized-keys:
      - ssh-rsa -----secret-----
  user-data:
    disable_root: false
    timezone: America/New_York

For some reason there also needs to be a mete-data file in the cidata folder, even if its empty, dont know why:
# meta-data

Hope this helps!

@afretwell
Copy link

you can also load up the user-data/meta-data files onto a cdrom if you cant get an IP, youll need to update the boot_command to use cdrom:/ instead of nocloud-net

@tenthirtyam
Copy link
Collaborator

This can easily be done for Ubuntu and Debian with both cd_files and iso_paths without issue using the vsphere-iso builder.

@tenthirtyam
Copy link
Collaborator

@tenthirtyam
Copy link
Collaborator

Cc @nywilken

@nywilken
Copy link
Contributor

@tenthirtyam thanks for the ping it seems like this issue might be resolved given your last suggestion. I will transfer to the vSphere repository for tracking and management.

It seems like a user configuration more than a bug. I think we can close it if there are no objections or further questions.

@nywilken nywilken transferred this issue from hashicorp/packer Nov 10, 2023
@s0uky
Copy link
Author

s0uky commented Nov 10, 2023

I fixed this issue with proper boot_command, (see the whole ip= part), so Packer can access Ubuntu with correct interface settings:

"boot_command_prefix": "c<wait>linux /casper/vmlinuz ipv6.disable={{ user `boot_disable_ipv6` }} ip={{ user `vm_ip` }}::{{ user `vm_gateway` }}:{{ user `vm_netmask` }}::::{{ user `vm_dns` }} --- autoinstall ds='nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/22.04/'<enter><wait>initrd /casper/initrd<enter><wait>boot<enter>",

  "vm_ip": "10.1.1.1",
  "vm_netmask": "255.255.254.0",
  "vm_gateway": "10.1.1.254",
  "vm_dns": "10.1.1.3"

@hashicorp hashicorp locked and limited conversation to collaborators Jun 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants