You are not logged in.

#1 2012-01-25 16:21:10

hybrid
Member
Registered: 2007-02-05
Posts: 262

correct order of hooks in mkinitcpio.conf?

Hi,
I never really thought about the order of hooks in mkinitcpio.conf to be honest, but reading falconindy's ml post on mkinitcpio support for /usr on a separate partition I'm wondering whether or not the order of my hooks is correct.

My current hooks in mkinitcpio.conf look like this

HOOKS="base udev fsck autodetect shutdown pata scsi sata filesystems usbinput"

Does the fsck hook have to be before the udev hook as well? And does it matter, what position the shutdown hook is?
And as mentioned in the beginning, just out of curiosity: Do the "standard hooks" need to be in a certain order ("the standard order") as well?

Offline

#2 2012-01-25 20:48:28

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: correct order of hooks in mkinitcpio.conf?

mod action: Moving from Installation to Kernel & Hardware.


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#3 2012-01-25 23:44:49

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: correct order of hooks in mkinitcpio.conf?

The order matters, yes.

HOOKS="base udev autodetect pata scsi sata filesystems"

^ That's the "sane defaults" line from /etc/mkinitcpio.conf.
Have a look at /lib/initcpio:
- the stuff in "install" is run while creating the contents of the initramfs.img, in the order specified in mkinitcpio.conf
- files in "hooks" are executed in the same order when the initramfs executes, before passing control over to /sbin/init
(that directory is a gold mine anyway if you want to learn about the Linux boot process and scripting in general)

Example: My filesystems (including /) are in logical volumes in a LUKS container, so I need to have "encrypt" before "lvm2", because otherwise the LVs would nowhere to be seen, if I didn't first unlock the LUKS device.


edit: and for your example... I would move fsck and shutdown to the end; and because fsck is before autodetect, you'd even get all fsck helpers (/sbin/fsck*) added to the image, not just the one relevant to your /etc/fstab.

Last edited by byte (2012-01-25 23:52:06)


1000

Offline

#4 2012-01-26 02:42:37

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: correct order of hooks in mkinitcpio.conf?

You can always use 'lsinitcpio -a' to see what hooks will be run.

Offline

Board footer

Powered by FluxBB