Commit Graph

6310 Commits

Author SHA1 Message Date
Olivier Gayot 62dafb2c3d storage: add LP bug number to non-reg test and minor reword
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-04-19 09:22:08 +02:00
Olivier Gayot 69d6ef91e1 storage: add type hint for locked_probe_data
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-04-19 09:19:33 +02:00
Dan Bungert f43dae64e5
Merge pull request #1664 from dbungert/curtin-ntfs
snapcraft: rev for ntfsresize change
2023-04-18 19:21:13 +01:00
Dan Bungert fe2b3f2d88 snapcraft: rev for ntfsresize change 2023-04-18 19:13:54 +01:00
Dan Bungert 5586382890
Merge pull request #1660 from ogayot/no-probert-during-partitioning
storage: don't let probing discard storage config in the middle of partitioning
2023-04-18 19:09:00 +01:00
Olivier Gayot 9e4cd77d9d storage: add API test to cover probert run finishing during partitioning
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-04-18 11:01:26 +02:00
Olivier Gayot d8748c27fe storage: add unit tests to cover probe data locking
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-04-18 10:56:13 +02:00
Olivier Gayot cd25ec454f storage: don't let probing discard storage config in the middle of partitioning
If a probert run finished in the middle of partitioning, the probing
data would be loaded automatically and this would essentially discard
changes made so far by the user. This is not a desirable behavior.

Upon starting partitioning, we now prevent later probert runs from
automatically loading the probe data. Instead, the data is stored and
only loaded after after a reset.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-04-18 10:52:55 +02:00
Olivier Gayot 2f160ada88
Merge pull request #1661 from ogayot/probert-verbosity-fix
snapcraft: bump probert to pickup verbosity fix
2023-04-17 09:20:08 +02:00
Olivier Gayot 55a5ebd42b snapcraft: bump probert to pickup verbosity fix
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-04-17 09:08:10 +02:00
Olivier Gayot d4b9068dc5
Merge pull request #1659 from ogayot/apt-get-error-on-focal
mirror: clean environment before running apt-get
2023-04-14 16:27:48 +02:00
Olivier Gayot 3bb74546e2 mirror: clean environment before running apt-get
For mirror testing, we run apt-get update on the host. By default,
external commands run by subiquity inherit the environment variables set
by the snap (including LD_LIBRARY_PATH).

We don't ship apt-get or its dependencies in the subiquity snap, so we
want to reset LD_LIBRARY_PATH and other variables when running the
command.

Not doing so leads to the following error when running the subiquity
snap on a focal-based system:

 * apt-get: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not
   found (required by /snap/subiquity/4675/usr/lib/x86_64-linux-gnu/libsystemd.so.0)
 * apt-get: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not
   found (required by /snap/subiquity/4675/usr/lib/x86_64-linux-gnu/libsystemd.so.0)
 * apt-get: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not
   found (required by /snap/subiquity/4675/usr/lib/x86_64-linux-gnu/libsystemd.so.0)
 * apt-get: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not
   found (required by /snap/core22/current/lib/x86_64-linux-gnu/libcap.so.2)

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-04-14 16:13:36 +02:00
Olivier Gayot 0e957dfb9d
Merge pull request #1652 from ogayot/swap
filesystem: fix crash when editing swap partition in v2
2023-04-14 15:16:11 +02:00
Olivier Gayot aa6274c38e filesystem: fix crash when editing swap partition in v2
When we create a swap partition using v2_add_partition, the mount
parameter always has the value of None.

We do however, create a fake mountpoint object and assign it the value
of "" (empty string) so we know the swap partition is used although it's
not really mounted anywhere in the filesystem hierarchy.

Subsequently, when editing the swap partition, the mount parameter is
set to the empty string, not None.

This causes trouble in the create_mount function, which normally returns
immediately upon encountering None as the mountpoint.

Fixed by skipping the call to create_mount for a swap partition.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-04-14 09:51:33 +02:00
Dan Bungert b99544dfe6
Merge pull request #1657 from CarlosNihelton/seeded-cmds-wsl-490
[system_setup] Fixed paths for language-related commands
2023-04-13 14:22:38 -06:00
Carlos Nihelton 2e67005403
Fixed paths for lsc and locales commands
Subiquity snap doesn't stage language-selector-common nor locales
packages.
Attempting to run those commands require respecting the env previously
prepared by the caller, as well as fixing the commands paths
(or changing the PATH env var in the env preparation step).
Since the apt commands were already ran with a fixed path,
I'm applying the same principle in here.
Yet, for now, Jammy doesn't ship the l-s-c package seeded,
so a condition was preserved to avoid future crashes.
2023-04-13 16:11:05 -03:00
Dan Bungert cfd30c94eb
Merge pull request #1651 from dbungert/udi-tag-report
errorreport: tag with snap name
2023-04-13 10:21:38 -06:00
Dan Bungert cd03fea2f0 errorreport: tag report with snap name 2023-04-13 10:14:39 -06:00
Dan Bungert 232f2f9d8c errorreport: add tags capability
Future problem_report has a nice add_tags method, simulate it here.
Should be able to drop this with a core24 move.
2023-04-13 10:14:39 -06:00
Olivier Gayot c22ad1dc83
Merge pull request #1532 from ogayot/edit-lvm-bug
storage: fix crash when editing encrypted VG created in guided storage
2023-04-13 10:41:16 +02:00
Olivier Gayot 86c727fbce
Merge pull request #1648 from ogayot/fix-double-source-configure
Fix assertion in autoinstall API test
2023-04-12 17:12:45 +02:00
Dan Bungert 85b04ae399
Merge pull request #1647 from dbungert/probert-pr131
snapcraft: rev probert for diagnostics
2023-04-12 07:42:51 -06:00
Dan Bungert 748803b201
Merge pull request #1646 from dbungert/udi-log-apport
errorreport: get udi log
2023-04-12 07:42:34 -06:00
Dan Bungert 46b291b48f
Merge pull request #1643 from dbungert/u-u-fail-nonfatal
unattended-upgrades: failure is not install-fatal
2023-04-12 07:39:22 -06:00
Dan Bungert 8cbb1cf74c
Merge pull request #1642 from dbungert/u-d-i-slimy-snap-build
scripts: update slimy to handle u-d-i
2023-04-12 07:37:29 -06:00
Olivier Gayot 8298ec17c8 api: avoid post-ing to source in autoinstalls
When running autoinstalls, the source model will be marked configured
automatically after apply_autoinstall_config has run. The selected
source will be the one described in the autoinstall section or will
default to the legacy server entry: Ubuntu Server.

Doing an additional POST request can only make things inconsistent in
fully automated installs.

When the POST request is handled, most of the models may already have
applied their autoinstall configuration, and are already relying on the
previous source selected.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-04-12 12:15:53 +02:00
Olivier Gayot 6aa9452bb0 mirror: bail if source changes after applying autoinstall config
If the source model changes, the mirror model gets a chance to apply a
new apt configuration. However, if this happens during an automated
install, this is a recipe to disaster.

Make sure we raise an exception if a POST request to /source occurs
after the mirror model has started applying its autoinstall
configuration.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-04-12 12:13:32 +02:00
Olivier Gayot 938f2ffc24 mirror: avoid assertion error if the source changes at the wrong time
When the source model changes, the mirror model gets notified and
replaces the "apt configurer" instance with a new one. If this happens
in the middle of a "deploy apt configuration + run apt-get update"
operation, this leads to an assertion error.

Fixed by making sure we do the entire operation on the same "apt
configurer" instance.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-04-12 12:11:10 +02:00
Dan Bungert 8a71b7d1ed errorreport: get udi log 2023-04-11 18:35:09 -06:00
Dan Bungert fd1fc1c1d3 snapcraft: rev probert for diagnostics 2023-04-11 17:25:11 -06:00
Dan Bungert 9b13e0b0ee
Merge pull request #1639 from ogayot/autoinstall-no-netplan-apply-if-nm-enabled
network: don't run netplan apply if no autoinstall and nm is enabled
2023-04-11 16:09:47 -06:00
Dan Bungert b72a5397fb scripts: update slimy to handle u-d-i
If the target snap is ubuntu-desktop-installer, put subiquity changes in
the appropriate location.
2023-04-11 14:10:49 -06:00
Dan Bungert 800a1e9372 install: make unattended-upgrades non-fatal
Log the result if failed, ensure that this is also journal-visible.
2023-04-11 13:53:20 -06:00
Dan Bungert e71a9f98cd runner: show stdout/stderr on exception 2023-04-11 13:53:20 -06:00
Dan Bungert 7c5a7f4289 utils: stdout/stderr logger 2023-04-11 13:53:20 -06:00
Olivier Gayot 9d32ded2f9 network: don't run netplan apply if no autoinstall and nm is enabled
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Co-authored-by: Dan Bungert <daniel.bungert@canonical.com>
2023-04-11 19:43:50 +02:00
Dan Bungert 69713714d2
Merge pull request #1641 from dbungert/lp-2015521-guided-resize-non-last-logical
gaps: fix gap size in extended
2023-04-07 11:14:54 -06:00
Dan Bungert 5219ecf50c gaps: fix gap when before a partition in extended
We need the ebr space if we're doing logical partitions, but not for the
primaries.
2023-04-07 10:59:05 -06:00
Dan Bungert dc810414d8 gaps: add unittests for gap before part on msdos 2023-04-07 10:59:05 -06:00
Dan Bungert fa81e0981e test/api: regression test for LP: #2015521 2023-04-07 10:59:05 -06:00
Dan Bungert 0a4134cd4b
Merge pull request #1640 from dbungert/localectl
locale: switch to localectl set-locale
2023-04-07 07:40:10 -06:00
Dan Bungert fb2c6da2e6 locale: switch to localectl set-locale
Move away from localedef to fully set the locale.
2023-04-06 17:25:49 -06:00
Olivier Gayot d899ada0d0
Merge pull request #1637 from ogayot/kb-multi-layout
keyboard: fix use of multi-layout keyboard layout
2023-04-05 15:19:40 +02:00
Dan Bungert 70a2a668b1
Merge pull request #1636 from dbungert/udi-gh-1772
storage: restricted probes must gather fs info
2023-04-05 07:04:26 -06:00
Olivier Gayot a91dbfa004 keyboard: fix use of multi-layout keyboard layout
The XKB configuration guide shows that multi-layout configuration is
possible, as in the following example:

    Option "XkbLayout" "us,cz,de"
    Option "XkbVariant" ",bksl,"

which translates to:
 * layout "us" with no variant
 * layout "cz" with variant "bksl"
 * layout "de" with no variant

The same applies to /etc/default/keyboard.

We do make use of this ability to automatically set an alternative
keyboard layout for non latin keyboard layouts (e.g., Arabic "ara"
becomes "us,ara" so that users can toggle between American and Arabic
keyboard layouts.

In the following commit:

  13cae2488 keyboard: validate layout and variant

.. we started implementing early validation of the keyboard layout, but
we did not consider that multi-layouts are supported.

As a result, subiquity fails at keyboard selection when a non latin
keyboard layout is selected.

Fixed by making sure the validation expects possible multi-layout
setups.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-04-05 12:32:48 +02:00
Dan Bungert c921192db3 storage: restricted probes must gather fs info
In ubuntu-desktop-installer/issues/1772, a user formatted an existing
partition as ext4, which triggered the ESP to be "mounted".  Except this
mount step also formatted the ESP.

Previously, when we ran block probing, the restricted=False version
failed, which caused it to run a restricted=True probe.  The
restricted=True probe looks at block devices, but does not gather
filesystem information.  The esp "mount" check is also willing to format
the partition if it is unformatted.  (We do not have a distinction
between a partition that is unformatted and one for which we have not
obtained filesystem information.)

This user had block probing restricted=False fail due to LP: #2012722,
where Ventoy was in use and we handled the device mapper entry poorly.
While recreating the failure case, simply retesting with a build with
the fix for LP: #2012722 is enough to avoid this problem.  This is
because the restricted=False probe passes, which means filesystem info
is gathered, which means the mount step doesn't attempt to format it.

There will inevitably be other block probing failure cases for
restricted=False.  restricted=True must not leave people so vulnerable
to a partition reformat.

Gather filesystem information during a restricted=True probe.
2023-04-04 14:00:24 -06:00
Dan Bungert a8e2b3e700
Merge pull request #1634 from dbungert/bootable-disks
Bootable disks
2023-04-04 08:09:46 -06:00
Dan Bungert 965a49f28f storage/v2: remove potential_boot_disks 2023-04-03 17:39:17 -06:00
Dan Bungert 3a0e9ed425 storage/v2: mark can_be_boot_device on disks 2023-04-03 17:38:49 -06:00
Dan Bungert c8e30bcefc
Merge pull request #1630 from dbungert/sizing-policy
Sizing policy
2023-04-03 12:52:45 -06:00