Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add mkinitcpio hook for Arch and sample /etc/mkinitcpio.conf #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DerVerruckteFuchs
Copy link

This adds the necessary initcpio hook for Arch to boot from an encrypted root bcachefs drive/partition. For the time being, the hook is kept in the custom hooks directory (/etc/initcpio/hooks) as per the Arch wiki. As things get mainlined and become part of the kernel, we may want to move the hook into the system hooks directory (/usr/lib/initcpio/hooks). There is an example of a working /etc/mkinitcpio.conf that calls the bcachefs hook when creating a new initramfs with mkinitcpio -p linux-bcachefs.

#!/bin/bash

build() {
add_module `bcachefs`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the backticks here rather than quotes causes mkinitcpio to spit out ==> ERROR: module not found: `bcachefs:'

switching them to quotation marks makes mkinitcpio run fine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or no quotes at all, as is done in existing hooks. Same for add_binary below.

run_hook() {

# check if $root needs unlocking
if bcachefs unlock -c $root >/dev/null 2>&1; then
Copy link

@mmmspatz mmmspatz May 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails if root isn't a dev path (eg. UUID=), because only bcahcefs mount knows how to handle that.

Could do what some existing hooks do (resume)

local rootdev
if rootdev="$(resolve_device "$root")" && \
bcachefs unlock -c "$rootdev" >/dev/null 2>&1; then
    echo "Unlocking $rootdev:"
    while true; do
        bcachefs unlock "$rootdev" && break
    done
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants