Is it possible to get small help with /etc/default/grub?

They aren’t related to the headers at all.

The fallback entries are useful for situations such as a hardware change where you need drivers or something else that isn’t in the normal initramfs.

If you want to not generate them you would probably have to modify the hooks which manage the mkinitcpio presets.

1 Like

For hiding them in Grub boot menu, set:

GRUB_DISABLE_RECOVERY=true

in /etc/default/grub and then regenerate grub.cfg.

For preventing them to be generated at all, edit /etc/mkinitcpio.d/linux-lts.preset (for LTS kernel for example) and comment these lines:


fallback_image="/boot/initramfs-linux-lts-fallback.img"
fallback_options="-S autodetect"
1 Like

The strange thing is that GRUB_DISABLE_RECOVERY=true is already present on my system.
Also not commented out.

1 Like

That’s strange then if you have recovery entries in grub. Don’t know of any other way.

Would that be the autodetect hook?

Possible, but as I said, this is the default after a new installation. I have this on 3 computers.

Are you sure that fallback entries are considered “recovery” entries? I didn’t think they were.

1 Like

You are right!!
I got them mixed up :person_facepalming:t5:

Sorry @anon50380917 for the confusion :blush:

Oops, now I don’t understand anything anymore … :face_with_thermometer:

That makes the two of us :sweat_smile:

I think it happens in a script called from 90-mkinitcpio-install.hook.

I am not sure I have any machines still running mkinitcpio but I believe it builds the presets from a template when a new kernel is installed.

2 Likes

Thanks, I’ll have a look later. Not on a Arch system at the moment.

1 Like

So that would mean that these entries would NOT appear if I did not additionally install the LTS kernel? Hm …, possibilities?
It’s strange that no one else has noticed this, since almost everyone has installed a 2nd kernel.

No, not at all. It happens when any kernel is installed.

Well well, in my case just the LTS kernel. So everyone who has installed more than the default kernel should have this problem?

These entries, which are useless for me, prevent me from being able to set the kernel to be booted with GRUB_DEFAULT=1.

No, the same thing happens even if you only have the mainline kernel.

Why can’t you just use GRUB_DEFAULT=2 instead?

Absolutely right!

90-mkinitcpio-install.hook:

[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Target = usr/lib/modules/*/vmlinuz
Target = usr/lib/initcpio/*

[Action]
Description = Updating linux initcpios...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/mkinitcpio-install
NeedsTargets
mkinitcpio-install
#!/bin/bash -e

args=()
all=0

while read -r line; do
    if [[ $line != */vmlinuz ]]; then
        # triggers when it's a change to usr/lib/initcpio/*
        all=1
        continue
    fi

    if ! read -r pkgbase > /dev/null 2>&1 < "${line%/vmlinuz}/pkgbase"; then
        # if the kernel has no pkgbase, we skip it
        continue
    fi

    preset="/etc/mkinitcpio.d/${pkgbase}.preset"
    if [[ ! -e $preset ]]; then
        if [[ -e $preset.pacsave ]]; then
            # move the pacsave to the template
            mv "${preset}.pacsave" "$preset"
        else
            # create the preset from the template
            sed "s|%PKGBASE%|${pkgbase}|g" /usr/share/mkinitcpio/hook.preset \
                | install -Dm644 /dev/stdin "$preset"
        fi
    fi

    # always install the kernel
    install -Dm644 "${line}" "/boot/vmlinuz-${pkgbase}"

    # compound args for each kernel
    args+=(-p "${pkgbase}")
done

if (( all )) && compgen -G /etc/mkinitcpio.d/"*.preset" > /dev/null; then
    # change to use all presets
    args=(-P)
fi

if (( ${#args[@]} )); then
    mkinitcpio "${args[@]}"
fi

Thanks for the explanation!

Because then I would have the problem again that this would not be storable with BTRFS. You said GRUB_DEFAULT=1 works without saving. Sorry if I get things mixed up again.

1 Like

Use the number that corresponds to the boot entry on the Grub boot menu that you want to have as default, counting from 0.

I am aware of that. For me that would be GRUB_DEFAULT=2, however I have there the problem under BTRFS that it is not storable. See TO.

1 Like