7 Commits

Author SHA1 Message Date
alfonsosanchezbeato
20cde6b251 many: build drivers tree when current mount is not the target mount (#14047)
* tests: fix muinstaller tests for 24

* many: build drivers tree when current mount is not the target mount

In some cases (when using the snapd install API or when installing
from initramfs), the place where the kernel snap / components used for the
installation are mounted is different to the final location in the
installed system. This change considers this so the drivers tree is
generated with symlinks pointing to the final expected location.

* overlord: use model to check if we need to set-up drivers tree

instead of using a device context, as for the installation using snapd
API case we have a model but not a context.

* tests/lib/tools/setup_nested_hybrid_system.sh: re-try kpartx -d

* tests/muinstaller-real: check that drivers tree is created

* tests/muinstaller-real: we need a bigger disk with latest kernel

* tests/lib/tools/setup_nested_hybrid_system.sh: clean up

after building muinstaller. On classic we have weird issues otherwise
due to a desktop agent installing lxd.

* tests/lib/prepare-restore.sh: purge lxd-installer

lxd-installer was causing failures in the restore step for 24.04.
2024-06-11 20:07:52 +01:00
alfonsosanchezbeato
b052830f37 many: build drivers tree on install (#13923)
Build drivers tree on installation so kernel modules can be found on first boot after installation (otherwise the modules would be available too late, after initial installation of the kernel has happened while seeding).

Also, make sure that the tree is not re-created when seeding, and add a spread test for kernel-modules components.

* dirs: add function to get root of drivers trees

* kernel: do not recreate drivers tree if it already exists

On installation, a drivers tree has already been copied to the data
partition. Do not re-create if found when seeding happens (note though
that on preseeding we will not find the tree and we will still create
it).

* gadget/install: create device tree on installations

Create a device tree on installation so we have it on first boot.

* o/snapstate: fix task message

* tests/nested/manual: add kernel-modules-components test

This test installs a kernel-modules component and verifies that the
shipped kernel module is installed and can be loaded.

* tests/lib: do not error out if cloud-init finished with

'recoverable error' status.

* kernel: have destination as argument when building drivers tree

We need to tackle the generic installation case as opposed to creating
the drivers tree when seeding the system. In that case the destination
tree can vary depending on installation type.

* overlord: pass kernel information to install package

so the drivers tree can be created.

* cmd/snap-bootstrap: build drivers tree on installation from initramfs

* tests: adapt to additional parameters in install.Run

* snap/naming: add ancillary method to split a full component name

into snap and component names.

* gadget/install: fix nosecboot tests
2024-05-29 15:58:22 +01:00
Alfonso Sánchez-Beato
fe87c19891 kernel,overlord: fix component unit tests 2024-04-12 19:48:18 +01:00
alfonsosanchezbeato
1a5cef2ef6 o/snapstate: add support for kernel-modules handlers (#13748)
* kernel,overlord: use function from kernel pkg to get kernel early

mount dir.

* o/snapstate/sequence: add ancillary methods to retrieve components

for a given snap revision in the sequence. One of the methods can be
given a component type for filtering.

* o/snapstate/backend: add methods to set-up kernel-modules components

* o/snapstate: add handlers to set-up kernel-modules components

* o/snapstate: add specific setup task for kernel-modules components

* o/{devicestate,snapstate}: change name of kernel set-up tasks

* systemd: add before dependency to early mounts for local-fs.target

So dependencies are the same as when mounting in /snap, as that is
where we will do also the early mounts now.

* kernel: use normal mount points when building drivers tree

* overlord/devicestate: no need to remove early mount anymore

* overlord/snapstate: consider kernel type when ensuring the mounts

* kernel: put modules back in "updates" folder

As that gives priority to the kernel modules under that directory (see
depmod.d(5)).
2024-04-12 16:00:19 +02:00
Alfonso Sánchez-Beato
19baffdf08 kernel,overlord: use function from kernel pkg to get kernel early
mount dir.
2024-02-21 17:15:53 +00:00
Alfonso Sánchez-Beato
9712748dff kernel,overlord: modify EnsureKernelDriversTree so it can handle
kernel-modules components.
2024-02-21 07:55:42 +00:00
Alfonso Sánchez-Beato
ed956c4567 kernel: and ancillary methods
And ancillary methods:

- KernelVersionFromPlaceInfo, to find the kernel version ("uname -r")
  for a mounted snap.
- BuildKernelDriversTree, to build a tree from a mounted snap that can
  be bind-mounted to /usr/lib/{modules,firmware}.

These methods are needed to support kernel-modules components.
2024-02-06 10:35:10 +00:00