View previous topic :: View next topic |
Author |
Message |
equaeghe l33t
Joined: 22 Feb 2005 Posts: 652
|
Posted: Mon Apr 15, 2024 8:24 am Post subject: [slvd] systemd-boot+ukify:How to determine kernel boot label |
|
|
I am using systemd-boot and this weekend I've moved my kernel setup to one using UKIs generated using ukify (all works semi-automagically upon `make install` by setting the right use flags). However, the kernel boot label is now "Gentoo (2.14)". I would like it to be more informative, i.e., use just or at least include the kernel version string "x.y.z-gentoo-suffix", where 'suffix' is the extra string I set in the kernel itself. This version string is also used to identify the subfolder of /lib/modules where its modules are. Can I configure this and if so, where?
Last edited by equaeghe on Wed May 15, 2024 7:45 pm; edited 1 time in total |
|
Back to top |
|
|
gabrielbo954 n00b
Joined: 12 Apr 2024 Posts: 2
|
Posted: Fri Apr 19, 2024 12:41 pm Post subject: |
|
|
Sure, systemd-boot uses the entries in '/boot/loader/entries/' to define what kernels to boot and their labels. The labels are set in each entry file for your kernels.
If you're using UKIs with systemd-boot, your '/boot' might contain a '.conf' file for each kernel. You'd typically see a list of entries like 'title', 'linux', 'initrd', and 'options'.
Here's what you can do:
1. Navigate to the '/boot/loader/entries/' directory.
2. Open the '.conf' file corresponding to your kernel in a text editor.
3. Look for the 'title' line. It might look something like this:
Code: | title Gentoo (2.14) |
4. Change it to include your kernel version string like so:
Code: | title Gentoo x.y.z-gentoo-suffix |
Replace 'x.y.z-gentoo-suffix' with the actual version string of your kernel.
Save the file and reboot. systemd-boot should now display the new title in the boot menu.
If you want this process to be automated when you use 'make install', you would need to adjust your kernel's makefile or the script that handles the installations to modify this title for you. This could involve a simple 'sed' command to replace the title line in the '.conf' file with your desired label, including the dynamic version string fetched from your kernel build.
Here's an example of what that 'sed' command might look like:
Code: | sed -i 's|title.*|title Gentoo x.y.z-gentoo-suffix|' /boot/loader/entries/gentoo.conf |
Make sure to replace the 'gentoo.conf' with the actual name of your kernel's entry file and 'x.y.z-gentoo-suffix' with the command or variable that fetches your current kernel version string.
Remember to test any automated changes carefully to ensure they work as expected and don't disrupt your boot process. |
|
Back to top |
|
|
Nowa Developer
Joined: 25 Jun 2014 Posts: 429 Location: Nijmegen
|
Posted: Fri Apr 19, 2024 9:18 pm Post subject: |
|
|
The method described by the previous post will work, but let me add some more context.
The 2.14 systemd-boot reads from the os-release section of the UKI, ukify in turn adds this section based on the contents of /etc/os-release. This file is owned by the baselayout package (of which you have version 2.14 installed).
You can change it by either modifying VERSION_ID in /etc/os-release, or by instructing ukify to use a custom os-release file via /etc/kernel/uki.conf. Note though that you don't actually have to do this to distinguish between installed UKIs. As soon as systemd-boot finds two or more UKIs with the same os-release section it will also print the name of the file, containing the kernel version number, in the boot menu. _________________ OS: Gentoo 6.10.12-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400
Last edited by Nowa on Tue May 07, 2024 7:43 am; edited 1 time in total |
|
Back to top |
|
|
equaeghe l33t
Joined: 22 Feb 2005 Posts: 652
|
Posted: Tue May 07, 2024 7:42 am Post subject: |
|
|
gabrielbo954 wrote: | Sure, systemd-boot uses the entries in '/boot/loader/entries/' to define what kernels to boot and their labels. The labels are set in each entry file for your kernels. |
Thanks for the information. For uki files generated by installkernel, this is not the case. The label information is placed in the uki itself. I prefer to avoid separate configuration files. |
|
Back to top |
|
|
equaeghe l33t
Joined: 22 Feb 2005 Posts: 652
|
Posted: Tue May 07, 2024 7:51 am Post subject: |
|
|
AndrewAmmerlaan wrote: | The 2.14 system-boot reads from the os-release section of the UKI, ukify in turn adds this section based on the contents of /etc/os-release. This file is owned by the baselayout package (of which you have version 2.14 installed).
You can change it by either modifying VERSION_ID in /etc/os-release, or by instructing ukify to use a custom os-release file via /etc/kernel/uki.conf. Note though that you don't actually have to do this to distinguish between installed UKIs. As soon as systemd-boot finds two or more UKIs with the same os-release section it will also print the name of the file, containing the kernel version number, in the boot menu. |
Thanks for the precise description. Indeed after having generated three ukis, I see the filename added. (The second one didn't, as baselayout was updated from 2.14 to 2.15.) Having baselayout determine the kernel image version string makes very little sense to me, but for non-rolling release distributions, it is perhaps not that strange.
Ideally, for me, the uname is what is shown as the boot label. "Gentoo Linux (2.15) <horribly long machine-id>-x.y.z-gentoo[-rp]-<my postfix>" is way less readable than "x.y.z-gentoo[-rp]-<my postfix>". The uki mght contain a uname section with just that, but either installkernel does not add it or systemd-boot does not use it. I guess I have to investigate further to see if I can coax installkernel and systemd-boot to show the label I want. |
|
Back to top |
|
|
Nowa Developer
Joined: 25 Jun 2014 Posts: 429 Location: Nijmegen
|
Posted: Tue May 07, 2024 7:57 am Post subject: |
|
|
equaeghe wrote: | Thanks for the precise description. Indeed after having generated three ukis, I see the filename added. (The second one didn't, as baselayout was updated from 2.14 to 2.15.) Having baselayout determine the kernel image version string makes very little sense to me, but for non-rolling release distributions, it is perhaps not that strange.
Ideally, for me, the uname is what is shown as the boot label. "Gentoo Linux (2.15) <horribly long machine-id>-x.y.z-gentoo[-rp]-<my postfix>" is way less readable than "x.y.z-gentoo[-rp]-<my postfix>". The uki mght contain a uname section with just that, but either installkernel does not add it or systemd-boot does not use it. I guess I have to investigate further to see if I can coax installkernel and systemd-boot to show the label I want. |
Installkernel[uki,ukify,systemd] uses the ukify script from upstream systemd, I try to avoid modifying upstream kernel installation hooks as much as possible. But you can get rid of this machine-id by setting a string of your choice in /etc/kernel/entry-token, I have mine set to simply "linux" since I'm not dual-booting multiple distro's anyway. _________________ OS: Gentoo 6.10.12-gentoo-dist, ~amd64, 23.0/desktop/plasma/systemd
MB: MSI Z370-A PRO
CPU: Intel Core i9-9900KS
GPU: Intel Arc A770 16GB & Intel UHD Graphics 630
SSD: Samsung 970 EVO Plus 2 TB
RAM: Crucial Ballistix 32GB DDR4-2400 |
|
Back to top |
|
|
equaeghe l33t
Joined: 22 Feb 2005 Posts: 652
|
Posted: Wed May 15, 2024 7:44 pm Post subject: |
|
|
AndrewAmmerlaan wrote: | Installkernel[uki,ukify,systemd] uses the ukify script from upstream systemd, I try to avoid modifying upstream kernel installation hooks as much as possible. But you can get rid of this machine-id by setting a string of your choice in /etc/kernel/entry-token, I have mine set to simply "linux" since I'm not dual-booting multiple distro's anyway. |
Thanks, that, together with a custom os-release via /etc/kernel/uki.conf indeed seems the best one can do right now.
Possibly relevant: https://github.com/orgs/uapi-group/discussions/36#discussioncomment-9380533 |
|
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
|
|