You are not logged in.

#1 2024-03-04 17:56:29

Nikolai5
Member
From: North West, England, UK
Registered: 2024-01-27
Posts: 186

How to deal with new mkinitcpio update with GRUB microcode [solved]

Hi,

The latest announcement / update (https://archlinux.org/news/mkinitcpio-h … microcode/) says the following:

Please note that the mkinitcpio flag --microcode, and the microcode option in the preset files, has been deprecated in favour of a new microcode hook. This also allows you to drop the microcode initrd lines from your boot configuration as they are now packed together with the main initramfs image.

However, when running grub-mkconfig it still automatically detects and adds the boot options:         initrd  /amd-ucode.img /initramfs-linux-zen.img

Do I understand correctly that this announcement suggests amd-ucode.img does not need to be there because its now packaged within /initramfs-linux-zen.img (or other kernel equivalent)?
How do I tell GRUB to not auto add it, if that is the case? The microcode wiki as far as I've read only mentions that its auto added during grub-mkconfig.


Edit: Resolved (Comment 8)

Last edited by Nikolai5 (2024-03-04 19:52:55)


Desktop: Ryzen 7 1800X | AMD 7800XT | KDE Plasma
MacbookPro-2012 | MATE

Offline

#2 2024-03-04 18:27:12

mesaprotector
Member
Registered: 2024-03-03
Posts: 166

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

I'm also interested in this. I use a unified kernel image and read this as "delete the line about microcode in /etc/mkinitcpio.d/linux.preset". I have never heard of adding a hook to that file; am I supposed to add it to /etc/mkinitcpio.conf, and if so, in what order? Or does this mean I can just delete the line and not worry about anything else?

Offline

#3 2024-03-04 18:32:38

brian001
Member
Registered: 2021-01-04
Posts: 10

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

From what I can see, they've moved the microcode directive from the /etc/mkinitcpio.d/linux.preset file into a hook that gets loaded by a "microcode" entry in the HOOKS line of /etc/mkinitcpio.conf.

If you've never touched either of those files, then it should have updated the default files to make the swap. If you've customized them, you may need to make changes.

None of this is in the wiki yet that I could find.

I'm not sure if GRUB has to be changed. It's mkinitcpio that builds the initramfs file and then GRUB just loads it.

EDIT: From https://wiki.archlinux.org/title/microcode#GRUB it looks like GRUB does load the microcode. So not sure what changes to make for GRUB.

Last edited by brian001 (2024-03-04 18:40:35)

Offline

#4 2024-03-04 18:37:21

brian001
Member
Registered: 2021-01-04
Posts: 10

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

I recommend using a drop in directory to change /etc/mkinitcpio.conf. Just make a directory /etc/mkinitcpio.conf.d/ and then copy /etc/mkinitcpio.conf to /etc/mkinitcpio.conf.d/mkinitcpio-custom.conf.

You can use any name, but when it builds it lists the name, so I like to see that it is using the custom file.

That way when the system updates the default /etc/mkinitcpio.conf file you can just look at the changes and make them in your custom file. That was the only way that I knew where in the HOOK order to put the new microcode hook. The default is now:

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

EDIT: If you edited the /etc/mkinitcpio.conf file directly, you might have a /etc/mkinitcpio.conf.pacnew file that has the change.

Last edited by brian001 (2024-03-04 18:42:30)

Offline

#5 2024-03-04 18:47:06

Nikolai5
Member
From: North West, England, UK
Registered: 2024-01-27
Posts: 186

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

Yes, I've just checked and there is a pacnew file. My last update was massive so must have missed that it created that file in the upgrade.

My original file is:

HOOKS=(base udev autodetect keyboard keymap modconf block encrypt filesystems fsck)

and the pacnew is:

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

I will try replacing the file, re-running grub and seeing how it goes. Will report back.


Desktop: Ryzen 7 1800X | AMD 7800XT | KDE Plasma
MacbookPro-2012 | MATE

Offline

#6 2024-03-04 18:52:30

mesaprotector
Member
Registered: 2024-03-03
Posts: 166

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

Thank you for the tip about the pacnew file! The pacnew just lists the default, which is very different from what I run now, but it does answer my question - "microcode" goes between "autodetect" and "modconf". My system boots - well, about the same as it did before. I'll miss the former neatly-organized console output from mkinitcpio though, it's definitely more opaque now.

(Also realized a little late I could've tried "mkinitcpio -H microcode".)

Offline

#7 2024-03-04 19:08:06

Nikolai5
Member
From: North West, England, UK
Registered: 2024-01-27
Posts: 186

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

After replacing with new file, grub still auto adds it, so the original question still stands.

It doesn't actually seem to be causing a functional problem and there are no errors in journalctl, but I'd like to confirm it's set up correctly even so.

Edit: Also just a quick warning to people about replacing your original with the .pacnew file.
Take care to check whether your config contains things like "encrypt" if you use LUKS, as the default may not have that set. Don't just smash that file in without checking to see if anything is missing that is present in your .conf file.

Last edited by Nikolai5 (2024-03-04 19:40:10)


Desktop: Ryzen 7 1800X | AMD 7800XT | KDE Plasma
MacbookPro-2012 | MATE

Offline

#8 2024-03-04 19:40:51

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,383
Website

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

Nikolai5 wrote:

Do I understand correctly that this announcement suggests amd-ucode.img does not need to be there because its now packaged within /initramfs-linux-zen.img (or other kernel equivalent)?

Yes but only if the new hook is added to /etc/mkinitcpio.conf.

Nikolai5 wrote:

How do I tell GRUB to not auto add it, if that is the case?

Add this line to /etc/default/grub then regenerate grub.cfg:

GRUB_EARLY_INITRD_LINUX_STOCK=''

Para todos todo, para nosotros nada

Offline

#9 2024-03-04 19:52:16

Nikolai5
Member
From: North West, England, UK
Registered: 2024-01-27
Posts: 186

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

Ah, thanks for the response with "GRUB_EARLY_INITRD_LINUX_STOCK".

I'll have a read into it before doing anything but based on what I've read in the GRUB manual that would indeed work. Appreciate it.


Desktop: Ryzen 7 1800X | AMD 7800XT | KDE Plasma
MacbookPro-2012 | MATE

Offline

#10 2024-03-04 21:27:40

troymcfont
Member
Registered: 2019-06-09
Posts: 32

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

I am also a bit confused by the manual changes I need to do after this upgrade. Previous to the upgrade, I had the hooks "encrypt" and "lvm2" in "/etc/mkinitcpio.conf". Now, there is a new file "/etc/mkinitcpio.conf.pacnew" without these hooks but with the "microcode" hook. I could successfully boot after the upgrade, but I believe this is because it is using the old configuration (/etc/mkinitcpio.conf).

To make the transition, do I need to add the "encrypt" and "lvm2"  hooks into "/etc/mkinitcpio.conf.pacnew" and then just rename it to "/etc/mkinitcpio.conf"? I guess I also need to update grub.cfg as mentioned above.
In /etc, I also have "mkinitcpio.conf.d/" (empty) and "mkinitcpio.d/linux.preset". Are changes required in the later file? Also, can I remove the empty "mkinitcpio.conf.d/" directory?

Sorry for so many questions, but this morning I already had to fix an upgrade-gone-wrong issue and I do not want to mess up again...
Thanks! smile

Offline

#11 2024-03-04 21:41:52

Fuxino
Member
From: Slovakia
Registered: 2014-09-26
Posts: 198

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

Yes, you need to merge the .pacnew file with the configuration file you're currently using. And in the preset file you can remove the microcode option, as explained in the news in homepage. I don't use Grub so no idea about that.


Arch + XMonad

Dotfiles: https://github.com/Fuxino/dotfiles

Offline

#12 2024-03-05 00:50:10

troymcfont
Member
Registered: 2019-06-09
Posts: 32

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

This is my preset file, and I  guess the "ALL_microcode=(/boot/*-ucode.img)" is the line to be removed?

# mkinitcpio preset file for the 'linux' package

#ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-linux"
ALL_microcode=(/boot/*-ucode.img)

PRESETS=('default' 'fallback')

#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-linux.img"
#default_uki="/efi/EFI/Linux/arch-linux.efi"
#default_options="--splash /usr/share/systemd/bootctl/splash-arch.bmp"

#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs-linux-fallback.img"
#fallback_uki="/efi/EFI/Linux/arch-linux-fallback.efi"
fallback_options="-S autodetect"

Last edited by troymcfont (2024-03-05 00:53:42)

Offline

#13 2024-03-05 09:34:26

Nikolai5
Member
From: North West, England, UK
Registered: 2024-01-27
Posts: 186

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

troymcfont wrote:

To make the transition, do I need to add the "encrypt" and "lvm2"  hooks into "/etc/mkinitcpio.conf.pacnew" and then just rename it to "/etc/mkinitcpio.conf"? I guess I also need to update grub.cfg as mentioned above.

Yes, you will need to make sure those are listed in HOOKS. If your drive is encrypted and you don't specify the options it won't be able to boot as it won't know to prompt and try to decrypt your drive.
If you didn't do that, it would fail to boot complaining about accessing the drive and to fix it you would need to run the Arch live iso, decrypt your drive, mount it, mount boot if that's separate, arch-chroot in and fix the config file and re-run "mkinitcpio -P"

Last edited by Nikolai5 (2024-03-05 13:21:15)


Desktop: Ryzen 7 1800X | AMD 7800XT | KDE Plasma
MacbookPro-2012 | MATE

Offline

#14 2024-03-05 18:01:10

chang-zhao
Member
Registered: 2024-01-21
Posts: 24

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

Excuse me if it should be all clear by now, but it's all so cryptic for me, that I want to check with the gurus smile.
My '/etc/mkinitcpio.conf' and '/etc/mkinitcpio.conf.pacnew' have (old vs new):

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

(1) Do I just replace the old line in '/etc/mkinitcpio.conf' with the new one?
Or I don't need e.g. "kms" there, as I probably didn't have "Early KMS start" before?
(Nvidia proprietary).


(2) And do I just remove "ALL_microcode=(/boot/*-ucode.img)" line from my '/etc/mkinitcpio.d/linux-lts.preset'?:

# mkinitcpio preset file for the 'linux-lts' package

#ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-linux-lts"
ALL_microcode=(/boot/*-ucode.img)

PRESETS=('default' 'fallback')

#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-linux-lts.img"
#default_uki="/efi/EFI/Linux/arch-linux-lts.efi"
#default_options="--splash /usr/share/systemd/bootctl/splash-arch.bmp"

#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs-linux-lts-fallback.img"
#fallback_uki="/efi/EFI/Linux/arch-linux-lts-fallback.efi"
fallback_options="-S autodetect"

Will these two operations work OK?

(Or maybe, I don't know, removing "ALL_microcode=(/boot/*-ucode.img)" I would need to add something to '/etc/mkinitcpio.conf'?)


(3) After that, do I need to re-run something like

grub-mkconfig -o /boot/grub/grub.cfg

or

mkinitcpio -P

?

Thank you.

(And I'm wondering, but that's apropos,
Why doesn't installer do all that automatically, if my config is just the default one?)

Last edited by chang-zhao (2024-03-05 18:05:39)

Offline

#15 2024-03-05 21:03:34

Nebulosa
Member
Registered: 2009-08-24
Posts: 48

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

Head_on_a_Stick wrote:

Yes but only if the new hook is added to /etc/mkinitcpio.conf.
Add this line to /etc/default/grub then regenerate grub.cfg:

GRUB_EARLY_INITRD_LINUX_STOCK=''

Should I leave the intel-ucode (or amd-ucode) packages installed after this step?

Offline

#16 2024-03-05 21:25:07

Nebulosa
Member
Registered: 2009-08-24
Posts: 48

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

chang-zhao wrote:

(1) Do I just replace the old line in '/etc/mkinitcpio.conf' with the new one?

You can just add 'microcode' to HOOKS

chang-zhao wrote:

(2) And do I just remove "ALL_microcode=(/boot/*-ucode.img)" line from my '/etc/mkinitcpio.d/linux-lts.preset'?:

Yes. Comment or delete this line.
Repeat this action for all *.preset files

chang-zhao wrote:

(3) After that, do I need to re-run something like

As usual, after editing *.preset or /etc/mkinitcpio.conf files either, you should update images:

sudo mkinitcpio -P # -P for all kernels

Then add the line GRUB_EARLY_INITRD_LINUX_STOCK='' in /etc/default/grub

And update GRUB menus:

sudo grub-mkconfig -o /boot/grub/grub.cfg

Offline

#17 2024-03-09 13:54:04

kero
Member
Registered: 2012-08-26
Posts: 44

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

Just to be clear: if I use the "microcode" HOOK in /est/mkinitcpio.conf, can I safely remove the "local/intel-ucode" package ?

Last edited by kero (2024-03-09 13:54:21)

Offline

#18 2024-03-09 14:03:27

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,145

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

No

Offline

#19 2024-03-09 14:03:54

Nikolai5
Member
From: North West, England, UK
Registered: 2024-01-27
Posts: 186

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

kero wrote:

Just to be clear: if I use the "microcode" HOOK in /est/mkinitcpio.conf, can I safely remove the "local/intel-ucode" package ?

The package still needs to be installed.


Desktop: Ryzen 7 1800X | AMD 7800XT | KDE Plasma
MacbookPro-2012 | MATE

Offline

#20 2024-03-09 21:30:54

kero
Member
Registered: 2012-08-26
Posts: 44

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

Ok, thank you Scimmia and Nikolai5.

Offline

#21 2024-03-12 18:50:21

gary8588
Member
Registered: 2022-08-09
Posts: 27

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

I too have a few questions since unfortunately the News isn't very clear to me.

I've done so far:

* Removed ALL_microcode=(/boot/*-ucode.img) from /etc/mkinitcpio.d/linux.preset
* Merged pacnew file for /etc/mkinitcpio.conf
* Then updated /etc/default/grub with option GRUB_EARLY_INITRD_LINUX_STOCK=""

But still grub generates initrd option lines. Shouldn't that be gone or do I have to remove the intel-ucode.img files? And probably only that one right?

$ sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/initramfs-linux.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done

Offline

#22 2024-03-12 20:11:34

Nebulosa
Member
Registered: 2009-08-24
Posts: 48

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

gary8588 wrote:

* Then updated /etc/default/grub with option GRUB_EARLY_INITRD_LINUX_STOCK=""

Please show /etc/default/grub file content by doing:

grep -Ev "^(#|$)" /etc/default/grub

Offline

#23 2024-03-12 20:39:45

gary8588
Member
Registered: 2022-08-09
Posts: 27

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

Sure, here it is:

$ grep -Ev "^(#|$)" /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet i915.enable_psr=1"
GRUB_CMDLINE_LINUX=""
GRUB_EARLY_INITRD_LINUX_STOCK=""
GRUB_PRELOAD_MODULES="part_gpt part_msdos"
GRUB_TIMEOUT_STYLE=hidden
GRUB_TERMINAL_INPUT=console
GRUB_GFXMODE=auto
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_DISABLE_RECOVERY=true

Offline

#24 2024-03-13 06:00:05

Nebulosa
Member
Registered: 2009-08-24
Posts: 48

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

gary8588 wrote:

Sure, here it is:

$ grep -Ev "^(#|$)" /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet i915.enable_psr=1"
GRUB_CMDLINE_LINUX=""
GRUB_EARLY_INITRD_LINUX_STOCK=""
GRUB_PRELOAD_MODULES="part_gpt part_msdos"
GRUB_TIMEOUT_STYLE=hidden
GRUB_TERMINAL_INPUT=console
GRUB_GFXMODE=auto
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_DISABLE_RECOVERY=true

Mine almost the same, but with lines at the very end of the file:

GRUB_DISABLE_OS_PROBER=false
GRUB_EARLY_INITRD_LINUX_STOCK=''

Try this, maybe order of lines is matter

If not, you need to rename /boot/intel-ucode.img to boot/intel-ucode.backup at regenerate grub menu again.

Last edited by Nebulosa (2024-03-13 06:00:53)

Offline

#25 2024-03-13 17:37:47

gary8588
Member
Registered: 2022-08-09
Posts: 27

Re: How to deal with new mkinitcpio update with GRUB microcode [solved]

Thanks, now it works it seems:

$ sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done

Interestingly though I haven't done anything differently, just reran mkinitcpio -P and grub-mkconfig today. Also I confirmed that microcode gets loaded early by running command below (fortunately there was a intel-ucode update so I could verify that revisions changed):

$ journalctl -k --grep=microcode
Mar 13 18:25:05 ibs kernel: GDS: Mitigation: Microcode
Mar 13 18:25:05 ibs kernel: microcode: Current revision: 0x000000b6
Mar 13 18:25:05 ibs kernel: microcode: Updated early from: 0x0000008a

Last edited by gary8588 (2024-03-13 17:39:40)

Offline

Board footer

Powered by FluxBB