Skip to content

Conversation

@fnordic
Copy link

@fnordic fnordic commented Aug 11, 2025

Ensure var kiwi_RaidDev var is loaded before looking up disk.

Fixes # Resize operation with mirroring activated and oem-systemsize set.
The resize operation currently does not work for mirroring/raid root disks:

/run/initiramfs/log/kiwi.boot :

...
++ warn 'Requested OEM systemsize exceeds free space on the disk:'
...

Because $kiwi_RaidDev is unset for the lookup_disk_device_from_root function:

/run/initiramfs/log/kiwi.boot excerpt during failed resize:

...
++++ basename ../../md0
+++ root_device=/dev/md0
++++ lsblk -p -n -r -s -o NAME,TYPE /dev/md0
++++ grep -E 'disk|raid'
++++ cut -f1 -d ' '
+++ for disk_device in $(lsblk -p -n -r -s -o NAME,TYPE "${root_device}" | grep -E "disk|raid" | cut -f1 -d ' ')
+++ '[' false = true ']'
+++ type mdadm
+++ '[' -z '' ']'
+++ mdadm --detail -Y /dev/md0
+++ echo /dev/md0
+++ return
++ disk=/dev/md0
++ export disk
...

$RaidDev is empty in ['-z' ''] <--missing kiwi_RaidDev var

/run/initiramfs/log/kiwi.boot excerpt previously working, the disk was evaltued to vda:

...
+++ root_device=/dev/md0
++++ lsblk -p -n -r -s -o NAME,TYPE /dev/md0
++++ grep -E 'disk|raid'
++++ cut -f1 -d ' '
+++ for disk_device in $(lsblk -p -n -r -s -o NAME,TYPE "${root_device}" | grep -E "disk|raid" | cut -f1 -d ' ')
+++ '[' false = true ']'
+++ type mdadm
+++ '[' -z /dev/md0 ']'
+++ for disk_device in $(lsblk -p -n -r -s -o NAME,TYPE "${root_device}" | grep -E "disk|raid" | cut -f1 -d ' ')
+++ '[' false = true ']'
+++ type mdadm
+++ '[' -z /dev/md0 ']'
+++ echo /dev/vda
++ disk=/dev/vda
++ export disk
...

Changes proposed in this pull request:

Lookup root disk device after loading partition id setup (with var kiwi_RaidDev).

This works for me, but I'm not sure if you even want to run lookup_disk_device_from_root without kiwi_RaidDev variable set in case partition_ids=/config.partids does not exit.

Maybe lookup_disk_device_from_root should not use vars from .config.partids.

Copy link
Collaborator

@schaefi schaefi left a comment

Choose a reason for hiding this comment

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

good catch, thanks much 👍

@schaefi
Copy link
Collaborator

schaefi commented Aug 11, 2025

Maybe lookup_disk_device_from_root should not use vars from .config.partids.

There is room for a better refactor of that code part I agree

@schaefi schaefi merged commit f1a0829 into OSInside:main Aug 11, 2025
14 checks passed
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.

2 participants