Documentation for Order of HOOKS array in mkinitcpio.conf?
All, The wiki doesn't have ordering information for the HOOKS scripts, but the comments in mkinitcpio.conf says Ordering in important and cautions against changing from the default order. But, that doesn't account for additional script added that are not in the default HOOKS example. I updated HOOKS from a much earlier version of mkinitcpio.conf to match the new .pacnew file. There keyboard moved from after filesystems to just after blocks. Is there a reference that explains where each script should be placed aside for the note or two in the Common hooks section of the wiki? -- David C. Rankin, J.D.,P.E.
On Wednesday, 30 November 2022 09:20:39 EET David C. Rankin wrote:
All,
The wiki doesn't have ordering information for the HOOKS scripts, but the comments in mkinitcpio.conf says Ordering in important and cautions against changing from the default order. But, that doesn't account for additional script added that are not in the default HOOKS example.
I updated HOOKS from a much earlier version of mkinitcpio.conf to match the new .pacnew file. There keyboard moved from after filesystems to just after blocks. Is there a reference that explains where each script should be placed aside for the note or two in the Common hooks section of the wiki?
The HOOKS section of the mkinitcpio wiki page somewhat explains how the order works. For build hooks, unless they add conflicting files, the order shouldn't matter. The exception would be the systemd and autodetect hooks which do more than just add files. For runtime hooks in busybox based initramfs, the wiki lists the order of the functions used in hooks: run_earlyhook, run_hook, run_latehook and lastly run_cleanuphook. To find out which hook uses which function requires reading its contents. So if you have one hook with run_earlyhook and one with run_hook, their order in the HOOKS array in mkinitcpio.conf does not matter. But if you have two using run_hook, then it might. For example, both the encrypt and keymap hooks use run_hook. Generally, most people will want the keymap to be set before password input. The keyboard and filesystems hooks you mentioned are only build hooks that do not add conflicting files, so the order between them does not matter. nl6720
On 11/30/22 03:57, nl6720 wrote:
The HOOKS section of the mkinitcpio wiki page somewhat explains how the order works.
For build hooks, unless they add conflicting files, the order shouldn't matter. The exception would be the systemd and autodetect hooks which do more than just add files.
For runtime hooks in busybox based initramfs, the wiki lists the order of the functions used in hooks: run_earlyhook, run_hook, run_latehook and lastly run_cleanuphook. To find out which hook uses which function requires reading its contents. So if you have one hook with run_earlyhook and one with run_hook, their order in the HOOKS array in mkinitcpio.conf does not matter. But if you have two using run_hook, then it might. For example, both the encrypt and keymap hooks use run_hook. Generally, most people will want the keymap to be set before password input.
The keyboard and filesystems hooks you mentioned are only build hooks that do not add conflicting files, so the order between them does not matter.
Thank you, That clears it all up (and would make a nice addition to the wiki). I had read through the wiki, but obviously wasn't versed enough on the subject to glean this ordering info from it. (I suspect a lot of Arch users fall into the same boat). For those that are familiar or contribute to mkinitcpio -- it probably seems obvious -- but that's the way it always goes. I can assure you, even as an Arch user of 14+ years, the inner-workings of the of mkinitcpio were still a bit of a mystery. (now the old DEAMONS() array in rc.conf -- that I understood :) Thanks again, this was really helpful. -- David C. Rankin, J.D.,P.E.
participants (2)
-
David C. Rankin
-
nl6720