Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

factory: create components compatible mount units for kernel #229

Conversation

alfonsosanchezbeato
Copy link
Member

The kernel-modules components require that /lib/{modules,firmware} can be created by composition of what is shipped with the kernel plus parts that will be shipped by said component type.

For this, we need to have modinfo files in a writable directory as these files will need to be regenerated when a new kernel-modules component is installed. These files need to be readable from /lib/modules/UTS_RELEASE. Inside this directory, "kernel" and "vdso" subfolders will be bind-mounted from the kernel snap, while "updates" will have modules from the components.

In the case of UC, for modules we need an additional bind mount on top of the directory coming from the base (this is not needed for hybrid systems).

In the case of firmware, content from the kernel will be mounted to /lib/firmware as in the past. However, we will rely on the existence of a /lib/firmware/updates in the kernel to mount firware coming from components.

The mount units for the active kernel are created at boot time and stored in /run/systemd/system so they are accessible after the switch root, and are actually mounted after the switch happens, but with dependencies set so kernel modules are not loaded before the mounts are ready. This replaces the fstab/generator that was creating the mounts for modules/firmware in UC and hybrid respectively, and now unifies the approach for both.

@alfonsosanchezbeato
Copy link
Member Author

Creating as draft as some discussion is needed. Also, only tested on UC at the moment.

@valentindavid
Copy link
Collaborator

It feels to me like /usr/lib/core/kernel-mounts could actually be a generator and moved to core-base. Everything has to be mounted after the switch root and all the information is available in at the start of systemd in main boot.

@valentindavid
Copy link
Collaborator

moved to core-base

(And added in the installation of snapd deb package for classic)

@alfonsosanchezbeato
Copy link
Member Author

It feels to me like /usr/lib/core/kernel-mounts could actually be a generator and moved to core-base. Everything has to be mounted after the switch root and all the information is available in at the start of systemd in main boot.

Right, I am actually thinking about this. I thought that maybe making sure that kernel modules are available on UC auto-install would be an issue, but probably that's not the case. We might need to share the file between core-base and snapd though.

The kernel-modules components require that /lib/{modules,firmware} can
be created by composition of what is shipped with the kernel plus
parts that will be shipped by said component type.

For this, we need to have modinfo files in a writable directory as
these files will need to be regenerated when a new kernel-modules
component is installed. These files need to be readable from
/lib/modules/UTS_RELEASE. Inside this directory, "kernel" and "vdso"
subfolders will be bind-mounted from the kernel snap, while "updates"
will have modules from the components.

In the case of UC, for modules we need an additional bind mount on top
of the directory coming from the base (this is not needed for hybrid
systems).

In the case of firmware, content from the kernel will be mounted to
/lib/firmware as in the past. However, we will rely on the existence
of a /lib/firmware/updates in the kernel to mount firware coming from
components.

The mount units for the active kernel are created at boot time and
stored in /run/systemd/system so they are accessible after the switch
root, and are actually mounted after the switch happens, but with
dependencies set so kernel modules are not loaded before the mounts
are ready. This replaces the fstab/generator that was creating the
mounts for modules/firmware in UC and hybrid respectively, and now
unifies the approach for both.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants