A list of pacman/alpm hooks I use to make life easier for me

I will just leave this here in case it sparks any interest. I will provide a brief explanation as to what each one does. My reason for using them lies in the descriptions

  1. desktop-patcher-hook
    This is a hook that runs whenever you update any applications that contain an executable script that is available through desktop entry based executable. It is meant to improve wayland compatibility when it comes to both gtk and qt applications like web browsers.

2.pacman-cleanup-hook
All this does is cleans out any old package caches older then the two most recent versions of them. pretty striaght forward. it will let you know in the command line with a message mentioning pruning old packages. If anything got removed, it will be listed. This hook will be called whenever you install a new package, upgrade a package or remove a package.

3.pacman-hook-list-systemd-units
This hook is always run whenever installing new packages that contain a .service file in them. If you install for example, supervisord, it will let you know about it’s existence during a post transaction hook. This can be helpful in keeping the user informed about new daemons. It does not repeat this behavior if the package was already installed. So if you do an update, it won’t show it again.

4.pacman-hook-reload-modules
If you ever felt frustrated by updating something or install something that involves periphery drivers, such as display (mesa,vulkan) and sound (pipewire,alsa,pulseaudio), this hook will basically reload the updated modules as a post transaction hook. Takes only about 1-2 seconds to do it all

  1. pacman-log-orphan-hooks
    This hook is a post transaction hook that is run after package installation, upgrade, or removal. When you do any of those things, it will scan you package data to see if there are any packages without any active dependence on them, often referred to as orphans. If it finds any, it will list them and provide you with a helpful instruction on how to get rid of them if you want to.

  2. pacman-pkgfile-hook
    This is a post transaction hook that updates the pkgfile database after any installations, upgrades or removals.

  3. pacman-sync
    This one is one that makes me feel more at ease. This hook is run at the end of all the other pacman/alpm hooks. All it does is sync your file systems/partitions to ensure that all changes have been synchornized. It ensures that no changes get missed.

  4. pacman-systemd-inhibit
    This one is pretty straight forward. It is a hook designed for safety. Whenever you are installing, removing, or upgrading packages, this hook triggers at the beginning, preventing your system from shutting down prematurely. Once all other tasks are completed, it will then release the lock and allow you to shut down your computer. You can of course cancel the running commands but I would advise you not do this unless you realized you may have made a big mistake that you don’t want to finish in which case you would do the ctrl+c command.

9&10. overdue and longoverdue (These two pretty much do the same thing)
overdue is a hook that will run during post transaction. If any particular user services such as the plasma session, plasma shell, dbus, systemd, sddm, etc, is running on outdated binaries or libraries, it will print that out in the command line.
longoverdue is mostly identical to overdue except it is more robust in its scan. No practical reason to have both but its up to you.

  1. systemd-removed-services-hook
    This one basically lets you know how to handle removed systemd units/services if you remove associated packages with said services. This guides with steps needed to get rid of their old symbolic links left behind.

  2. precompile-bits-stdc++.h
    Ok to be completely honest I don’t exactly know what triggers this one. It basically precompiles header files related to the std lib based on its description. It seems to run on occasion when ugprading the linux kernel. Probably intended for developers.

  3. linux-preserve-modules
    Ok so this one might be of important note for any one who uses cow filesystems. It basically locks in the current modules of the running kernel so you don’t end up breaking something during an upgrade due to the possibility of the changes being made in real time leading to a broken kernel image. It may be rare but this kind of thing happened to me twice in the past year.

  4. rebuild-initramfs-dracut + rebuild-initramfs-dracut-hook
    Ok the first one is the script and the ladder is the hook. This hook is useful for people who use grub as the boot loader and not systemd. If you use systemd boot, then you don’t need it. To elaborate, if you install dracut-ng (dracut) by it self, it will assume that your using the systemd boot loader. This is a problem as systemd stores boot images in an explicit different location than the one grub might default to. With this hook, it will correct the behavior of dracut initramfs to work with grub. If for whatever reason you don’t want mkinitcpio, this hook will fill in for the kernel generation of grub images. Do note that dracut requires more manual scripting if you want certain behaviors such as setting the compression method to use zstd. Otherwise it defaults to gzip.

So there you have it. The hooks I use and find useful.
Edit: Apologies for the weird alignment, I had made edits half way into this post to reorganize the numbering.

3 Likes