Useful issues resolved in the past
Basic usage steps:
1) study and practice system recovery
2) install the package
pacman -S mkinitcpio-systemd-tool
3) activate required hooks in /etc/mkinitcpio.conf
:
HOOKS=(base ... systemd systemd-tool)
4) configure, override and enable/disable provided units, for example:
for remote unlocking of luks root with cryptsetup
and tinysshd
use:
edit /etc/mkinitcpio-systemd-tool/config/crypttab
edit /etc/mkinitcpio-systemd-tool/config/fstab
systemctl enable initrd-cryptsetup.path
systemctl enable initrd-tinysshd.service
systemctl enable initrd-debug-progs.service
systemctl enable initrd-sysroot-mount.service
5) build image, review content and finally reboot:
mkinitcpio -v -p linux > /tmp/initrd.log
lsinitcpio -l /boot/initramfs-linux.img | grep initrd
systemctl reboot
pacman
install actions:
/etc/mkinitcpio-systemd-tool
(with backup)/usr/lib/systemd/system
(with silent overwrite)mkinitcpio
install hook actions:
/etc/systemd/system
/etc/initrd-release
what is the mkinitcpio hook entry provided by this package?
systemd-tool
base systemd systemd-tool
base autodetect modconf block filesystems keyboard fsck systemd systemd-tool
how can I customize installed service units?
systemctl edit $unit_name
systemctl enable $unit_name
/ systemctl disable $unit_name
how can I review generated /boot/initramfs-linux.img
?
initramfs.img
after mkinitcpio
but before reboot
, use:how systemd unit transitive dependency provisioning works?
mkinitcpio-install.sh/add_systemd_unit_X()
[Unit]/Requires|OnFailure
are recursively installedwhat is the purpose of [X-SystemdTool]
section in service unit files?
mkinitcpio
provisioning actionsInitrdPath
InitrdLink
InitrdBinary
InitrdBuild
InitrdCall
InitrdUnit
how can I auto-provision my custom service unit binaries into initramfs?
InitrdBinary=/path/target-exec
to provision service binaryExec*
entries such as ExecStart=/usr/bin/program
how can I auto-provision my custom service unit resources into initramfs?
InitrdPath=/path/to/host/folder-or-file
how can I relocate folder during provisioning?
how can I relocate file and/or change file mode during provisioning?
InitrdPath=/target-file source=/source-file mode=NNN
how can I filter directory content during provisioning?
InitrdPath=/target-folder glob=*.example
how can I provision optional folder or file?
InitrdPath=/target-file source=/source-file optional=yes
is there a way to create empty folder or file?
InitrdPath=/path/target-dir/ create=yes
note trailing SLASHInitrdPath=/path/target-file create=yes
note NO trailing slashhow can I provision a symbolic link?
InitrdLink=/path-to-link/link-name target=/path-to-target/target-name
/path-to-target/target-name
must be provisioned separatelycan I invoke a provisioning script related to my service during mkinitcpio build time?
InitrdBuild=/path-to/script.sh command=function_name
can I call a little provisioning script snippet during mkinitcpio build time?
mkinitcpio
functions in /usr/lib/initcpio/functions.sh
InitrdCall=inline-bash-code-here
to call these functionshow can I provide custom interactive user shell for ssh client
/usr/lib/mkinitcpio-systemd-tool/initrd-shell.sh
which ssh user keys are used by initramfs sshd server(s)?
/etc/mkinitcpio-systemd-tool/config/authorized_keys
there is a initrd-shell.sh
script provided, what does it do?
how can I review initrd-shell.sh
actions during last boot?
journalctl -b -t shell
what does CTRL-C
do to initrd-shell.sh
in different modes?
initrd-shell.sh
provides appropriate reaction to interrupt, depending on the contextssh
terminal password agent prompt, it will start a menu form initrd-shell.sh
/dev/tty
local debug console, it will exit from initrd-shell.sh
/dev/console
password agent prompt, it will restart the initrd-shell.sh
serviceis there a silent or no-echo mode during password entry in initrd-shell.sh
?
systemd-ask-password.c
):BACKSPACE
as first key or by pressing TAB
at any time(no echo)