We got multiple bug reports in the past stating that the installer is
not honoring some part of the apt settings; either supplied by means of
autoinstall (e.g., pinning) or via the subiquity UI (e.g., proxy).
What happens under the hood is that curtin overwrites the APT settings
as part of the curthooks stage ; effectively discarding earlier settings
applied in the apt-config stage.
Curtin does so because we pass debconf_selections directives to
curthooks. In the past, curtin used to handle debconf_selections
separately but nowadays it considers that they are part of the APT
config. As a result, it decides to run apt-config again (but with a
close to empty configuration) as part of the curthooks stage.
We now pass debconf_selections as part of the apt-config stage. This
should hint curtin not to run apt-config again as part of curthooks.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Oftentimes, we want to simulate a specific behavior of the application
when running in dry-run mode. To do so, we use either command line
parameters or environment variables.
This patch introduces a configuration object for dry-run executions
only. The object can be automatically loaded from a JSON file specified
via the --dry-run-config CLI argument.
Such a configuration object should help us cover way more test cases.
Going forward, I would like to use this object for things like:
* drivers - to instruct Subiquity what third-party drivers it should
suggest ; or if Subiquity should run ubuntu-drivers on the host
instead.
* ubuntu-pro - to specify the ua-contracts test environment URL - or
predefined automatic replies for the server
* to assume that /var/lib/snapd/seed/systems directory exists on the
source (or not).
* to specify the Ubuntu release that is returned by lsb_release ; can
be used to test behavior on LTS vs non LTS releases.
*
* ...
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The second `trap ... EXIT` registration meant that the first one, the
one repsonsible for providing a clear PASS / FAIL at the end, was not
being shown.
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 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>
timeout 60 might be too short for someone with lots of network
interfaces.
Since we grab the PID and run the server in the background, the timeout
is not critically necessary.
Before, we would not run answers for the source controller if only one
source was specified. The controller would automatically get marked
configured.
Since we're adding a new "search drivers" option in this screen, we need
to make it interactive in integration tests now.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
In order we place:
* the arguments that are for client & server
* the arguments for the client only
* the arguments for the server only
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The trap on ERR doesn't trigger in all the cases that we want.
The EXIT trap seems to be more robust, albeit with the requirement to
actually check the result code.
Move from using .subiquity as output-base to a tmpdir. This solves
several practical problems, like accidentally running the tests while
dryrun is open in another terminal or any other case where the server
process that is connected to is not the one that is expected.
Also makes cleanup nicer.
On failure, it will show which temporary directory was used to allow for
easy log examination.
The autoinstall schema for "apt" now supports the "preferences"
configuration. Each preference element should contain the properties
described below, that 1:1 map with the keywords from apt_preferences(5):
* package <-> Package:
* pin <-> Pin:
* pin-priority <-> Pin-Priority:
These preferences are forwarded to curtin through
subiquity-curtin-apt.conf. Support for these rules must be added to
curtin as well.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
When running integration tests, the LANG variable in
.subiquity/etc/default/locale is unquoted. The pattern that we use
expects quotes so it does not match.
Fixed by making the test work with or without quotes.
In case quotes are not present, the final part of the pipeline will fail
to find a delimiter so it will print the line unchanged
excerpt from cut(1)
-f, --fields=LIST
select only these fields; also print any line that contains
no delimiter character, unless the -s option is specified
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Looking at the logs, we can observe that the below command does
not do what it is intended to do:
if [ -z "$( ls .subiquity/var/cache/apt/archives/) | grep $lang" ] ; then
++ ls .subiquity/var/cache/apt/archives/
+ '[' -z 'language-pack-en:amd64
wamerican:amd64
wbritish:amd64 | grep ' ']'
The "| grep $lang" part does not execute because it is outside the $()
construct. Therefore, the -z check is always false.
We can fix it by moving the "| grep $lang" part inside the subshell
construct but I took the opportunity to drop the use of the subshell.
Also added --fixed-strings and --quiet options to grep.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
* The mixture of storage for disable_components in and out of the config
dict was confusing and caused bugs, depending on the flow
* disable_components now solely lives in the dict, like other items
- This is a cleanup for SystemSetup per DEENG-134 and DEENG-139
- Default user should be set by the WSL launcher.
- Shutdown/reboot actions also.
- Added a structured form of communication between OOBE and launcher.
- /run/launcher-command