Until recently, subiquity and curtin had shared ownership regarding
mounting/unmounting the cdrom to/from the target:
* curtin was responsible for bind-mounting /cdrom to /target/cdrom
* subiquity was responsible for unmounting /target/cdrom
We recently made subiquity responsible for bind-mounting the cdrom to
the target too, which is a good thing.
Unfortunately, we now attempt to unmount the cdrom from the target
twice, at the end of the installation:
* once because we explicitly unmount the cdrom from the target before
restoring the APT config on target
* once because subiquity has a mechanism that automatically unmount
everything that it mounted, in reverse order.
This leads to a crash at the end of the installation.
Fix this issue by making sure we only try to unmount the cdrom once. If
we unmount it before restoring the APT config, then we don't want to
unmount it automatically anymore.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Where we don't have a proper snapd support.
Approach similar to the one used in UDI.
For the case where we have Subiquity snap, but not UDI.
The script added is a stripped version of the UDI one.
Removed code related to:
- GTK and GDK;
- GI repository;
- Xkb;
Preserved:
- Python;
- XDG directory definitions;
- font config;
When a client sends a GET /snaplist request and an error occurs on the
server side, we return a response of the following form:
{ "status": "FAILED", ... }
This effectively gives a chance to the client to retry the same request
and expect a different outcome (for instance when a temporary network
failure occurs).
Having said that, when the server returns "status": "FAILED", it also
automatically marks the snaplist model configured. This is wrong because
if the next GET /snaplist request succeeds, the user will be prompted to
select some snaps to install ; but the installation will already be
running in the background. Depending on the timing, it might or might
not install the snaps that the user selected.
Fixed by not marking the snaplist model configured automatically. The
client is made responsible from sending a POST /snaplist ; even in case
of error.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
I've wanted to do this for ages and getting ready to talk to the snapd
API provided an excuse :-) (as, for example, to get info about a snap
you talk to the /v2/snaps/{snap_name} endpoint). As before, the server
part isn't strictly needed but I forgot about that and actually
implemented it first. Oh well, we'll need it if I implement my idea
described in a comment in apidef.py to make the network API more RESTish.
The snapd API does not JSON-encode query arguments, they are just all
strings. I only need the client side of this really but implementing it
server side might avoid confusion down the road.
Similarly to field names, the snapd API returns objects with values that
should be part of an enumeration, but with values that are not all
Python identifiers (e.g. "system-seed"). To allow these to be mapped to
enum's in Python that are not insanely annoying to use, allow a
Serializer to serialize enum's to and from their values rather than
their names (which remains the default behaviour).
Many snapd APIs return JSON objects with field names that are not valid
Python identifiers (such as "display-name") so if we're going to
translate them to and from Python objects we need to be able to override
the field name in the serialized form.
Some snapd APIs return JSON objects with lots and lots of fields and I
don't want to have to declare the ones I am not interested in. Also, I
think snapd adds fields over time, so I don't want to be broken when
this happens.
to the WSLSetupOptions controller.
Misuse of the default_loader().
That's meant for loading /etc/wsl.conf.
WSLSetupOptions is by design not related to that config file.
When editing a LVM logical volume (LV), Subiquity would crash with the
following error:
filesystem/gaps.py", line 244, in movable_trailing_partitions_and_gap_size
pgs = parts_and_gaps(partition.device)
AttributeError: 'LVM_LogicalVolume' object has no attribute 'device'
When we changed the implementation to use
movable_trailing_partitions_and_gap_size, we did not pay attention to
the LVM use case.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The mirror controller is responsible from creating the APT configuration
once its associated model is marked configured. However, the APT
configuration is also dependent on the source model being marked
configured.
When subiquity is used for the server installer, the client immediately
sends a POST /a/meta/client_variant request. This ends up marking the
source model as configured (even though the default value does not make
much sense). So we never end up in a scenario where the mirror model is
marked configured before the source model.
When Subiquity is used by a different client, such as the
ubuntu-desktop-installer, it is possible that we mark the mirror model
configured first. This ends up crashing the installer.
Fixed by adding a dependency on the source model so that we do not end
up creating the APT configuration too early.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
When creating the UI for snaplist, if the server returns a FAILED status
when we request the list of snaps, we want to move on to the next
screen.
However, calling self.next_screen in the make_ui function while also
returning an actual view triggers a race condition. Depending on the
order of execution of the instructions (which are asynchronous), the
snaplist view can end up being shown even though we moved to the next
screen. This ends up doing funny things upon clicking done.
Fixed by raising the Skip exception after making sure we mark snaplist
configured.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
When pressing the "Try again" button on the snaps list, Subiquity would
crash with:
TypeError: SnapListView.wait_load() takes 1 positional argument but 2
were given
This happens because urwid passes the sender to the callback - which we
need to discard or accept it in the signature.
Fixed by discarding the sender.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
During the installation, in the curthooks stage, curtin generates the
initramfs. Unfortunately, the generated initramfs did not honor the
keyboard mapping selected by the user during installation. Therefore,
when LUKS encryption is used for the root file-system, the prompt for
the passphrase ignores the keyboard layout set by the user.
To ensure that the initramfs uses the right keyboard layout, the
/etc/console-setup/cached_* files must be updated before the initramfs
gets created. At the beginning of the curthooks stage, we now call
setupcon --save-only in the target to refresh those files if needed.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Raise SchemaValidationError when any autoinstall.user-data config
is invalid cloud-init cloud-config schema.
If any deprecated config keys or values are provided under
autoinstall.user-data, log warnings about those deprecations.
Raise SchemaValidationErrors when invalid config is provided to
cloud-init as merged cloud-config for the installed target.
Log warnings if any deprecated cloud-config keys are present in
merged cloud-config.