View previous topic :: View next topic |
Author |
Message |
alecStewart1 Apprentice
Joined: 03 Jul 2022 Posts: 155
|
Posted: Mon Nov 25, 2024 3:59 pm Post subject: If dracut doesn't create bootable initramfs, will UKI work? |
|
|
Hello friends,
So I've in a way been "stuck" on kernel version 6.6.53 of the gentoo-sources for some time now. Dracut, after the updates to the profiles 17 - 23 (I'm on default/linux/amd64/23.0/split-usr/hardened), has never been able to create a bootable initramfs for me regardless version of dracut. I switched to genkernel from using the dist-kernel, as that was the only thing has ever worked for me. However having now switched to a bootstrapped LLVM/Clang genkernel seems to now be throwing a fit. I get some error some libtool about relinking a file from util-linux:
Code: |
libtool: install: error: relink `libmount.la' with the above command before installing it
|
The error (which I can't access at the moment), also mentions a different version of util-linux (the current is 24 something I believe, and the mentioned is 23 something) than what I have installed, so I re-emerged util-linux and that still didn't fix the issue.
That's a separate issue that I'll post about later with logs and such when I'm back at home, but part of me thinks it's something with cross-compilation, and makes me wonder if I should which to the no-multilib equivalent of the profile I currently use to see if there's something funky with compiling 32-bit specific code. I don't really use anything that's specifically needs 32-bit versions of libraries/objects/binaries/etc., unless if playing games with Steam or through Lutris specifically needs it (though I have feeling they don't).
Since I seemingly can't use genkernel at the moment, I thought I could try the dist-kernel again, as that made my life a lot simpler before I had to move to genkernel. Well, dracut still doesn't create a bootable initramfs, with the error when I boot mentioning it doesn't know where the device root=really-long-uuid is.
This is not me using UKI, though, and having a separate initramfs file that I reference in the initrd in the kernel commandline with efibootmgr. My question is, would using UKI produce any different results? Or would it still be the same, dracut not being able to produce a valid initramfs?
Again, I'll post about the genkernel issue in another thread when I can post all of the necessary information, I'm just curious if it's even useful to switch to UKI instead of having a separate initramfs if dracut can't even make a valid initramfs. I guess my last resort would be to build the initramfs myself or try UGRD even though I don't use LUKS or LVM. |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1271 Location: Richmond Hill, Canada
|
Posted: Mon Nov 25, 2024 4:14 pm Post subject: |
|
|
UKI just have embedded initramfs into the result binary. It is not about eliminate initramfs.
So if you have setup require use of initramfs (i.e. encrypted rootfs) than UKI will not help. |
|
Back to top |
|
|
zen_desu n00b
Joined: 25 Oct 2024 Posts: 27
|
Posted: Mon Nov 25, 2024 4:16 pm Post subject: |
|
|
If the initramfs alone does not function, baking it into a UKI likely won't help it work. The main reason I could see a UKI helping is if the root= cmdline option was incorrect outside the UKI but set correctly within it.
ugrd was mostly made to make it easier to boot LUKS setups, just because it detects config for you and attempts to validate it. It works fine for simpler setups. One notable thing about it is that it builds in root info from the host, so a "root=" option is not required, but attempted if passed.
Do you really need an initramfs? If you have a custom kernel you could probably just build in everything which is required to boot, modules can be loaded after the rootfs is mounted. In some cases an initramfs just adds parts which can break. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
|
alecStewart1 Apprentice
Joined: 03 Jul 2022 Posts: 155
|
Posted: Mon Nov 25, 2024 4:49 pm Post subject: |
|
|
zen_desu wrote: | Do you really need an initramfs? If you have a custom kernel you could probably just build in everything which is required to boot, modules can be loaded after the rootfs is mounted. In some cases an initramfs just adds parts which can break. |
That's a great question, actually. I initially just went with the dist-kernel and initramfs because it seemed like the simplest path at the time. Although, if I understand correctly, if one is using the split-usr profiles (/usr is being separate) then you need to use initframfs? I could likely have that wrong.
If it's not much effort to move away from default/linux/amd64/split-usr/hardened to /default/linux/amd64/no-multilib/hardended then I'm definitely all for it.
So if I could go without initramfs and shove everything in the kernel, erm, someone might need to point me to a guide. I recall there being one somewhere on the wiki, I just don't remember what the page was called. |
|
Back to top |
|
|
alecStewart1 Apprentice
Joined: 03 Jul 2022 Posts: 155
|
Posted: Mon Nov 25, 2024 4:52 pm Post subject: |
|
|
Oh well there is this which isn't gentoo specific, but it's certainly a helpful starting place. |
|
Back to top |
|
|
zen_desu n00b
Joined: 25 Oct 2024 Posts: 27
|
Posted: Mon Nov 25, 2024 4:57 pm Post subject: |
|
|
alecStewart1 wrote: | zen_desu wrote: | Do you really need an initramfs? If you have a custom kernel you could probably just build in everything which is required to boot, modules can be loaded after the rootfs is mounted. In some cases an initramfs just adds parts which can break. |
That's a great question, actually. I initially just went with the dist-kernel and initramfs because it seemed like the simplest path at the time. Although, if I understand correctly, if one is using the split-usr profiles (/usr is being separate) then you need to use initframfs? I could likely have that wrong.
If it's not much effort to move away from default/linux/amd64/split-usr/hardened to /default/linux/amd64/no-multilib/hardended then I'm definitely all for it.
So if I could go without initramfs and shove everything in the kernel, erm, someone might need to point me to a guide. I recall there being one somewhere on the wiki, I just don't remember what the page was called. |
If you have a separate /usr partition, you may need an initramfs to boot because the system may need stuff from /usr to start the init. Essentially, the initramfs is just there to kickstart the boot process, it gets the root mounted and starts the "real" init system, which often handles things such as additional mounts. If there is no initramfs, the kernel may be able to directly mount the root filesystem, which could be enough for the init to start and do its thing. If not, then that is where the initramfs helps to get things ready.
In the case of LUKS, it decrypts the filesystem, then mounts it. In the case of a separate /usr partition, it mounts that so /usr/bin, etc. is available for the init system.
Depending on how you boot, an initramfs may not be required with dist-kernel. If you're sure you don't need one you can set "USE=-initramfs" for dist-kernel. One notable component which may be missing is the nvme module (important if you boot from a nvme). If you run ugrd, you should see it list some "init kernel modules" which should give you a good idea of what you need to build in if you want to avoid using an initramfs.
I would avoid building _everything_ into the kernel, and would start by simply adding portions which are required specifically to boot. This is also a somewhat advanced method and it's worth noting that using an initramfs here is generally simpler/easier to maintain, but there isn't technically anything wrong about this method. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1931
|
Posted: Mon Nov 25, 2024 5:11 pm Post subject: |
|
|
alecStewart1 wrote: | Although, if I understand correctly, if one is using the split-usr profiles (/usr is being separate) then you need to use initframfs? |
Please don't confuse split-usr/merged-usr with having a separate /usr volume.
The former is a layout where /{,s}bin and /lib{,64} are moved under /usr.
The latter is often broken and not recommended in modern times because of complexity. An initramfs that is aware of separate /usr is required or things will not work.
The simplest solution is to move the separate /usr back to the rootfs if space allows. This can be done easily via a bind mount and rsync. |
|
Back to top |
|
|
alecStewart1 Apprentice
Joined: 03 Jul 2022 Posts: 155
|
Posted: Mon Nov 25, 2024 5:30 pm Post subject: |
|
|
grknight wrote: | alecStewart1 wrote: | Although, if I understand correctly, if one is using the split-usr profiles (/usr is being separate) then you need to use initframfs? |
Please don't confuse split-usr/merged-usr with having a separate /usr volume.
The former is a layout where /{,s}bin and /lib{,64} are moved under /usr.
The latter is often broken and not recommended in modern times because of complexity. An initramfs that is aware of separate /usr is required or things will not work.
The simplest solution is to move the separate /usr back to the rootfs if space allows. This can be done easily via a bind mount and rsync. |
Ah apologies. I don't actually have a separate /usr volume. Just ye 'ol simple boot (efi), swap and root. So I could go without an initramfs. |
|
Back to top |
|
|
alecStewart1 Apprentice
Joined: 03 Jul 2022 Posts: 155
|
Posted: Mon Nov 25, 2024 5:32 pm Post subject: |
|
|
zen_desu wrote: |
If you have a separate /usr partition, you may need an initramfs to boot because the system may need stuff from /usr to start the init. Essentially, the initramfs is just there to kickstart the boot process, it gets the root mounted and starts the "real" init system, which often handles things such as additional mounts. If there is no initramfs, the kernel may be able to directly mount the root filesystem, which could be enough for the init to start and do its thing. If not, then that is where the initramfs helps to get things ready.
In the case of LUKS, it decrypts the filesystem, then mounts it. In the case of a separate /usr partition, it mounts that so /usr/bin, etc. is available for the init system.
Depending on how you boot, an initramfs may not be required with dist-kernel. If you're sure you don't need one you can set "USE=-initramfs" for dist-kernel. One notable component which may be missing is the nvme module (important if you boot from a nvme). If you run ugrd, you should see it list some "init kernel modules" which should give you a good idea of what you need to build in if you want to avoid using an initramfs.
I would avoid building _everything_ into the kernel, and would start by simply adding portions which are required specifically to boot. This is also a somewhat advanced method and it's worth noting that using an initramfs here is generally simpler/easier to maintain, but there isn't technically anything wrong about this method. |
I actually don't have a separate /usr partition and I just boot with an EFI stub. So I can give it a go. |
|
Back to top |
|
|
zen_desu n00b
Joined: 25 Oct 2024 Posts: 27
|
Posted: Mon Nov 25, 2024 5:36 pm Post subject: |
|
|
alecStewart1 wrote: | grknight wrote: | alecStewart1 wrote: | Although, if I understand correctly, if one is using the split-usr profiles (/usr is being separate) then you need to use initframfs? |
Please don't confuse split-usr/merged-usr with having a separate /usr volume.
The former is a layout where /{,s}bin and /lib{,64} are moved under /usr.
The latter is often broken and not recommended in modern times because of complexity. An initramfs that is aware of separate /usr is required or things will not work.
The simplest solution is to move the separate /usr back to the rootfs if space allows. This can be done easily via a bind mount and rsync. |
Ah apologies. I don't actually have a separate /usr volume. Just ye 'ol simple boot (efi), swap and root. So I could go without an initramfs. |
You can if you're careful that required modules are built into the kernel. If you only need to add a few, this can be done simply with "gentoo-kernel":
https://wiki.gentoo.org/wiki/Project:Distribution_Kernel#Using_.2Fetc.2Fkernel.2Fconfig.d
Essentially, if you need nvme modules, you can add something like:
to /etc/kernel/config.d/my_patches.config
You may need more modules than that, that's just an example.
You should see these config changes being logged when emerging the kernel, and can double check the resulting kernel .config to be sure required modules were included before rebooting. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
|
alecStewart1 Apprentice
Joined: 03 Jul 2022 Posts: 155
|
Posted: Mon Nov 25, 2024 5:45 pm Post subject: |
|
|
zen_desu wrote: |
You can if you're careful that required modules are built into the kernel. If you only need to add a few, this can be done simply with "gentoo-kernel":
https://wiki.gentoo.org/wiki/Project:Distribution_Kernel#Using_.2Fetc.2Fkernel.2Fconfig.d
Essentially, if you need nvme modules, you can add something like:
to /etc/kernel/config.d/my_patches.config
You may need more modules than that, that's just an example.
You should see these config changes being logged when emerging the kernel, and can double check the resulting kernel .config to be sure required modules were included before rebooting. |
I've used savedconfig with the dist-kernel, so I have a kernel .config for 6.6.62 that I can update. If I understand correctly, doing -initramfs on gentoo-kernel, intel-microcode and linux-firmware and then going through the kernel .config and changing CONFIG_SOME_MODULE=m to CONFIG_SOME_MODULE=y.
What would the "best" or "easiest" way to figure out what modules are needed for creating a monolithic kernel (I just remembered the term)/kernel without initramfs? |
|
Back to top |
|
|
zen_desu n00b
Joined: 25 Oct 2024 Posts: 27
|
Posted: Mon Nov 25, 2024 6:27 pm Post subject: |
|
|
I think monolithic would mean a kernel with NO modules. Here, it would probably be most reasonable to make it so kmods aren't required to boot, but can be used later.
Once you build _everything_ into the kernel, you may run into issues, such as firmware loading problems. Some components expect to be modules, especially so firmware can be loaded later. Firmware must be loaded when the kmod is initialized in most cases. If you have a true monolothic kernel this means all required firmware must be builtin to function. This is generally complex and means you can no longer unload/reload modules.
You should still be able to use a microcode initramfs, even with a fully monolothic kernel. This initramfs just contains microcode which is loaded very early in the boot process. The alternative is to build the ucode into the kernel but that is extra work, and having a separate ucode image means you can update microcode without updating your kernel.
I think using ugrd may be a reasonable way to see which kmods are required to boot. It should find them (through various mechanisms) and it will clearly list what it pulls. You can test this it and then use that info to figure out what needs to be built in once you confirm it does what is needed. _________________ µgRD dev
Wiki writer |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|