You are not logged in.

#1 2021-03-23 05:44:36

mizuhaaaaaa
Member
Registered: 2021-03-23
Posts: 2

mkinitcpio does not account for unusual '$root'

I have bcachefs installed, encrypted multidevice.
Mkinitcpio is capable of mounting it on boot, with a special script I made to unlock the partitions and then (bcachefs) fsck them.
However, in /usr/lib/initcpio/init, rootdev=$(resolve_device "$root") && root=$rootdev does not account for a colon-separated $root variable from the kernel command line.
The system bypasses that and mounts normally when commenting it out.
This causes mkinitcpio to fruitlessly try to resolve that variable without success, eventually just mounting it since mount does support colon-separated devices, making boot times 10 seconds longer.

Boot loader kernel command line for reference:

root=/dev/disk/by-partuuid/db6d8d66-4781-450d-94d4-2626c98c2c13:/dev/disk/by-partuuid/3ef5d906-f3ae-40cd-a9f5-389739d7a0e5:/dev/disk/by-partuuid/16a6ce28-0318-4cc9-a183-5ac2373dbb40 rootfstype=bcachefs rw

Bcachefs-multi mkinitcpio hook for reference:

#!/usr/bin/ash

run_hook() {
    echo "Please enter your passphrase:"
    read -s pass

    for dev in ${root//:/ }; do
        echo "Unlocking $dev:"

        while true; do
           echo $pass | bcachefs unlock $dev && break
           read -s pass
        done
    done

    # Check filesystem integrity
    bcachefs fsck ${root//:/ }
}

# vim: set ft=sh ts=4 sw=4 et:

Last edited by mizuhaaaaaa (2021-03-23 05:49:04)

Offline

#2 2021-03-23 05:51:27

mizuhaaaaaa
Member
Registered: 2021-03-23
Posts: 2

Re: mkinitcpio does not account for unusual '$root'

Seems like it's the function resolve_device() in /usr/lib/initcpio/init_functions

Offline

Board footer

Powered by FluxBB