Manjaro-pacnew-checker: Help to understand /etc/mkinitcpio.conf.pacnew

manjaro-pacnew-checker brought up the files

/etc/mkinitcpio.conf.pacnew
/etc/mkinitcpio.conf

These are mostly comments but I’d like to understand some background, as for sure myself never touched this file. How should I process it?

/etc/mkinitcpio.conf.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 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 modconf kms keyboard keymap consolefont 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"
/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=(piix ide_disk reiserfs)
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 block filesystems)
#
##   This setup will generate a 'full' image which supports most systems.
##   No autodetection is done.
#    HOOKS=(base udev block filesystems)
#
##   This setup assembles a pata mdadm array with an encrypted root FS.
##   Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
#    HOOKS=(base udev block mdadm encrypt filesystems)
#
##   This setup loads an lvm2 volume group on a usb device.
#    HOOKS=(base udev block lvm2 filesystems)
#
##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr, fsck and shutdown hooks.
HOOKS=(base udev autodetect modconf kms block keyboard keymap resume filesystems)

# 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_OPTIONS
# Additional options for the compressor
#COMPRESSION_OPTIONS=()

The status of manjaro-pacnew-checker is unclear while pacdiff is tested and reliable.

Therefor the recommended approach would be DIFFPROG=meld pacdiff -s
Where DIFFPROG may be defined as any preferred comparison tool, the -s flag invokes sudo -e as necessary, and the prompts should generally be responded to initially with a V to open the defined comparison tool and make any required changes, and additionally S to skip an entry and R to remove one.

As to the specific files/comparison shown here;

You should add microcode to yours if you want the microcode to be loaded/updated.

I (and the pacnew) also note you are missing the fsck hook for some reason … which is filesystem check and recommended on all systems aside from the following considerations.

Its OK to not have this if you are using the systemd hook and mount your filesystem read-only first. But you are unlikely doing the latter and definitely not using the former.

For a comprehensive guide to mkinitcpio see the archwiki:
https://wiki.archlinux.org/title/Mkinitcpio

PS.

The order does matter, so insert fsck at the end and microcode after autodetect.

PPS.

Somewhat similar to the above the resume hook is only helpful for hibernation and only needed if the systemd hook is not used.

And somewhat similar to that consolefont is only useful for displaying a certain font (from /etc/vconsole) to the initramfs and is only needed when not using the sd-vconsole hook which would cover the already mentioned font capabilities as well as those of the keymap hook.

1 Like

It is also not needed if the root filesystem is btrfs, because btrfs has its own integrity checking routine, and will perform such check upon every mount.

Interestingly, it is also capable of replaying the journal on read-only-mounted filesystems if needed.

Thanks a lot @cscs!
DIFFPROG=meld pacdiff -s is extremely useful, especially as i can run it on my initiative and not only after an update.

The additions you mentioned make sense to me. If I understand you correct I’ll take these lines from the.pacnew-version

##   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 modconf kms keyboard keymap consolefont block filesystems fsck)

I’d appreciate your confirmation or addition.

If you compare the two lines, you will see that you either have to add the microcode hook to your existing file and remove pacnew, or add the resume hook at the end of the line in the pacnew and overwrite the old file.

Don’t forget to sudo mkinitcpio -P after that.

P.s. the order of the hooks in the line is important.

1 Like

This is fine if you do not need resume (hibernation).

Thanks a lot @cscs, I would have missed that as it is in the actual version but not in the old one.
As I’m using Resume (hibernation), I’m thinking about this line:

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

Do you agree?

Btw.: DIFFPROG=meld pacdiff -s works fine, but I’d like to have a list of all files as shown here from Manjaro-pacnew-checker. I tried:

$ pacdiff --locate
/usr/bin/pacdiff: Zeile 224: locate: command not found   # What's wrong here?

Any chance to have this?

pacdiff -o

will output or print all found pacnew/pacsave files.

This is fine.
filesystem is placed twice and should only probably retain the one at the end before fsck.
( Thanks for noticing @Teo I had missed it :sweat_smile: )
When you’re done making changes then to do the rebuilding of the initramfs that uses these options execute:

sudo mkinitcpio -P
sudo update-grub
1 Like

You have filesystems twice ! Otherwise ok.

1 Like

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