ISO -Calamares-GRUB issue (ucode)

I run a little Manjaro Spin called DeLinuxCo, (Cinnamon Desktop).
The spin is mostly cosmetic with a handful of apps in a repo.

Note: I am running the latest iso-profiles.

The issue: ISO boots just fine, install has no issues, but after reboot GRUB gives error message;

 "error: file '/boot/intel-ucode.img' " not found. Press any key to continue...

or it may say it is /boot/amd-ucode.img that is missing.

The issue appears to be that the installer is correctly choosing the ucode image during the install for the particular system. For example, if the system is an intel CPU, it installs intel-ucode but does not install amd-ucode.img. Conversely, the opposite is true, if an AMD CPU is installed, amd-ucode.img is installed but not intel-ucode.img. If the system has both an intel CPU and a AMD GPU, it will install both ucode images. In this scenario, the system should boot with no issues.

The issue is that although, let’s say that amd-ucode.img is not installed, GRUB boot loader has both entries and therefore at boot, if one is missing, it will generate the error accordingly.

The workaround is to edit GRUB at boot, delete the entry for the missing ucode and continue booting. Once the system has booted, just install the missing image, intel-ucode or amd-ucode. Reboot, and the system should be fine.

Anyone else have this issue?

Link to previous issue: Intel-ucode not installed during install

this concerns only USB iso install ,
or post-intall on disk ?

see this it concerns grub option
[Testing Update] 2024-03-23 - Pacman 6.1, KDE Gear, Nvidia, Gstreamer, AMD ROCm - #15 by Mysak0CZ

So when booting the ISO, all is well, no issues, I have not found a system that will not boot. The install goes well, no errors.

But when rebooting after installing, the first boot off of the boot drive, that is when the error occurs.

I have tried this on two laptops, two intel and one AMD CPU’s. On the intel machines, it will give an error that amd-ucode.img is missing, on the AMD laptop, it will give an error that the intel-ucode.img is missing.

The link, does not seem to have anything directly related to the current issue.

can you report then

sudo cat /etc/default/grub
sudo cat /etc/mkinitcpio.conf

I thought I saw another related thread recently…

Calling our ISO profile expert @linux-aarhus

The correct command is sudo cat /etc/default/grub

I create a new VM for testing and grabbed info from both the ISO and the installed OS.
After install and while still in the ISO, the Calameras log still shows that it removes, in this case, the intel-ucode package just before completing the install. So if I was to guess, the issue seems to be in Calamares, in that it should not be removing the package because GRUB has an entry for both.

ISO - sudo cat /etc/mkinitcpio.conf

 DeLinuxCo  manjaro  ~  sudo cat /etc/default/grub
GRUB_DEFAULT=saved
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Manjaro"
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

# If you want to enable the save default function, uncomment the following
# line, and set GRUB_DEFAULT to saved.
GRUB_SAVEDEFAULT=true

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter 
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx" 
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper 
# modes only.  Entries specified as foreground/background.
GRUB_COLOR_NORMAL="light-gray/black"
GRUB_COLOR_HIGHLIGHT="green/black"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/usr/share/grub/background.png"
#GRUB_THEME="/path/to/gfxtheme"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

ISO - sudo cat /etc/mkinitcpio.conf

# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES=(qxl bochs_drm virtio-gpu virtio virtio_scsi virtio_blk virtio_pci virtio_net virtio_ring)
MODULES=(qxl bochs_drm virtio-gpu virtio virtio_scsi virtio_blk virtio_pci virtio_net virtio_ring)

# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image.  This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
BINARIES=()

# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way.  This is useful for config files.
FILES=()

# HOOKS
# This is the most important setting in this file.  The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
##   This setup specifies all modules in the MODULES setting above.
##   No RAID, lvm2, or encrypted root is needed.
#    HOOKS=(base)
#
##   This setup will autodetect all modules for your system and should
##   work as a sane default
#    HOOKS=(base udev autodetect modconf block filesystems fsck)
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS=(base udev modconf block filesystems fsck)
#
##   This setup assembles a mdadm array with an encrypted root file system.
##   Note: See 'mkinitcpio -H mdadm_udev' for more information on RAID devices.
#    HOOKS=(base udev modconf keyboard keymap consolefont block mdadm_udev encrypt filesystems fsck)
#
##   This setup loads an lvm2 volume group.
#    HOOKS=(base udev modconf block lvm2 filesystems fsck)
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr and fsck hooks.
HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block filesystems fsck)

# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"
#COMPRESSION="zstd"

# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=()

# MODULES_DECOMPRESS
# Decompress kernel modules during initramfs creation.
# Enable to speedup boot process, disable to save RAM
# during early userspace. Switch (yes/no).
#MODULES_DECOMPRESS="yes"

VM-INSTALL: sudo cat /etc/default/grub

GRUB_DEFAULT=saved
GRUB_TIMEOUT=5
GRUB_TIMEOUT_STYLE=hidden
GRUB_DISTRIBUTOR='Manjaro'
GRUB_CMDLINE_LINUX_DEFAULT='quiet apparmor=1 security=apparmor resume=UUID=1fd36758-9bd1-4fa9-8939-7f9d591692c7 udev.log_priority=3'
GRUB_CMDLINE_LINUX=""

# If you want to enable the save default function, uncomment the following
# line, and set GRUB_DEFAULT to saved.
GRUB_SAVEDEFAULT=true

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command 'videoinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment this option to enable os-prober execution in the grub-mkconfig command
GRUB_DISABLE_OS_PROBER=false

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
GRUB_COLOR_NORMAL="light-gray/black"
GRUB_COLOR_HIGHLIGHT="green/black"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/usr/share/grub/background.png"
#GRUB_THEME="/path/to/gfxtheme"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

# Uncomment to ensure that the root filesystem is mounted read-only so that
# systemd-fsck can run the check automatically. We use 'fsck' by default, which
# needs 'rw' as boot parameter, to avoid delay in boot-time. 'fsck' needs to be
# removed from 'mkinitcpio.conf' to make 'systemd-fsck' work.
# See also Arch-Wiki: https://wiki.archlinux.org/index.php/Fsck#Boot_time_checking
#GRUB_ROOT_FS_RO=true

VM-INSTALL: sudo cat /etc/mkinitcpio.conf

# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES=(qxl bochs_drm virtio-gpu virtio virtio_scsi virtio_blk virtio_pci virtio_net virtio_ring)
MODULES=(qxl bochs_drm virtio-gpu virtio virtio_scsi virtio_blk virtio_pci virtio_net virtio_ring)

# BINARIES
# This setting includes any additional binaries a given user may
# wish into the CPIO image.  This is run last, so it may be used to
# override the actual binaries included by a given hook
# BINARIES are dependency parsed, so you may safely ignore libraries
BINARIES=()

# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in any way.  This is useful for config files.
FILES=()

# HOOKS
# This is the most important setting in this file.  The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
##   This setup specifies all modules in the MODULES setting above.
##   No RAID, lvm2, or encrypted root is needed.
#    HOOKS=(base)
#
##   This setup will autodetect all modules for your system and should
##   work as a sane default
#    HOOKS=(base udev autodetect modconf block filesystems fsck)
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS=(base udev modconf block filesystems fsck)
#
##   This setup assembles a mdadm array with an encrypted root file system.
##   Note: See 'mkinitcpio -H mdadm_udev' for more information on RAID devices.
#    HOOKS=(base udev modconf keyboard keymap consolefont block mdadm_udev encrypt filesystems fsck)
#
##   This setup loads an lvm2 volume group.
#    HOOKS=(base udev modconf block lvm2 filesystems fsck)
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr and fsck hooks.
HOOKS=(base udev autodetect kms modconf block keyboard keymap consolefont resume filesystems fsck)

# COMPRESSION
# Use this to compress the initramfs image. By default, gzip compression
# is used. Use 'cat' to create an uncompressed image.
#COMPRESSION="gzip"
#COMPRESSION="bzip2"
#COMPRESSION="lzma"
#COMPRESSION="xz"
#COMPRESSION="lzop"
#COMPRESSION="lz4"
#COMPRESSION="zstd"

# COMPRESSION_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=()

# MODULES_DECOMPRESS
# Decompress kernel modules during initramfs creation.
# Enable to speedup boot process, disable to save RAM
# during early userspace. Switch (yes/no).
#MODULES_DECOMPRESS="yes"

The ucode file is auto detected when you run mkinitcpio.

Whichever is found it will be added to init.

Speculating that a race condition is in play or a missing run of mkinitcpio after mhwd removes the obsolete ucode image.

mhwd is mix of templates and c++ code which makes it very hard to deduce what is happening

I previously thought that mhwd was responsible for applying the correct ucode - it is not - æbut the postcfg process in Calamares - the postcfg function - (python code) - shouldn’t present any race conditions - as it is not async or threaded

The relevant snippet is lines 104-109 where the irrelevant ucode image is uninsstalled

        # Remove unneeded ucode
        cpu_ucode = subprocess.getoutput("hwinfo --cpu | grep Vendor: -m1 | cut -d\'\"\' -f2")
        if cpu_ucode == "AuthenticAMD":
            self.remove_pkg("intel-ucode", "boot/intel-ucode.img")
        elif cpu_ucode == "GenuineIntel":
            self.remove_pkg("amd-ucode", "boot/amd-ucode.img")

And in line 124-126 - a call to update-grub is made

        # Update grub.cfg
        if exists(join(self.root, "usr/bin/update-grub")):
            target_env_call(["update-grub"])

From the code it appears that Calamares is doing what Calamares should do.

So if mkinitcpio is detecting both ucode why is Calameras deleting one of them?

FYI - I did verify that I did not have intel-ucode or amd-ucode in ~/iso-profiles/community/cinnamon/Packages-Desktop just to make sure.

So from what I can deduce, Calamares is using hardware info to determine which ucode if any needs to be removed. But mkinitcpio is finding both ucodes and at the last minute Calamares is removing one of the ucodes.

I think this is a bug…

The ucode images is installed to the root filesystem defined in Packages-Root.

And the post configuration uses the running system - the CPU - to determine if one or the other should be removed.

There has been no changes in that regard.

The initcpiocfg function initializes the HOOKS array with

    hooks = [
        "autodetect",
        "microcode",
        "kms",
        "modconf",
        "block",
        "keyboard",
    ]

The calamares settings - partly shown

    - exec:
        - partition
        - mount
        - unpackfs
        - networkcfg
        - machineid
        - fstab
        - locale
        - keyboard
        - localecfg
        - luksopenswaphookcfg
        - luksbootkeyfile
        - initcpiocfg
        - initcpio
        - users
        - displaymanager
        - mhwdcfg
        - hwclock
        - services
        - grubcfg
        - bootloader
        - postcfg
        - umount

This lists initcpiocfg way before postcfg - I believe this could be the cause as the micro code inclusion is not longer in postcfg but in initcpiocfg

I am trying to understand, here is the logic as I see it.

  1. ISO-profiles uses Packages-Root has both intel-ucode and amd-ucode listed, the installer will then use this list of packages and install said packages on new system.

  2. When mkinitcpio runs, it detects both intel-ucode and amd-ucode and creates the corresponding entries.

  3. Calamares, ignores what ever was generated by mkinitcpio and deletes which ever ucode is not needed based on hardware info. Because this is done after mkinitcpio is run, we have an entry in GRUB that cannot be found because Calamares removed said ucode.

Number 1 and 2 is correct.

What actually happens is that based on the rootfs which is rsynced to the target system and is having both ucode packages the installer will run initcpiocfg then initcpio then as the last step uninstall the obsolete ucode package based on host CPU.

That last step does not take into account the new microcode hook which is used in the Calamares initcpio pass.

I think I have located where the issue is

It depends what we are talking about here. Since we had split out update-grub to be a separate package it can be that the script is missing. Then calamares will remove the ucode but doesn’t update the grub config. So check if the update-grub binary is acutally there. As @cscs noticed already we might want to change the code to not use update-grub but rather the cmds what the update-grub script would call instead.

Adding microcode hook into the mix might be true for ISO based on testing and unstable branches.

1 Like

Another issue regarding ucode can be with BTRFS. there amd-ucode has an issue. it is claimed that amd-ucode-git fixes that …

Well, adding update-grub to the Packages-Root list seems to have fixed it. I just ran another ISO and this time it booted on first boot.

After booting, I verified, intel-ucode is not installed on my all AMD system nor listed in GRUB.

update-grub has always been in Packages-Root as far as I know, but only if you use a symlink to
/iso-profiles/shared/Packages-Root

Yes, you are correct, the community version does not use a symlink it comes with an actual Packages-Root file, and it is missing in that file.

I have decided to use the community file after all, I will perform a vlookup against the Shared file every time there is an update and pick and choose what I wish to add on to the community file.

I use this in a script

sudo ln -s /iso-profiles/shared/Packages-Root /iso-profiles/community/cinnamon

doing this first
sudo rm /iso-profiles/community/cinnamon/Packages-Root

also
gksu xed /iso-profiles/community/cinnamon/Packages-Root

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.