1

I have an autoinstall config:

#cloud-config
autoinstall:
  version: 1
  late-commands:
    - curtin in-target --interactive --target=/target -- echo "Hello! This is output from late-commands"

While executing late commands, it will print:

finish:   subiquity/Late/run/command_0: curtin in-target --interactive --target=/target -- echo "Hello! This is output from late-commands"

Is there a way to make it print the output of a late-command, too? I want to debug late-commands.

Andrey Moiseev
  • 131
  • 1
  • 7

1 Answers1

2

My solution

I print /var/log/syslog on installation error in the error-commands autoinstall config section:

#cloud-config
autoinstall:
  late-commands:
    - echo "This is the error to debug" && exit 125
  error-commands:
    - tail -200 /var/log/syslog

How it works

This subiquity code handles early-commands, late-commands and error-commands: https://github.com/CanonicalLtd/subiquity/blob/a76581cd2b973b55e55c6ac05b5bf47168493140/subiquity/server/controllers/cmdlist.py#L77-L120

How these autoinstall keys handle output:

  • early-commands – echo+syslog
  • late-commands – syslog
  • error-commands – echo+syslog if autoinstall else syslog

So in late-commands I cannot echo to console. But I can echo from error-commands, provided that I am running a non-interactive autoinstall. I use it to print the last lines of syslog, which contain full error message: This is the error to debug.

Andrey Moiseev
  • 131
  • 1
  • 7