Please sit down, if you can.
So the next speaker is Spicknev Yanderevsky-Smak.
And he will talk about MK OSI InitRD, a new project to build InitRDs from system packages.
Yeah, so my talk builds on previous talks.
So my name is Zbyszek, I work in Red Hat in the Plumbers group, and I work on system D and Fedora.
Brought to RPM, RPM Autospec build tools and stuff like that.
And so we're here today about a new approach to delivering the kernel and the user space, the root file system to computers.
And all the stuff that was mentioned today, so secure boot, to trust your code, PCR measurements, boot phases.
Locking secrets to the PCR state.
This creates a situation where we should think how we build InitRDs.
And I think it's a good opportunity to kind of throw away a lot of old approaches and use a new approach.
And the things the way that I'm talking about today would have been very hard a few years ago,
because we didn't have those mechanisms that we have right now, like credentials and system extensions.
So look, I talked about system extensions, so the compact disk images that carry a file system and one partition,
the inverted data in another partition and a signature for the root hash of the inverted data in a third partition.
And this is squished into an image with minimal padding.
So actually it sounds kind of awful, but it's basically just a file system image with some metadata that can be trusted.
And those tools allow us to do things in a completely different fashion than we used to do them in the past.
So what do we do now?
I mean, this varies between distributions, but the approach is generally that on a general-purpose distribution like Fedora,
the user wants to have an InitRD, so they scrape some files of the file system,
whatever is installed there, sometimes with some local modifications, sometimes not.
You use LDD to figure out what libraries should be loaded and whenever there are extra files that need to be put in the InitRD,
well, somebody has to remember to do that, so essentially we duplicate the packaging layer.
And we do it on every user machine, so this costs time during upgrades, it's actually quite noticeable because of compression.
And so this was before we booted, and after we have booted into the InitRD,
generally, for example, the Fedora InitRDs, they have SystemD,
but they also have lots of extra functionality added that came before SystemD was there.
And over time, this functionality has been moving into SystemD.
And now we're at the point where it's completely useless, I mean, the part that is apart from SystemD is not useful
because we can just get rid of it and because it is implemented by SystemD in a better way, in general.
And while people hear, OK, now we should do something, some kind of access a file system in the InitRD,
oh, let's like some bash to do it. And why? I mean, we should just do the same thing we do in the host file system
and use proper tools. And if those tools are not good enough, then we should fix them so that it's nice to use them in the host file system
and they're also nicer to use in the InitRD.
And it's like a legacy that this InitRD environment used to be much different,
but we use SystemD and SystemD does the setup where it sets up slash proc and slash dev
and mounts everything that needs to be mounted.
And in reality, the environment in the InitRD doesn't have to be.
The fact that it's different from a real system is just something that we should get rid of.
So we have this duplication where we have the SystemD way to do things and the Non-SystemD way to do things in parallel.
It just adds complexity and doesn't, it's not beneficial.
And everybody does the InitRD in a very, very different way, every distribution.
And even some distributions have multiple ways.
I know that one of the goals of Chacut was to unify the approach between distributions,
it didn't really work, so this is another approach we'll see in 10 years.
So, okay, so we sign stuff. If we sign the kernel, but not the InitRD, then we are just pretending, right?
It's a waste of time. We need to sign both.
But in general, users want to have the thing, the users don't want to play with local key management.
It should be signed by the distro. If it's signed by the distro, then the InitRD must be also built by the distro.
So all this functionality that we have to inject things into the InitRD based on local configuration, well, we cannot use it.
So essentially, the idea is that, okay, if we are going to move the whole build of the InitRD into distro infrastructure and build it like a package,
then let's do it in a clean way.
And for me, this means taking a declarative set of distribution package names,
letting the distribution package manager figure out all the dependencies,
and then using the distribution package manager to put the files in a directory and then just zipping it up into any InitRD.
So, before I talk about the specifics of how to do this,
let's talk about some problems that immediately appear, right?
If we try to build one InitRD for, let's say, whole Fedora, then we will end up with this straight genetic blob that will take 60 seconds to load whenever the kernel boots.
This is not nice. So we need different InitRDs for different people.
And one option is to just build multiple variants, and we definitely plan to do this.
For example, like a simplified InitRD that works for VMs that only has some basic stuff that you need in the VM and no other drivers and no other tools and like one for laptops and so on.
But this only scales so far. We can have maybe five variants, but anything more than that would be annoying.
And the other approach is to use SystemD extensions. So the idea would be that you have the basic InitRD, and let's say you want, I don't know, SSHD in your InitRD, and you install this additional extension.
And I should mention what happens with trust here. So the bootloader verifies the kernel and the InitRD before loading it, and then after the InitRD has been loaded, and we want to use, we want to, the InitRD code loads the extension.
So it checks the signature of the extension before loading it. So SystemD extensions are a mechanism to add code in a way that it is trusted before, I mean, the trust is checked before it is used.
And if we use UKIs, we need some way to inject configuration into the, well, I mean, we build an image that's supposed to work everywhere so it cannot have local configuration and we need to deal with this issue somehow.
And one approach is to use the, just out of discovery of partitions and not have any local configuration, which is nice if we can make it work.
But a more general approach is to use credentials and to inject a configuration that has been signed and bound somehow to the local system using SystemD credentials.
And I would say that this is an area of active research because I don't think that anybody really knows how this is supposed to work in details.
And I wanted to mention that if we build InitRDs from packages, we have build reproducibility because we have an exact list of packages that was used and we can download them again and unpack them again in the same, I mean, the exact same way.
And we should have bit for bit identical result, which is good for checking that the idea was put together correctly.
But it's also very useful if you want to build some system extension afterwards because you build the extension by adding additional stuff and then taking the difference between the old image and the new image.
And the tool that we are using for this is, well, the project is called MQSI InitRD because it takes MQSI, which is a very simple tool that takes a list of packages and calls the package manager to download the packages and put them into an image.
And it does all the things that we happen to need.
So it supports GPT tables and DMVarity and signatures so we can do some extensions.
And it can also do archives and this is what you need for InitramFS format.
And MQSI itself is just a set of configuration scripts or configuration files for MQSI right now only for Fedora, but the concept carries very cleanly into other distributions so I think that if it works in Fedora maybe other people will pick it up too.
So just a list of packages and some tweaks to turn the install packages into an InitRD.
And the same for system extensions.
And well, in general the plan is to do it on the distro side but right now this hasn't happened yet so we have a kernel install plugin and you update the kernel and you very slowly build the InitRD from packages on the local system.
It's not very efficient but it works surprisingly stably.
And for Fedora 39 we want to propose changes to the build system to allow InitRDs to be built in this way in the build system and deliver these packages for people who want to try it out.
I think it's like years from being the default if ever.
And so this works, I mean it works without too much issue.
The InitRDs are bigger but they're not infinitely bigger, they're maybe just twice as big.
And the biggest difference surprisingly comes from kernel modules because what Dracut and other InitRD builders do, they select a specific list of modules, kernel modules that are needed for the local system.
I wanted to avoid this, I wanted to take all the modules from a kernel package and just put them in without knowledge about specific modules.
I think that this is not feasible, we'll have to do some kind of filtering too.
But the code itself, there's very little difference in the size of executables and libraries installed into the InitRD and this is because the code that we use in the InitRD is the same code from the host file system.
So it has the same library dependencies and you need to put the same set of libraries and actually most of the space is taken by libraries because the functionality has been moving more and more into shared libraries because we build more complicated stacks.
So this means that in principle the size overhead is not too big and can be reduced.
And I mean this works in some cases but like for simple cases for laptops and for some types of storage but certainly not for everything.
And what do we get? We have less things, we use the package dependency resolution mechanism so we don't duplicate packaging, we don't need to care about installation because we have RPM to do it for us or whatever.
We have fair principle builds because we don't take files from the host and everybody has the same image which is important for people trying to debug errors reported by users.
And well if we build things centrally we can assign them and we use systemd and just get rid of the extra stuff so our life is simpler.
And you know there's like a common set of things that people complain about, I mean like arrays when this is discussed.
So I wanted to underline that systemd is already used in the entirety so we're just removing things not adding new things.
And systemd sets up the environment so things are already like they should be.
So like all the extra work that people have put into having scripts that work without slash prop mounted, it's not useful.
And we remove stuff and we would be moving from scripts to demons anyway, right, and shared libraries.
Because if somebody tells you to provide, find the two authentication decryption for the root disk, you're not going to script it, you're going to use some compiler code to do it anyway.
And like, I don't know, netling, timeouts, retries, localization, debuts, all this stuff is just semi incompatible with scripting.
And we would be moving in the direction of normal compiler code anyway.
And so MKSI in the RD as itself is kind of, it's implemented and it mostly works.
The stuff that is happening is like in the surrounding areas.
So in particular, this development in systemd rated credentials is very important because we want to make use of this.
And support for unified kernel images is growing.
There are patches, there's a link here, patches for grab2 to load unified kernel images.
And I mentioned that we want to build MKSI internal images in Fedora.
So this will require changes in the Koji build system.
And that's what I have.
I do have time for questions.
One minute, three minutes, okay.
When I was thinking about systems that boot from network and, for instance, the root system is on iSCSI or NVME over fiber,
do you need some information that is really device specific?
How can we separate that from the init ID?
Because you want a single init ID for all the systems.
Yes.
So one option is to put it on the kernel command line if this is an option.
And the second option is to provide a credential that is unpacked and becomes part of the configuration in the init ID.
So essentially, yes, you just inject this configuration, but it wouldn't be part of the init ID itself.
It would be delivered in a different way.
The same question is what would you do if you want to have files from the local file system?
For example, you need a custom mount command that does more than a feature mount.
Well, I mean, I would say ask why do you need that?
But if you need that, then just do the build locally.
And the difference is, I think it was kind of the same question was asked before about unified kernel images.
You can do the build locally, you just don't have the distro signatures.
Thank you.
It might be a bit similar to the previous question, but thinking from a distribution standpoint,
there is a lot of hardware out there which is incompatible with default configurations or default init energies.
And you need to add patches to kernels and you need to add special kernel modules which are not enabled by default.
What is going to be the flow to support this hardware, to use it on distribution by default?
So I think that this is much less common than people think, right?
Because, I mean, how many people build their kernels nowadays? Small minority.
Like from the distro point of view, this is already outside of scope, right?
If you come, report a bug that your custom compiled kernel does not work, then nobody is going to help you.
Because people have too much bugs reported for the standard distribution.
The existing ways of building things locally, they will always be there, right?
I mean, they are not going away.
So basically the answer is, well, I mean, if you are doing something specific, then you keep doing this specific thing.
And this, I mean, this is the way to make the life for the distro easier, but it's not going to cover all cases, maybe like 90%.
Any more questions?
Yeah, you mentioned the kernel module making the integer bigger. Could this be shipped in a standard extension somehow?
Can you repeat, please?
Could you ship the kernel modules which are in very nearly, in a standard extension?
Yes, definitely.
So the kernel, the initial NTRD, the kernel must have enough stuff built in to understand the NTRD,
and the NTRD must have enough modules to be able to load system extensions.
But once you do that, you can have an extension with kernel modules and whatever. Yes.
So last question.
Is there a path to getting your init ramfs core from somewhere and running a different distro?
Like essentially to your project or some project providing the core init ramfs with the system d init inside it and everything inside of it.
You get the modules from elsewhere and then when you pivot, is that a hard line that you can live?
I think that technically it's doable because system d is kind of used everywhere and there's really no reason why it wouldn't work.
I assume that distro would want their own code in the init rd, but technically it's not required.
Okay, thank you.
I mean, there's this general requirement that, because there's a switch route where state is passed from the NTRD to the host,
and you don't want to pass the state from newer system d to an older system d.
So the NTRD would have to be just older, old enough.
Thank you very much.