Mkinitcpio.conf.pacnew

mkinitcpio.conf.pacnew has some new entries

HOOKS=(base systemd autodetect microcode modconf kms keyboard keymap sd-vconsole block filesystems fsck)

should I add (or merge) it to my mkinitcpio.conf now?

Best would probably be just adding block filesystems with the parameter all.

You should manually merge new parts into the existing file, taking care to preserve extra options you may want.

For example .. if you use plymouth .. then you probably want that in your mkinitcpio HOOKS, even though it is not present in the new file.

Otherwise it mostly seems like they finally got rid of legacy HOOKS and mostly implemented the systemd one and one affiliated other (sd-vconsole).

If you want more specific help with this then show both files.

Or have a look at:

https://wiki.archlinux.org/title/Mkinitcpio#Common_hooks

I was about to ask the same thing. I recently installed CachyOS and haven’t touched the mkinitcpio.conf file, but now I’ve noticed there’s a .pacnew file. I’m a bit hesitant to merge it since I don’t want to risk bricking my system, and honestly, I don’t fully understand what I should keep and what I should replace. Any tips from someone who’s more experienced?This is my current 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=(usbhid xhci_hcd)
MODULES=(crc32c)

# 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)
#
##   This will create a systemd based initramfs which loads an encrypted root filesystem.
#    HOOKS=(base systemd autodetect modconf kms keyboard sd-vconsole sd-encrypt block filesystems fsck)
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr and fsck hooks.
HOOKS=(base udev autodetect microcode kms modconf block keyboard keymap consolefont plymouth encrypt filesystems)

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

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

# MODULES_DECOMPRESS
# Decompress loadable kernel modules and their firmware during initramfs
# creation. Switch (yes/no).
# Enable to allow further decreasing image size when using high compression
# (e.g. xz -9e or zstd --long --ultra -22) at the expense of increased RAM usage
# at early boot.
# Note that any compressed files will be placed in the uncompressed early CPIO
# to avoid double compression.
#MODULES_DECOMPRESS="no"

and this is the pacnew:

# 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=(usbhid xhci_hcd)
MODULES=()

# 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 microcode modconf block filesystems fsck)
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS=(base udev microcode 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 microcode modconf keyboard keymap consolefont block mdadm_udev encrypt filesystems fsck)
#
##   This setup loads an lvm2 volume group.
#    HOOKS=(base udev microcode modconf block lvm2 filesystems fsck)
#
##   This will create a systemd based initramfs which loads an encrypted root filesystem.
#    HOOKS=(base systemd autodetect microcode modconf kms keyboard sd-vconsole sd-encrypt block filesystems fsck)
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr and fsck hooks.
HOOKS=(base systemd autodetect microcode modconf kms keyboard keymap sd-vconsole block filesystems fsck)

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

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

# MODULES_DECOMPRESS
# Decompress loadable kernel modules and their firmware during initramfs
# creation. Switch (yes/no).
# Enable to allow further decreasing image size when using high compression
# (e.g. xz -9e or zstd --long --ultra -22) at the expense of increased RAM usage
# at early boot.
# Note that any compressed files will be placed in the uncompressed early CPIO
# to avoid double compression.
#MODULES_DECOMPRESS="no"

Due to the nature of mkinitcpio, your local config, and the proposed changes.. you were probably right to ask.

So I will try to go over these each ;

I do not know the exact importance of the inclusion of this module but as it refers to crypto and you seem to be using encryption (more on that coming up) I am inclined to think you should keep it.

There are differences in these examples here.
All the lines are commented out so its not really important .. but might as well bring in the new standard examples.
( Whats really happening: the microcode HOOK is introduced to the examples. )

Heres the fun part.
You mostly want the new version.
But it is conspicuously missing 3 things - your plymouth and encrypt and fsck.
That encrypt one is probably important if we again assume encryption.
But .. much like console for sd-vconsole .. the encypt HOOK does have a systemd replacement in sd-encrypt.
But then again it also works a little differently so you may wish to simply retain the encrypt HOOK.
Finally we have the fsck hook which is not required but, well, here is the Archwiki quoted:

As well as some minor re-ordering which should probably be followed.

And thats it.

So with the more conservative approach (retaining existing MODULE, as well as encrypt,plymouth,fsck HOOKS) the resulting file would look like this:

# 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=(usbhid xhci_hcd)
MODULES=(crc32c)

# 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 microcode modconf block filesystems fsck)
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS=(base udev microcode 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 microcode modconf keyboard keymap consolefont block mdadm_udev encrypt filesystems fsck)
#
##   This setup loads an lvm2 volume group.
#    HOOKS=(base udev microcode modconf block lvm2 filesystems fsck)
#
##   This will create a systemd based initramfs which loads an encrypted root filesystem.
#    HOOKS=(base systemd autodetect microcode modconf kms keyboard sd-vconsole sd-encrypt block filesystems fsck)
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr and fsck hooks.
HOOKS=(base systemd autodetect microcode modconf kms keyboard keymap sd-vconsole block plymouth encrypt filesystems fsck)

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

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

# MODULES_DECOMPRESS
# Decompress loadable kernel modules and their firmware during initramfs
# creation. Switch (yes/no).
# Enable to allow further decreasing image size when using high compression
# (e.g. xz -9e or zstd --long --ultra -22) at the expense of increased RAM usage
# at early boot.
# Note that any compressed files will be placed in the uncompressed early CPIO
# to avoid double compression.
#MODULES_DECOMPRESS="no"

PS.

If you are not familiar with it then the proper tool to handle pacnews is pacdiff.

To print existing ones;

pacdiff -o

To handle them (using sudoedit privleges as necessary);

pacdiff -s

If you do not have DIFFPROG set somewhere and therefor it defaults to vi comparison you can set the env var on the execution line;

DIFFPROG=meld pacdiff -s

Following the prompts to View (view is also ‘edit’ - then save and exit the comparison tool when done) and afterwards Remove the pacnew or Skip it to retain for later inspection.

$ uname -r
6.17.7-3-cachyos

config

CONFIG_CRYPTO_CRC32C=y  # built-in, for rootfs btrfs
CONFIG_CRYPTO_CRC32=m   # module, if rootfs f2fs

I use Btrfs and removed: MODULES=(crc32c) because it is built-in.(pacnew now, too)
If F2fs is your rootfs then MODULES=(crc32) should be configured, I guess.
(f2fs: include <linux/crc32.h>)
But I cannot verify because I do not have a rootfs f2fs at hand.

You might’ve gotten “( Whats really happening: the microcode HOOK is deprecated so its gone from the examples.)“ the wrong way around; the “microcode“ HOOK got added to the examples and the default HOOKS in the latest update.

You are quite right - I was thinking of microcode option in the preset files and the --microcode mkinitcpio flag which were both deprecated in favor of the HOOKS as is shown above.

( I will amend the post. )

Thank you for your detailed response! While the changes you suggested didn’t work as expected, they did motivate me to keep investigating. After applying the changes, I encountered a black screen after reboot (I use full disk encryption), but I was able to resolve it after some troubleshooting.

Here are the changes that worked for me:

My current HOOKS configuration:

HOOKS=(base systemd autodetect microcode modconf kms plymouth keyboard sd-vconsole sd-encrypt block filesystems)

I didn’t add fsck because I’m unsure whether it’s necessary for a fully encrypted Btrfs setup, and adding it would require other changes I wasn’t sure about, so I skipped it for now (maybe someone can clarify if it’s really needed).

An important part of the solution was updating the kernel cmdline for compatibility with sd-encrypt. Specifically, I needed to replace the cryptdevice=UUID=device-UUID:root root=/dev/mapper/root line with:

rd.luks.name=device-UUID=root root=/dev/mapper/root

After making that change and rebuilding my initramfs, I was able to log in without any issues or errors in the logs.

I also removed crc32c from the MODULES line, and it doesn’t seem to have affected anything, so I assume it’s safe to leave it out.

If there’s anything I’ve missed or done incorrectly, please feel free to jump in and let me know. I’d appreciate any further suggestions or corrections!

I noticed you don’t have “keymap“ in your HOOKS, which according to Arch Wiki seems to be included in “sd-vconsole“. Any idea if there’s harm in including both? The default config’s HOOKS has both.

I haven’t tried including both, but it seems that in both cases, the hooks are loading the keymap from /etc/vconsole.conf. I use a foreign keymap (defined in vconsole.conf) and haven’t encountered any issues typing my password, which includes special characters, so everything appears to be working as expected. Based on my experience, it doesn’t seem necessary to include both keymap and sd-vconsole since they both seem to be handling the keymap correctly on their own.

For those who want to add fsck and want to ensure the rw kernel command line parameter is set for the limine bootloader, don’t make my mistake of directly modifying /boot/limine.conf if that file is being auto-generated for you.

The wiki entry for limine doesn’t take into account tools that compose the file. In my case, /etc/limine-entry-tool.conf indicates where to find the cmdline value generated

### Kernel Command Line Configuration
### Define one or more kernel command lines (parameters) for specific kernel entries.
### If unset, the tool will try to read them from '/etc/kernel/cmdline' or '/proc/cmdline'.

And I found /proc/cmdline was the place I needed to check for the rw cmdline parameter.

For GRUB with full disk encryption on Btrfs, I switched to systemd-based initramfs hooks.

In /etc/mkinitcpio.conf I changed:

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

to:

HOOKS=(base systemd autodetect microcode modconf block keyboard sd-vconsole sd-encrypt filesystems)

In /etc/default/grub (GRUB_CMDLINE_LINUX_DEFAULT) I changed:

cryptdevice=UUID=xxx:luks-yyy root=/dev/mapper/luks-yyy

to:

rd.luks.uuid=xxx rd.luks.key=/crypto_keyfile.bin

Then:

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

Result: ~4 seconds shaved off boot time :wink: