When running an autoinstallation with only “network” as an interactive
section, the installation hanged after the following steps:
finalizing installation
running 'curtin hook'
curtin command hook
executing late commands
where in normal conditions, the next step is:
final system configuration
Also, querying the meta/status endpoint at this point shows that the app
is in POST_WAIT state.
The problem is:
the network model is declared as both an “install” model and a
“postinstall” model (it is the only one we have AFAIK)
when calling .configured() for a given model, we only trigger /at max/
one event. Either:
* install_event (if the model is an “install” model - and it is the
last one configured)
* postinstall_event (if the model is a “postinstall” model but not an
“install” model - and it is the last one configured)
* no event (as in most cases)
So when we call .configured() for the network model, we /can/ trigger
the install_event but can never trigger the postinstall event.
Therefore Subiquity, will wait forever until something triggers the
postinstall_event
Fixed by accepting to trigger the install_event and the
postinstall_event in a single call to .configured.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Passing --use-fuse to scripts/kvm-test.py allows to run as non-root.
It requires installation of the package fuseiso so the switch is
disabled by default.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Tests in real WSL2 environment revealed that update-locale checks fails but with the "--no-checks" option it updates the locale files accordingly and when the image restarts the locale is correctly set.
When comparing two snap versions that meet the following conditions, a
TypeError was raised:
* a.major == b.major
* a.minor == b.minor
* a.git_build_id is None and b.git_build_id is None
Fixed by first converting the git_build_id of both variables to a float
before comapring them.
Also added a unit-test to cover this scenario.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Since 06ac3f92, we invoke kvm directly through subprocess.run.
Therefore, we must not add extra quotes around the -append options,
otherwise they persist and are passed in the kernel command line:
$ cat /proc/cmdline
"autoinstall subiquity-channel=stable" initrd=initrd
Later on, we fail to parse "autoinstall" and "subiquity-channel=stable"
as two distinct options.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The function drive() used to return a string in the following format:
"-drive file=/path/to/iso,..."
However, qemu/kvm expects "-drive" to be an argument and
"file=/path/to/iso,..." to be another argument.
The command was constructed as below since the beginning:
kvm = [
"kvm",
"-cdrom", "custom.iso", # <- OK
"-drive file=/path/to/iso,...", # <- NOK
]
Before 06ac3f92, we would join all the arguments using spaces before
executing the kvm command. Therefore we would luckily end up with a
correct command:
" ".join(kvm) -> "kvm -cdrom custom.iso -drive file=/path/to/iso,..."
However, now that we supply the command to subprocess.run directly, the
problem shows up.
Fixed by returning a tuple("-drive", "file=/path/to/iso,...") from
the drive() function.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
* select the relevant button by default when applicable
* make the list of services scroll properly
* add empty lines consistently
* mention that services can be enabled through `ua` (after installation)
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The UAClientUAInterfaceStrategy can now optionally be initialized with
the path to the ubuntu-advantage entry point. Additionally, one can also
specify which Python interpreter should run it.
We leverage on this to force the use of:
* the Python installation from the Subiquity snap
* the ubuntu-advantage-tools integrated to the Subiquity snap
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
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