Automated Server installer config file reference

I noticed, that adding a section below the field user-data does not have any effect.

Could you include an example in the documentation on how to e.g. add a user using the user-data section? This could be a user with e.g. an empty password, SSH-Access and sudo: ALL=(ALL) NOPASSWD:ALL settings.

Several tries using something like this failed (even though the yml is syntactically correct):

user-data:
  users:
    - default
    - name: foobar
      gecos: Foo B. Bar
      primary_group: foobar
      groups: users
      selinux_user: staff_u
      expiredate: '2032-09-01'
      lock_passwd: false
      passwd: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0" # ubuntu

looks like you did not “add a section to user-data” but you instead added a new top-level object called “users” … yaml requires proper indentation of the blocks …

1 Like

Sorry, this was a formatting error, when pasting to the forum. The .yml file was idented correctly, so the issue still persists.

1 Like

If you have an identity section then the users section is not used. I have examples at https://askubuntu.com/a/1385096/376778

1 Like

Thank you very much, that helped. The documentation should then maybe include your example and explicitly state, which section takes precedence:

If you supply this, your identity section is ignored and the users section is taken instead (but then it’s your responsibility to make sure that you can log into the installed system!).

The hostname must then be set also in the user-data section, instead of the identity section.

1 Like

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?