Mkinitcpio update and changes may need some manual intervention

How big are your initramfs then?

1 Like

How are you getting that info?

ncdu

1 Like

mkinitcpio fallback images have gotten huge lately due to the changes over the last couple of versions.

1 Like

Smaller than a cat! :wink:

1 Like

If I understand the Arch announcement correctly, it means that the microcode line in my systemd-boot entries will be superfluous (after having merged the mkinitcpio.conf files) ?

So I can change my /boot/loader/entries/arch.conf from

title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options root=UUID=2ec827b0-72be-4c73-b58a-102a37aa24a3 rootflags=subvol=@ rw

to

title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=UUID=2ec827b0-72be-4c73-b58a-102a37aa24a3 rootflags=subvol=@ rw

?

This in an Arch install, for the record.

Hi @all using mkinitcpio !

Revisiting the new mkinitcpio this morning and regenerating my initramfs, I saw the following line in the output of the

sudo mkinitcpio -P

command:

==> WARNING: Deprecated option ‘ALL_microcode’ found. Update ‘/etc/mkinitcpio.d/linux-zen.preset’ to use the ‘microcode’ hook instead.

This means that the preset files in /etc/mkinitcpio.d need to be edited as well.

So this is what needed to be done in may case:

  1. edit /etc/mkinitcpio.conf and add microcode to HOOKS line:

HOOKS=(systemd autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)

  1. edit preset files for my kernels in /etc/mkinitcpio.d and comment out (or delete) the following line:

ALL_microcode=(/boot/*-ucode.img)

  1. regenerate initramfs: sudo mkinitcpio -P

Using Grub here, updating the /boot/grub/grub.cfg will still automatically create:

initrd /boot/intel-ucode.img /boot/initramfs-linux-zen.img

line. So useless to remove it manually fom grub.cfg since the file will be overwritten next time it is regenerated.

As for the conf files for systemd-boot entries being also automatically generated in EnOS, I hope that @dalto can comment on that.

PS. sorry for having missed the WARNING in the first run before I posted previously

7 Likes

I would interpret that as if it is meant to target, first and foremost, new kernel installations.

If you have already, say two kernels as in may case, after an update to mkinitcpio to the latest version when it is run automatically and produce explicitly the following WARNING:

==> WARNING: Deprecated option ‘ALL_microcode’ found. Update ‘/etc/mkinitcpio.d/linux-zen.preset’ to use the ‘microcode’ hook instead.

reinstalling your kernels, it is not something you think of at the first place.

But I get your point, reinstalling the kernels in this case would also have the “side-effect” of using the microcode in initramfs build since as you mentioned the preset files will be modified automatically.

For those not wanting to edit the preset files manually themselves, this should produce the desired effect as well.

1 Like

This warning message is ambiguous and can be confusing for people unfamiliar with mkinitcpio. Especially this statement:

For example, one can reasonably interpret it as adding the setting to use ‘microcode’ hook in the .preset files, which is false. One needs to add the ‘microcode’ hook in the /etc/mkinitcpio.conf file, not the preset files.

1 Like

I had ‘microcode’ hook added automatically to mkinitcpio.conf after updating, but there weren’t any changes made to linux-zen.preset. So I had to comment out ‘ALL_microcode’ to avoid the Warning upon regeneration of the kernel images.

@anthony93

A kernel re-installation doesn’t seem to produce the effect of removing

ALL_microcode=(/boot/*-ucode.img)

in the already present preset files in /etc/mkinitcpio.d for the already installed kernels.

Here is how I tested it:

  1. I edited back my /etc/mkinitcpio.d/linux-lts-preset to include again:

    ALL_microcode=(/boot/*-ucode.img)

  2. I reinstalled linux-lts and observed the output of the automatically run mkinitcpio afterwards: The WARNING is still there and the /etc/mkinitcpio.d/linux-lts remains unchanged.

  3. I went ahead and installed a new kernel: sudo pacman -S linux and observed the output in the terminal. There is no sign of WARNING in the output from mkinitcpio and no reference to

    ALL_microcode=(/boot/*-ucode.img)

in /etc/mkinitcpio.d/linux-preset

My conclusion:

Reinstalling the kernels, won’t automatically generate new presets where ALL_microcode is removed.

You will still see (for example after reinstalling linux-lts):

==> WARNING: Deprecated option ‘ALL_microcode’ found. Update ‘/etc/mkinitcpio.d/linux-lts.preset’ to use the ‘microcode’ hook instead.

However, installing a new kernel as described above, will automatically generate the “correct” preset file and then no WARNING in the mkinitcpio output.

So it seems that for already installed kernels, manual editing of preset files is still needed.

If you have time on your hand, please test it yourself to see if you will arrive at the same conclusion.
I might have done something wrongly, as it is typical for someone with a username like me :sweat_smile:

3 Likes

@pebcak @Anthony

In this case, the PEBCAK title should go to me. I read through the code again. The sed command to regenerate the .preset files is wrapped up inside a conditional:

if [[ ! -e "$preset" ]]; then
...
fi

Which means it will only be created if the preset files don’t already exist. My apologies for wasting your time.

I have deleted my original post to prevent confusion.

2 Likes

No problem. I like to roll up my sleeves and test stuff.

I see any interchange as potential opportunity to learn.

I am not code savvy as yourself so thanks for the references to those scripts and explaining their functions.

Glad we could clear this on out and hopefully it is more clear for other users what to expect after this update and what is needed to be done.

PS. Don’t you ever imagine to take the pebcak title away from me. You had just a momentarily “lapsus” :wink: :slightly_smiling_face:

3 Likes

This should be because you hadn’t modified the file before.
Otherwise, you would have had a mkinitcpio.pacnew file installed for your modifications not to be overwritten by the update.

2 Likes

Yes, it’s clear now. Also glad we managed to figure this out.

2 Likes

Done. Thank you.

1 Like

No "in case " usr would.

i was typing answer for you put
" ALL_microcode=(/boot/*-ucode.img) " ref in that post .

you understand usr well :wink:

2 Likes

@evh5150ni

Please see the edit to :arrow_right: this post

1 Like

Thanks for the update. Only my hardened kernel preset had that line. :+1:

1 Like

Does this not say we need to edit the preset files? From what I see they are not shipped with packages so they will not be changed automatically…

so this from @pebcak is needed to edit