[Tutorial] Convert to systemd-boot

In case you weren’t aware @joekamprad is one of the core developers of the distro.

I don’t think he is referring to a technical or systems issue here… :wink:

If an ALPM hook would help resolve issues like that I would impressed. It would likely have a negative impact on the Psychiatry profession though. :nerd_face:

2 Likes

This explains why I was so impressed with his “experience” and guiding me in many threads!

Psychological then?! I figured out from your next sentence

That’s why I could finally quit Prozac without problem. :rofl:

It is working for me “till now” thanks to all of you.

2 Likes

Just a second please!
You mean the hook I did is actually nothing? Not a solution to the Grub issue?
How and why is that if it has been actually working for me for a full month without a single issue with Grub?

No, I meant that it would be surprising if alpm hooks could solve psychological issues…

What you did is a helpful tool for you and perhaps certain others but it isn’t a universal solution to the issue that occurred in the past nor is it prevention against future grub issues.

I see! It actually helped me as I mentioned :rofl:

Just curious why? What prevents it from being a universal solution for “the default “ systems, EXT4 or BTRFS, default kernel or LTS, 64 bit processor, local HDD or SSD? Or for most people who don’t necessarily have a “special” setup.

Another way round, in what cases it would not work?
Again it is time for me to learn something new.

First, I would argue that unless you frequently switch kernels, the automation isn’t really needed. There is no reason to constantly rebuild the grub config for most users on Arch-based distros where the kernel names don’t change.

Next, the problem is defining what is “normal” vs what is “special”. We tend to think that our setup/situation is the one that is normal or typical but they isn’t always the case. Personally, I would describe your use case as not at all typical but others with a similar setup would probably disagree. :wink:

There are many possible configurations and unless you have tested a wide variety of them, it is hard to say which cases work and which don’t.

1 Like

As far as I humbly understand, it is not necessarily switching kernels frequently.
Snapshots due to updates (BTRFS here), a kernel update… I think require the stuff to be done (in most cases at least)

OH. I was all the time thinking I am just a simple home user. I just browse the internet, download books, read them. Maybe the only thing I count myself doing differently is just using “Resilio” to have my own cloud on this laptop and another old laptop just in case any of them dies.

And yes, I tend to get the most out of my laptop and out of Linux! (as I did OCR and such)

I don’t think so. I think the data for the btrfs snapshot submenu is stored in a separate file.

1 Like

Well, I can’t tell, if you say so, you are the expert.
But I hope for me it will keep working as it has been doing for a month now without issues at all.
(hopefully “they” won’t come up with other “improvements” to Grub)

I added a script to both kernel-install-mkinitcpio and kernel-install-for-dracut which makes it easy to regenerate your initrds. You can simply run reinstall-kernels now.

2 Likes

This means that I won’t need the script below?
If this is the case, I should only install this package and then run kernel-install-for-dracut?

    while read -r kernel; do
        kernelversion=$(basename "${kernel%/vmlinuz}")
        echo "Running kernel-install for ${kernelversion}"
        kernel-install add ${kernelversion} ${kernel}

Edit:
Hm, I see the script there in kernel-installs file:

image

Yes, I just put that script in a file to make it easier for people.

1 Like

Is this tutorial still valid after the Cassini-release?
Is there some kind of theming that EndeavourOS does that can be added?

Would it be possible to leave grub on the system as a fallback?

Err…probably? I haven’t reviewed it in a while. The installer uses the kernel-install method with the package kernel-install-for-dracut which is in our repos. If you prefer to stick with mkinitcpio, the package kernel-install-mkinitcpio is in AUR and is nearly identical except for using mkinitcpio instead of dracut.

systemd-boot has no theming.

Yes.

1 Like

I think your script and/or tutorial are missing out on something rather important, especially for older/cheaper hardware that does not receive BIOS-updates. You don’t load the CPU-firmware files intel-ucode.img or amd-ucode.img.
At least the Intel-one is present in the Arch config: https://wiki.archlinux.org/title/systemd-boot#Adding_loaders - the AMD one would be a simple renaming of intel to amd:

esp/loader/entries/arch.conf

title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options root=“LABEL=arch_os” rw

Also, I tried to find a config option but did not succeed so far, is systemd-boot able to save the last used boot entry and boot that? I have 2-3 kernels and Windows installed, and my standard use-case is that it should boot the last used boot-entry, not a specific default one…

sudo bootctl set-default @current should set the currently booted kernel as default.
I guess it needs to be repeated if one boots into another kernel and wants that as default unless there is a similar way to make it permanent like in grub with:

GRUB_DEFAULT="saved"

GRUB_SAVEDEFAULT="true"
1 Like

yeah, but that won’t be possible for Windows and still would need manual intervention on Linux. I am exactly looking for a config option like the one you quoted from grub (I have set that there)

Right.
Personally, in my limited time of having used systemd-boot, I haven’t come across such a configuration. It’s not my use case either for that matter.
Perhaps more seasoned systemd-boot users will chime in with some input.

In the case of mkinitcpio, kernel-install-mkinitcpio handles that.

In the case of dracut, it isn’t needed. dracut loads the firmware directly into the initrd. That is one of the advantages of dracut.

It does seem to be missing from the manual instructions. I may remove those now that the distro is using kernel-install.

2 Likes

systemd-boot has bunch of different ways to set the booted entry. However, I don’t think it can remember the most recent one.

It can be saved from the menu, can be set with a command or can be configured to boot a certain entry via the config including supporting wildcards.