Commit Graph

6186 Commits

Author SHA1 Message Date
Michael Hudson-Doyle c08666f418 move server client from guided_GET to v2_guided_GET 2023-07-04 16:59:38 +12:00
Michael Hudson-Doyle 7a2db2d3f7 test and fix for defective encrypted case 2023-07-04 16:57:19 +12:00
Michael Hudson-Doyle 7d6371ee45 add a way for v2_GET to include appropriate raid devices 2023-07-04 16:47:58 +12:00
Olivier Gayot 6424c3c52b oem: ensure a single kernel gets installed
Before running curthooks, we now look in the target if there is an
installed kernel. If there is, we instruct curtin _not_ to install
another one.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-07-03 09:59:45 +02:00
Olivier Gayot b844119b79 oem: disable OEM meta-packages installation on core boot classic
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-30 20:53:12 +02:00
Olivier Gayot e6ccfcc118 oem: allow to disable install on desktop and force install on server
By default, OEM meta-packages get installed on ubuntu-desktop and don't
get installed on ubuntu-server. Using autoinstall, we can now give more
control. The autoinstall section supports the following:

Install on server and desktop:

  oem:
    install: true

Do not install even on desktop:

  oem:
    install: false

Install only on desktop (the default):

  oem:
    install: auto

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-30 20:53:12 +02:00
Olivier Gayot 7e8c1eedd5 oem: raise error on certified hardware if a specific kernel is requested
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-30 20:53:12 +02:00
Olivier Gayot 30dff3f8d9
Merge pull request #1702 from ogayot/install-oem-kernel-selection
Override requested kernel flavor on certified hardware
2023-06-30 20:52:05 +02:00
Olivier Gayot f92e675abb oem: raise error on certified hardware if a specific kernel is requested
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-30 20:51:09 +02:00
Olivier Gayot 527522f748 oem: skip listing OEM metapkgs on ubuntu-server
OEM meta-packages have an attribute stating if they want the OEM kernel
or the "default" kernel to be installed alongside them.

That said, in the OEM archive, they expect the "default" OEM kernel to
be the HWE kernel. This is only true for ubuntu-desktop. Let's not
install OEM meta-packages on ubuntu-server for now.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-30 20:51:09 +02:00
Olivier Gayot 69a840fdb9 oem: check if OEM meta-packages want OEM or default kernel flavor
When installing on certified hardware, we now look for the
Ubuntu-Oem-Kernel-Flavour attribute of the OEM meta-package to determine
which kernel flavour we should use. This attribute can take two values:

 * oem -> in which case we make use of the override to install the
          OEM kernel flavor
 * default -> in which case we get the kernel flavor that was originally
   configured.

If the attribute is not present or contains any other value, it is
treated the same as if it was "oem".

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-30 20:51:09 +02:00
Olivier Gayot 1c2979811c kernel: move conversion flavor -> pkgname outside the ctrler
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-30 20:51:09 +02:00
Olivier Gayot cae7765fbf kernel: add a way to override the kernel metapkg we want to install
Before running curtin's curthooks, we use the kernel model to configure
which kernel meta-package we want to install on the target system.

There are multiple ways to select the kernel flavor, including
autoinstall directives or placing a file in
/etc/subiquity/kernel-meta-package.

That said, if we install Ubuntu on certified hardware, the OEM
meta-package will have something to say about the expected kernel
flavor. When installing the kernel meta-package, it will automatically
pull the kernel that it expects to run on.

Therefore, we should make it possible to override the kernel flavor so
that we don't end up with multiple kernels installed.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-30 20:51:09 +02:00
Olivier Gayot fc458ff109
Merge pull request #1700 from ogayot/install-oem
Install (and optionally upgrade) available OEM meta-packages
2023-06-30 20:49:33 +02:00
Olivier Gayot 6492ddc50c
Merge pull request #1704 from ogayot/doc-add-active-directory-schema
documentation: update autoinstall schema to include active-directory
2023-06-30 10:53:03 +02:00
Michael Hudson-Doyle 5ba9e524d8
Merge pull request #1697 from mwhudson/reset-only
support for creating only a reset partition
2023-06-30 16:53:55 +12:00
Michael Hudson-Doyle 64ad6514a3 suggestion from review 2023-06-30 16:43:01 +12:00
Dan Bungert 446f3772d3
Merge pull request #1687 from dbungert/default-user-none
server: fix when cloud-config has no default user
2023-06-29 16:20:23 -06:00
Dan Bungert 5bd9a4fc94 server: fix when cloud-config has no default user
If a cloud-config is sent that adjusts the users but creates no default
user, Subiquity crashes with a exception while mishandling the None.

cloudinit.distros.ug_util.extract_default is documented as returning
None in the event that the default user cannot be found.

Example bad cloud-config:
```yaml
users:
- name: ubuntu-server
```
2023-06-29 15:51:01 -06:00
Olivier Gayot 8f7760462a documentation: update autoinstall schema to include active-directory
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-29 14:26:54 +02:00
Michael Hudson-Doyle 0f78185b9a add some unit tests 2023-06-28 13:43:52 +12:00
Michael Hudson-Doyle bc11d0df3e maybe fix CI 2023-06-28 12:45:34 +12:00
Michael Hudson-Doyle 283e07a615 add integration test for reset-partition-only
This requires some tweaks to make the test machinery accept an
autoinstall that doesn't do most of the things we usually expect.  Also
set the .target attribute to None when reset-partition-only is true to
catch more issues in the dry-run environment.
2023-06-28 12:21:09 +12:00
Michael Hudson-Doyle 94172698f5 more bits and pieces 2023-06-26 17:01:57 +12:00
Michael Hudson-Doyle 35b951c87a skip some other steps in stage 1 2023-06-26 17:01:57 +12:00
Michael Hudson-Doyle 663a752d3a one more 2023-06-26 17:01:57 +12:00
Michael Hudson-Doyle 19f6b37b9b extremely naive way of having only a reset partition 2023-06-26 17:01:57 +12:00
Olivier Gayot 6123601cba oem: install (and upgrade) OEM meta-packages if available
When OEM meta-packages are available, install them before running
curthooks. If we are online, we also upgrade the metapackages so that
they are upgraded to their version in the relevant OEM archive. This
will effectively pull the kernel.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-23 10:05:21 +02:00
Olivier Gayot 64aabc1dd0 ubuntu-drivers: try to avoid OEM metapkgs when installing drivers
When installing third-party drivers, we now pass the --no-oem option to
the ubuntu-drivers install command. Because of LP #1966413, the option
might get ignored, which is not ideal but sort of acceptable - because
we want OEM meta-packages installed unconditionally anyway.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-23 10:05:21 +02:00
Olivier Gayot 044bec1724 ubuntu-drivers: don't list OEM meta-packages as drivers
When we want to list third-party drivers, we want to avoid listing OEM
meta-packages as well. The ubuntu-drivers --no-oem list would do it but
we can't reliably use it for now. Let's manually exclude oem-*-meta
packages from the list.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-23 10:05:21 +02:00
Olivier Gayot ef7668d9f7
Merge pull request #1701 from ogayot/etc-apt-discard-selectively
apt: reset only diverted files on deconfigure
2023-06-23 09:35:19 +02:00
Olivier Gayot 174e7afdd0 apt: reset only diverted files on deconfigure
Before starting the actual installation, we make changes to etc/apt
directory in an overlay so that the packages are pulled from the media
instead of the network.

At the end of installation, we need to revert these changes. We used to
replace the etc/apt directory on the target by the etc/apt directory
from the configured overlay.

This is a simple way to revert the temporary changes. Unfortunately, it
also removes configuration files that extra packages may have installed
in etc/apt. For instance, when installing an OEM meta-package, a
etc/apt/sources.list.d/<oem-meta-package>.list gets installed.

If we reset etc/apt to its content from the configured overlay, we lose
this file.

Fixed by selectively discarding changes to the files that subiquity
modified.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-22 09:55:30 +02:00
Olivier Gayot fa29b9088b
Merge pull request #1696 from ogayot/umockdev
ubuntu-drivers: add ability to run ubuntu-drivers in dry-run with umockdev
2023-06-15 10:11:22 +02:00
Olivier Gayot e56053f2bb ubuntu-drivers: add support for umockdev in dry-run
When running subiquity in dry-run mode with SUBIQUITY_DEBUG=run-drivers,
we now support using a YAML file describing the hardware in a
umockdev-compatible way. This allows to give some control on what
ubuntu-drivers list will reply.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-15 09:37:02 +02:00
Olivier Gayot 364e718c60 apt-deps: add ubuntu-drivers-common needed for dry-run
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-15 09:18:29 +02:00
Olivier Gayot 59b959b7c5
Merge pull request #1690 from ogayot/list-oem
Add controller + model listing OEM meta-packages
2023-06-13 19:05:59 +02:00
Dan Bungert d420d91ed0
Merge pull request #1695 from dbungert/doc-clarify
doc: update README
2023-06-13 08:08:28 -06:00
Olivier Gayot eea922cd1b oem: add GET endpoint returning OEM meta-packages to be installed
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-13 14:23:42 +02:00
Olivier Gayot a804bbfe8b oem: add minimal model + controller
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-06-13 14:14:05 +02:00
Michael Hudson-Doyle 40b18f8fe3
Merge pull request #1694 from mwhudson/guided-reasons
return some information about disallowed guided options
2023-06-13 10:04:51 +12:00
Michael Hudson-Doyle ab6e643d50 start to return disallowed guided options 2023-06-13 09:55:17 +12:00
Michael Hudson-Doyle 702badf815 record allowed and disallowed capabilities for each source variation
Also rewrite a bit of my old code even I now find confusing.
2023-06-13 09:55:17 +12:00
Michael Hudson-Doyle 92560a87b5 add disallowed types and fields 2023-06-13 09:55:13 +12:00
Michael Hudson-Doyle 3ec6e6e2bd rename GuidedStorageTarget* 'capabilities' attribute to 'allowed' 2023-06-13 09:54:14 +12:00
Michael Hudson-Doyle 7e043a0950
Merge pull request #1693 from mwhudson/possible-to-targets
rename GuidedStorageResponseV2.possible to targets
2023-06-13 09:53:02 +12:00
Michael Hudson-Doyle 6c0ea12857
Merge pull request #1691 from mwhudson/flag-reset-partition
set "mstfres" flag on reset partition
2023-06-13 09:52:51 +12:00
Michael Hudson-Doyle 760c41913b set "mstfres" flag on reset partition 2023-06-13 09:22:28 +12:00
Michael Hudson-Doyle 9ed9f4e469 update curtin and adapt to API change 2023-06-13 09:22:24 +12:00
Michael Hudson-Doyle e2bc77b706
Merge pull request #1692 from mwhudson/ignore-bad-systems
log and ignore systems (in the snapd sense) we cannot install
2023-06-13 08:22:57 +12:00
Dan Bungert a26df84032
Merge pull request #1656 from kubiko/main
bin/console-conf-wrapper: prefer use of snapd/modeenv
2023-06-12 14:08:13 -06:00