Automated Server installer config file reference

Thank you very much @kbrannen for your initial idea to get interactivity in this installer. I implemented this and it worked great but was not what I wanted. Today I remembered my firstboot script which I use to get around a gnome flaw and it is working wonderful:

How to get interactivity during autoinstall using whiptail

First create a script which contains your commands:

- |
  cat <<'EOF' | tee -a /get_userdetails.sh
  #Change to tty3 to display the dialog
  if ! chvt 3 &>/dev/null; then
    break
  fi

  export TERM=linux
  export NCURSES_NO_UTF8_ACS=1

  printf "\ec"

  # Hostname dialog
  default_hostname=focal-ai
  custom_hostname=$(whiptail --inputbox "Please enter a Hostname:\n\nDefault: [$default_hostname]" 9 30 --clear --nocancel --ok-button "Enter" 3>&1 1>&2 2>&3)

  if [[ -z $custom_hostname ]]; then
    custom_hostname=$default_hostname
  fi

  sed -i 's/focal-autoinstall/'"$custom_hostname"'/' /autoinstall.yaml

  #Change back to tty1
  if ! chvt 1 &>/dev/null; then
    break
  fi

  EOF

Then call the script the following way to block the installer from continuing:

- bash /get_userdetails.sh <> /dev/tty3 >&0 2>&1

Preinsert whatever you want to replace or however you want it:

  # User section
  user-data:
    hostname: focal-autoinstall

Have fun with nice whiptail dialogs :slight_smile:

EDIT: Not tested but might work for late-commands, too

While update is defined, it doesn’t look like updates is. This appears to only have the option of security (default) or all pertaining to which updates are ran post install. It may be worth defining the declaration. This was a fairly recent addition:

https://github.com/canonical/subiquity/blob/a0e2e244bd3fb32430ea9f5fd2d3a5fe1b73f43c/subiquity/server/controllers/updates.py

1 Like

Throws a syntax error at @. Additionally, I can find no rsyslog class in cloudinit/reporting/handlers.py

1 Like

Hello

I’m trying to create minimal 22.04 installation . Is it possible to somehow remove packages during autoinstall? I was trying to use debconf-selections for this and skip some tasks:

debconf-selections: |
  tasksel tasksel/first multiselect ubuntu-server-minimal
  tasksel/skip-tasks multiselect ubuntu-standard

also tried to skip server but no combination works and I always get the same amount packages installed as in the default.

Best regards

The packages installed are not being selected, but come straight from the image included with the installer. With 22.04 there is a minimal image, but I’m not aware of any way to specify an image with autoinstall.

However, I did come up with this kludge to install the minimal image using autoinstall. I’ve gotten it to work with 22.04 ( subiquity 22.04.2).

#cloud-config
runcmd:
  - |
    cat /cdrom/casper/install-sources.yaml | awk 'NR>1 && /^-/{exit};1' > /run/my-sources.yaml
    mount -o ro,bind /run/my-sources.yaml /cdrom/casper/install-sources.yaml

It essentially changes the install-sources.yaml configuration so the minimal image is the only one listed and will be used by default.

You could also try to use late-commands to uninstall packages.

1 Like

Confirm the “@” error (cloud-init schema --config-file <file> will also report this).

Is there any complete documentation on these options? The doc article just gives examples.

Would it be helpful to file a bug (for documentation or for subiquity itself)?

Is it possible to pull the completed autoinstall.yaml from a system after you’ve filled out the interactive installer? (Before rebooting). Specifically the storage section on a complicated setup.

Also re storage mapping is there any easy way to match on satassd vs nvmessd

@itjamie The installed system will contain a copy of /var/log/installer/autoinstall-user-data. If you catch it before reboot, you can find the file as well in the same location in the installation environment.

1 Like

There seems to be an error in the shutdown section:

shutdown

type: string (enumeration)
default: reboot
can be interactive: no

Request the system to shutdown or reboot automatically after the installation has finished.
Supported values are:

  • reboot
  • shutdown

“Shutdown” is not a supported value. It should be “poweroff”.

Fixed, I appreciate it!

Could you please write an example for this section:

“”"
When using the “lvm” layout, LUKS encryption can be enabled by supplying a password.

storage:
  layout:
    name: lvm
    password: LUKS_PASSPHRASE

The default is to use the lvm layout.

sizing-policy

The lvm layout will, by default, attempt to leave room for snapshots and further expansion. A sizing-policy key may be supplied to control this behavior.

type: string (enumeration)
default: scaled
“”"

It doesn’t seem to work for me. When I supply LUKS_PASSPHRASE the installer seems to hang, and sizing-policy is ignored - not sure where it should be placed.

Thing I’ve tried:

autoinstall:
  storage:
    layout:
      name: lvm
      password: secret
      sizing-policy: all

I’ve tried it for Ubuntu 22.04.02 LTS, maybe these options only work for 23? If so, how can I check?

Hi @golebiewsky, thanks for trying out the new stuff. I’m hoping to incorporate doc improvements including the relevant minimum version of Subiquity needed for a given autoinstall feature.

You’ll need a newer Subiquity than what’s in the 22.04.2 LTS ISO. If you’d like these features, please allow the Subiquity snap to refresh to version 23.04.2 (or later). This autoinstall snippet should do the job for refreshing the snap.

refresh-installer:
  update: yes

Your autoinstall snippet should be correct. I ran a test locally like below and it works as expected.

#cloud-config
autoinstall:
  refresh-installer:
    update: yes
  storage:
    layout:
      name: lvm
      password: secret
      sizing-policy: all
  identity:
    realname: ''
    hostname: ubuntu
    username: ubuntu
    # password is ubuntu
    password: '$6$wdAcoXrU039hKYPd$508Qvbe7ObUnxoj15DRCkzC3qO7edjH0VV7BPNRDYK4QR8ofJaEEF2heacn0QgD.f8pO8SNp83XNdWG6tocBM1'
  version: 1

A few comments on the docs for autoinstall:

The linked page says to suggest improvements in this thread. If a bug report would be better, I’m happy to file it.

Thanks,
Ross

Thanks for the feedback Ross.

the style of autoinstall-reference makes it nearly impossible to know the structure of these

I strongly agree. We plan to move the Autoinstall documentation to readthedocs. It would look similar to https://cloudinit.readthedocs.io/en/latest/reference/modules.html when we’re done.

the schema for storage is missing

Not yet implemented, that would also be good. Storage is unquestionably the hardest part.

1 Like

the style of autoinstall-reference makes it nearly impossible to know the structure of these

I strongly agree. We plan to move the Autoinstall documentation to readthedocs. It would look similar to https://cloudinit.readthedocs.io/en/latest/reference/modules.html when we’re done.

Great, this would be a big improvement!

One more question: the docs troubleshooting aren’t useful. As far as I can tell, the default reporting config already prints all of the existing logs - is this correct? Maybe there’s some way to get a shell on another tty to see what’s happening?

Thank you @dbungert for the answer!

Running your config exactly as you pasted it or just by adding:

refresh-installer:
    update: yes

seems to switch the installer to manual mode. It asks me for language, disk formatting and so on. I’m running installer in UEFI mode via PXE, using dnsmasq and nginx. Maybe some other application is breaking it.

I’m sorry, my fault! I was using yaml-formatter which removed all of the comments including #cloud-config which stopped the autoinstall from being automatic :slight_smile:

Setup worked for me for server installation now I will try to install desktop :slight_smile:

1 Like

i specify the kernel version as below ,but it doesn’t work . After install finished ,the kernel will always be 5.4.0-150
kernel:
package: linux-image-5.4.0-125-generic

1 Like

With the 22.04 installer image (subiquity 22.04.2) I found that /run/kernel-meta-package was created with the content linux-generic and that took precedence over the autoinstall configured kernel package.

My solution was an autoinstall snippet that used early-commands to delete /run/kernel-meta-package.

#cloud-config
autoinstall:
  kernel:
    package: ${kernel}
  early-commands:
    - |
      rm /run/kernel-meta-package
      true

Related answer of mine: https://askubuntu.com/a/1444875/376778

2 Likes

Any way to configure WiFi network?

1 Like