Skip to content

Comments

Support booting from a multipath-backed device#893

Open
gibmat wants to merge 11 commits intolxc:mainfrom
gibmat:multipath
Open

Support booting from a multipath-backed device#893
gibmat wants to merge 11 commits intolxc:mainfrom
gibmat:multipath

Conversation

@gibmat
Copy link
Member

@gibmat gibmat commented Feb 12, 2026

Closes #807

@gibmat gibmat force-pushed the multipath branch 6 times, most recently from 93f3743 to 480be21 Compare February 20, 2026 16:43
Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
Manually measuring PCRs depends on /run/systemd/tpm2-pcr-public-key.pem being
available, but we can't just depend on systemd-tmpfiles-setup.service since
that creates a dependency loop with the new initrd-multipath-partition service.
So, add our own call to systemd-tmpfiles to ensure /run/ is populated.

Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
@gibmat gibmat force-pushed the multipath branch 2 times, most recently from c107559 to 7fdc4bc Compare February 24, 2026 01:42
@@ -0,0 +1,14 @@
[Unit]
Description=Configure basic multipath
After=modprobe@dm_multipath.service modprobe@dm_service_time.service systemd-udev-settle.service
Copy link
Member Author

Choose a reason for hiding this comment

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

Relying on systemd-udev-settle.service isn't great, since it causes a single choke point on the critical path during boot. But lsblk relies on udev to get WWNs, so we can't really avoid it.

multipath -i

# Need to sleep a few seconds to allow multipath devices to become available.
sleep 5
Copy link
Member Author

Choose a reason for hiding this comment

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

This sleep delay will only affect systems where a multipath configuration is detected. In my testing I needed at least a 1-2 second delay between the multipath -i command finishing and actual mapped devices to properly show up. I hope 5 seconds will be sufficient time for real hardware; if not we may need to extend this or switch to some sort of a polling approach.

@@ -0,0 +1,16 @@
[Unit]
Copy link
Member Author

Choose a reason for hiding this comment

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

I split the early boot message into its own service that doesn't depend on anything so we can get something on the screen as quickly as possible during boot.

Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
This is needed when booting from a multipath-backed device, since the systemd
gpt-auto generator won't auto-create these files for us.

Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
…multipath device

Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
…th-backed devices

Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
@gibmat gibmat marked this pull request as ready for review February 24, 2026 02:14
@gibmat
Copy link
Member Author

gibmat commented Feb 24, 2026

OK @stgraber I think this is finally ready for a review! :)

@stgraber
Copy link
Member

@gibmat I may be missing something, but from my reading of the scripts it seems to assume that any multipath disk found from the initrd will be the root disk.

What happens in an environment where on top of the root disk being available over multipath you have another few other disks that are also exposed over FC with multipath?

TOTAL_UNIQUE_WWNS=$(lsblk -o WWN -dn | grep -v "^$" | sort | uniq | wc -l)

if [ "$TOTAL_WWNS" -ne "$TOTAL_UNIQUE_WWNS" ]; then
multipath -i
Copy link
Member

Choose a reason for hiding this comment

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

This will activate all multipath disks, not just the root disk.

#!/bin/sh

# Manually setup any detected multipath devices.
for MP in $(dmsetup ls --target multipath | cut -f1); do
Copy link
Member

Choose a reason for hiding this comment

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

This iterates over all multipath devices and will blindly run systemd-repart on any disk that has exactly 8 partitions.

swapon /dev/mapper/swap

# Unlock root partition, which will be automatically detected and then mounted.
systemd-cryptsetup attach root "/dev/mapper/${MP}-part10"
Copy link
Member

Choose a reason for hiding this comment

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

Given we're iterating over multipath devices. If we managed to locate and unlock the swap and root partition, we should probably break, no?

Also do these calls properly answer the recovery key input?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add support for booting from a multipath-ed root disk

2 participants