shantanoo-desai / packer-ubuntu-server-uefi

Packer Templates for creating Ubuntu Live Server Images with Packer + QEMU + Autoinstall (cloud-init)
Apache License 2.0
29 stars 13 forks source link

Boot order remains on Try Install after first reboot #2

Closed Emanuele94 closed 1 year ago

Emanuele94 commented 1 year ago

Hi, thanks for this, it's very usefull. I'm facing and issue were after cloud init autoinstall, the vm reboots but i can see that the disk is not being unmounted and when it starts it launches installation once again. Have you got any ideas about this? I'm trying to work with qemuargs at the moment to set boot order.

shantanoo-desai commented 1 year ago

@Emanuele94 In most cases when you see the installation again, the user-data was not successfully executed. Can you run qemu in graphics mode to see the logs from cloud-init?

Local Tests

Cloud-Init

check if cloud-init user-data file is valid (maybe new cloud-init updates might render it buggy)

make validate-cloudinit

QEMU graphics

if possible set the headless value in the Packer template to false and try booting the image on a local device with qemu and kvm.

I would still recommend adding the boot sequence into the late-commands because that is what has worked for me

  late-commands:
    - "sudo apt update && sudo apt install -y efibootmgr"
    - "sudo efibootmgr"
    - "sudo efibootmgr -o 0007,0001,0000,0002,0003,0004,0005,0006"

Check efibootmgr sequence

if you are able to crash the cloud-init installation try getting some information from efibootmgr and determine where the image should be in the sequence and place the image disk first

Emanuele94 commented 1 year ago

Hi, thanks for the response. unfortunately i cannot use headless false. Though, i'm trying to set the efibootmgr, fist by checking efibootmgr -v once i get the vm working. The cloud-init validate works fine, i get no errors.

Emanuele94 commented 1 year ago

Thanks again man! i've solved by checking manually efibootmgr -v and than changing as you suggested the order in cloud-init user-data efibootmgr -o