We now invoke curtin install in a step-by-step mode. Before, we would
perform a single invocation of curtin install for the following stages:
* early (but no early_commands configured)
* partitioning
* extract
* curthooks
* hook
* late (but no late_commands configured)
We now run multiple invocations of curtin install, in 5 different steps:
* initial: does not run any stage per se but prepares curtin
for the next invocations (this invocation is not strictly necessary
and could be merged with the next step but having it separate makes
the flow easier to understand, I think)
* partitioning: runs the partitioning stage
* extract: runs the extract stage
* curthooks: runs the curthooks stage
The early and late stages were dropped since they would act as no-ops.
We also dropped the hook stage since it does nothing in Ubuntu.
The configuration files for each step ends up in
/var/log/installer/curtin-install/subiquity-{step_name}.conf
The log files for each step end up in
/var/log/installer/curtin-install/{step_name}.log
If errors occur, a tarball of the necessary logs end up in
/var/log/installer/curtin-install/{step_name}-error.tar
All files (i.e. configuration files, log files, error-files) are bundled
in the apport report in case of crash.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The filesystem object IDs are really only meant to be a semireadable
unique string, and not for display to end users. Partitions in
particular were bad in this respect, as they could look like the number
on the end was the partition number.
Uglify the object IDs a bit to try to convey the above.
This is a partial fix to canonical/ubuntu-desktop-installer#832. The
last missing piece is to set the DISPLAY environment variable but this
can be done in the subiquity startup script in UDI.
When executing late commands, we now start by executing run-parts over
the /etc/subiquity/postinst.d directory (by default) if it exists.
A failure in run-parts is not considered critical so any other
late_commands will run no matter what.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
A new class called Command is introduced. A Command instance has
arguments (i.e., either a string or an sequence of strings) and a
boolean called "check" that tells if an error should stop the
installation.
A Command instance also has helper methods to simplify its usage.
The early/late/error command controllers now have a sequence of Command
instances.
When loaded from an autoinstall config, the commands inherit the value
of the "check" attribute from the controller itself.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
In the source autoinstall section, the search_drivers key was marked
required. This made sense at the time when it was the only supported
key. However, now that we also support the source ID, we don't want
to force the user to supply search_drivers as well.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The source autoinstall section now supports the "id" field where the
user can supply the ID of a source, e.g., "ubuntu-server" or
"ubuntu-server-minimal".
If the field is not supplied, the installation will use the source
declared default: true (if any) in the source catalog. Otherwise, it the
first source declared will be used.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The function is_token_added_overlay supposedly returns a boolean. But
the absence of a final return False statement made it return None by
accident.
In practice, it should not make a difference because returning False or
None evaluate to False in a boolean context. But returning False is
cleaner (sorry Perl).
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
In the past, curtin log lines had the syslog identifier matching
"curtin_log.xxx". Nowadays, curtin commands are started via
systemd-run so they end up inheriting from the default
"subiquity_log.xxx" syslog identifier.
When updating the examples/curtin-*.json files, one must make sure to
filter out the entries that have the "subiquity_log.xxx" but are not
related to curtin invocations.
In the future, maybe we need to consider overriding the syslog
identifier when invoking curtin commands.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
We now use argparse on replay-curtin-log, which provides the --help
option along with named parameters for what used to be positional
parameters only.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>