random-archer / mkinitcpio-systemd-tool

Provisioning tool for systemd in initramfs (systemd-tool)
https://www.archlinux.org/packages/community/any/mkinitcpio-systemd-tool/
Other
112 stars 27 forks source link
archlinux btrfs cryptsetup dropbear initramfs initrd initrd-units lvm mkinitcpio mkinitcpio-hook mkinitcpio-systemd nftables password-agent plymouth provision ssh systemd systemd-service tinysshd zfs
This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool

mkinitcpio-systemd-tool

Summary

Never write another mkinitcpio hook again: use systemd-tool.
Provisioning tool for systemd in initramfs (systemd-tool): #### mkinitcpio hook name: `systemd-tool` Core features provided by the hook: * unified systemd + mkinitcpio configuration * automatic provisioning of binary and config resources * on-demand invocation of mkinitcpio scripts and in-line functions Features provided by the included service units: * initrd debugging * early network setup * interactive user shell * remote ssh access in initrd * cryptsetup + plymouth support * cryptsetup + custom password agent

Issues

Useful issues resolved in the past

Example

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

Install Details

pacman install actions:

mkinitcpio install hook actions:

Provisioning Questions and Answers

what is the mkinitcpio hook entry provided by this package?

how can I customize installed service units?

how can I review generated /boot/initramfs-linux.img?

how systemd unit transitive dependency provisioning works?

what is the purpose of [X-SystemdTool] section in service unit files?

how can I auto-provision my custom service unit binaries into initramfs?

how can I auto-provision my custom service unit resources into initramfs?

how can I relocate folder during provisioning?

how can I relocate file and/or change file mode during provisioning?

how can I filter directory content during provisioning?

how can I provision optional folder or file?

is there a way to create empty folder or file?

how can I provision a symbolic link?

can I invoke a provisioning script related to my service during mkinitcpio build time?

can I call a little provisioning script snippet during mkinitcpio build time?

how can I provide custom interactive user shell for ssh client

which ssh user keys are used by initramfs sshd server(s)?

Shell Script Questions and Answers

there is a initrd-shell.sh script provided, what does it do?

how can I review initrd-shell.sh actions during last boot?

what does CTRL-C do to initrd-shell.sh in different modes?

is there a silent or no-echo mode during password entry in initrd-shell.sh?