0

I am mounting ISO with embedded autoinstall user-data file to automate Ubuntu installation on physical servers using. Boot mode is UEFI. At the end of OS installation I expect the autoinstall process to eject cdrom before reboot. But I see the eject operation is failing from install logs. As a result the server is looping into installation indefinitely.

Am I missing anything in the autoinstall YAML? Here is its copy:

#cloud-config
autoinstall:
  version: 1
  identity: {hostname: ubuntu, password: password,
    realname: Govind, username: bma}
  keyboard: {layout: us, toggle: null, variant: ''}
  locale: en_US.UTF-8
  early-commands:
    - echo "Nothing yet"
  network:
    ethernets:
      eno1: {dhcp4: true}
    version: 2
  ssh:
    allow-pw: true
    authorized-keys: []
    install-server: true
  storage:
    config:
    - {ptable: gpt, serial: <removed>, wwn: '<removed>',
      path: /dev/sdb, wipe: superblock-recursive, preserve: false, name: '', grub_device: false,
      type: disk, id: disk-sdb}
    - {device: disk-sdb, size: 536870912, wipe: superblock, flag: boot, number: 1,
      preserve: false, grub_device: true, type: partition, id: partition-0}
    - {fstype: fat32, volume: partition-0, preserve: false, type: format, id: format-0}
    - {device: disk-sdb, size: 118914809856, wipe: superblock, flag: '', number: 2,
      preserve: false, grub_device: false, type: partition, id: partition-1}
    - {fstype: ext4, volume: partition-1, preserve: false, type: format, id: format-1}
    - {path: /, device: format-1, type: mount, id: mount-1}
    - {path: /boot/efi, device: format-0, type: mount, id: mount-0}
  late-commands:
    - ip_array=`ip a | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}' | awk -F'/'  '{print $1}' `
    - iplist=""
    - for item in $ip_array; do iplist=`echo $item","$item1`; done
    - echo "curl -X POST -k --header 'Content-Type':' plain/text, Accept':' plain/text' -d '$iplist' %BMA_REST_URL%" > /tmp/confirm.sh
    - bash /tmp/confirm.sh
    - sleep 10
    - umount -f /cdrom

I can provide any additional logs if needed.

1 Answers1

1

What logs do you see showing the eject is failing? Why are you unmounting /cdrom in your late-commands?

The eject command is run by casper after the installer has exited. The source code for the casper-stop script shows that if /cdrom is not mounted then it will not run the eject command.

# If /cdrom isn't mounted, don't try to eject it

You could also be running into a situation where curtin is reordering the boot order to prefer the cd-rom. The default behavior during installation is to set the current boot method as the first boot option.

see also

Andrew Lowther
  • 5,811
  • 1
  • 15
  • 23
  • Thank you for your response and pointers. I see this message in the console and also /var/log/installer_journal.log Mar 04 04:19:27 ubuntu-server systemd[1]: Failed unmounting /cdrom. This log message may be red-herring but the problem I am facing is that after auto-install the server boots back into the installer present in the virtual CD. Please ignore the umount /cdrom command in the last-commands. I was just experimenting but I tried without that command too with same results. The Virtual CD was mounted as boot-once using Dell iDRAC. – Govind Avireddi Mar 04 '22 at 05:51