2

I am working on upgrading an offline/disconnected installation of Ubuntu that used to be 18.04 with D-I to 20.04 with autoinstall/cloud-init.

I have most everything working out so far, but one of the changes I cannot find documentation for is hurting my unattended install. Basically when cloud-init is finished with the first cloud-config stage before it reboots into the installed 20.04 system, it ejects the media (in my case ejecting the virtual drive in a VM).

Debian-Installer had a catch for this with d-i cdrom-detect/eject boolean false but I cannot find a similar setting for my cloud-config file.

Hoping this exists, or if not is there a workaround? Thanks!

Nick Case
  • 21
  • 3

1 Answers1

2

If you want to stop the physical ejection, then I think you'd have to patch the /sbin/casper-stop script in the installation environmment. If you simply want to avoid the prompt to "Please remove the installation medium, then press ENTER" then you can create the file /run/casper-no-prompt. Either of these options could be done in early-commands of your autoinstall config.

autoinstall config like the following might work

early-commands:
    - sed -ie 's/eject -p/#eject -p/' /sbin/casper-stop
    - touch /run/casper-no-prompt

When the installer, subiquity, finishes and reboots, it simply runs /sbin/reboot. This can be seen in the subiquity source code.

The installer environment will run /sbin/casper-stop during shutdown because of the systemd service defined in /lib/systemd/system/casper.service. This script will display the prompt and eject the media. The source code of the script shows that the prompt is configurable, but the eject command is called as long as the cdrom is mounted, and advertised as removable.

See also

Andrew Lowther
  • 5,811
  • 1
  • 15
  • 23