expand-on-first-boot: follow symbolic before search slave device

Message ID 20240524141223.2364631-1-Quirin.Gylstorff@siemens.com
State Accepted, archived
Headers show
Series expand-on-first-boot: follow symbolic before search slave device | expand

Commit Message

Quirin Gylstorff May 24, 2024, 2:11 p.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

The entry in /dev/mapper/... is symbolic link to /dev/dm-<X>.

This solves they following error:
```
Boot device equals root device - no partitioning found
```
in case of the following disk layout
root@demo:~# lsblk
NAME                   MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
sda                      8:0    0   2.5G  0 disk
├─sda1                   8:1    0  47.4M  0 part  /boot
└─sda2                   8:2    0 447.9M  0 part
  └─encrypted_platform 252:0    0 431.9M  0 crypt /

Reported-by: Wang, John <johnxw@amazon.com>
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 .../expand-on-first-boot/files/expand-last-partition.sh         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Uladzimir Bely June 3, 2024, 6:36 a.m. UTC | #1
On Fri, 2024-05-24 at 16:11 +0200, 'Quirin Gylstorff' via isar-users
wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> The entry in /dev/mapper/... is symbolic link to /dev/dm-<X>.
> 
> This solves they following error:
> ```
> Boot device equals root device - no partitioning found
> ```
> in case of the following disk layout
> root@demo:~# lsblk
> NAME                   MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
> sda                      8:0    0   2.5G  0 disk
> ├─sda1                   8:1    0  47.4M  0 part  /boot
> └─sda2                   8:2    0 447.9M  0 part
>   └─encrypted_platform 252:0    0 431.9M  0 crypt /
> 
> Reported-by: Wang, John <johnxw@amazon.com>
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  .../expand-on-first-boot/files/expand-last-partition.sh         | 2
> +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/recipes-support/expand-on-first-boot/files/expand-
> last-partition.sh b/meta/recipes-support/expand-on-first-
> boot/files/expand-last-partition.sh
> index 0cb2ee21..8770677c 100755
> --- a/meta/recipes-support/expand-on-first-boot/files/expand-last-
> partition.sh
> +++ b/meta/recipes-support/expand-on-first-boot/files/expand-last-
> partition.sh
> @@ -9,7 +9,7 @@
>  
>  set -e
>  
> -ROOT_DEV="$(findmnt / -o source -n)"
> +ROOT_DEV="$(readlink -f "$(findmnt / -o source -n)")"
>  ROOT_DEV_NAME=${ROOT_DEV##*/}
>  ROOT_DEV_SLAVE=$(find /sys/block/"${ROOT_DEV_NAME}"/slaves -mindepth
> 1 -print -quit 2>/dev/null || true)
>  while [ -d "${ROOT_DEV_SLAVE}/slaves" ]; do
> -- 
> 2.43.0
> 

Applied to next, thanks.

Patch

diff --git a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
index 0cb2ee21..8770677c 100755
--- a/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
+++ b/meta/recipes-support/expand-on-first-boot/files/expand-last-partition.sh
@@ -9,7 +9,7 @@ 
 
 set -e
 
-ROOT_DEV="$(findmnt / -o source -n)"
+ROOT_DEV="$(readlink -f "$(findmnt / -o source -n)")"
 ROOT_DEV_NAME=${ROOT_DEV##*/}
 ROOT_DEV_SLAVE=$(find /sys/block/"${ROOT_DEV_NAME}"/slaves -mindepth 1 -print -quit 2>/dev/null || true)
 while [ -d "${ROOT_DEV_SLAVE}/slaves" ]; do