Build failed during partprobing of /dev/loop device.
Description
What happened?
```
--> (132) COMMAND: partprobe /dev/loop15 Error: Partition(s) 1, 2 on /dev/loop15 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes. -->--> command failed with error code 1 after 1 seconds --> (133) WARNING: stacktrace for failed command [ exit code 1:/usr/bin/env bash -e -o pipefail -c partprobe /dev/loop15 run_host_command_logged() --> lib/functions/logging/runners.sh:193 prepare_partitions() --> lib/functions/image/partitioning.sh:230 do_with_logging() --> lib/functions/logging/section-logging.sh:81 build_rootfs_and_image() --> lib/functions/main/rootfs-image.sh:86 full_build_packages_rootfs_and_image() --> lib/functions/main/default-build.sh:36 do_with_default_build() --> lib/functions/main/default-build.sh:42 cli_standard_build_run() --> lib/functions/cli/cli-build.sh:25 armbian_cli_run_command() --> lib/functions/cli/utils-cli.sh:136 cli_entrypoint() --> lib/functions/cli/entrypoint.sh:176 main() --> compile.sh:50 ]
```
How to reproduce?
Run ./compile.sh and it will fail with error above.
I am suggesting to use P (-partscan) parameter to losetup command. This string is from lib/functions/image/partitioning.sh `run_host_command_logged losetup "${LOOP}" "${SDCARD}".raw # @TODO: had a 'P here, what was it?`
-P, --partscan Force the kernel to scan the partition table on a newly created loop device. Note that the partition table parsing depends on sector sizes. The default is sector size is 512 bytes, otherwise you need to use the option --sector-size together with --partscan.
Commands history as proof: ``` root@292a3a58b216:/armbian# losetup /dev/loop16 /armbian/.tmp/rootfs-852b9b33-c651-4808-95bc-390ae09c4029.raw root@292a3a58b216:/armbian# lsblk|grep loop16 loop16 7:16 0 1.7G 0 loop root@292a3a58b216:/armbian# partprobe /dev/loop16 Error: Partition(s) 1, 2 on /dev/loop16 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes. root@292a3a58b216:/armbian# losetup -d /dev/loop16 root@292a3a58b216:/armbian# losetup --partscan /dev/loop16 /armbian/.tmp/rootfs-852b9b33-c651-4808-95bc-390ae09c4029.raw root@292a3a58b216:/armbian# lsblk|grep loop16 loop16 7:16 0 1.7G 0 loop
-loop16p1 259:3 0 256M 0 part `-loop16p2 259:4 0 1.5G 0 part root@292a3a58b216:/armbian# partprobe /dev/loop16
```
Branch
main (main development branch)
On which host OS are you observing this problem?
Jammy
Relevant log URL
No response
Code of Conduct
[X] I agree to follow this project's Code of Conduct
What happened?
```
--> (132) COMMAND: partprobe /dev/loop15
Error: Partition(s) 1, 2 on /dev/loop15 have been written, but we have been unable to inform the kernel of the change, probably because it/they
are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.
-->--> command failed with error code 1 after 1 seconds
--> (133) WARNING: stacktrace for failed command [ exit code 1:/usr/bin/env bash -e -o pipefail -c partprobe /dev/loop15
run_host_command_logged() --> lib/functions/logging/runners.sh:193
prepare_partitions() --> lib/functions/image/partitioning.sh:230
do_with_logging() --> lib/functions/logging/section-logging.sh:81
build_rootfs_and_image() --> lib/functions/main/rootfs-image.sh:86
full_build_packages_rootfs_and_image() --> lib/functions/main/default-build.sh:36
do_with_default_build() --> lib/functions/main/default-build.sh:42
cli_standard_build_run() --> lib/functions/cli/cli-build.sh:25
armbian_cli_run_command() --> lib/functions/cli/utils-cli.sh:136
cli_entrypoint() --> lib/functions/cli/entrypoint.sh:176
main() --> compile.sh:50 ]
```
How to reproduce?
Run ./compile.sh and it will fail with error above.
I am suggesting to use P (-partscan) parameter to losetup command.
This string is from lib/functions/image/partitioning.sh
`run_host_command_logged losetup "${LOOP}" "${SDCARD}".raw # @TODO: had a 'P here, what was it?`
-P, --partscan
Force the kernel to scan the partition table on a newly created loop device. Note that the partition table parsing depends on
sector sizes. The default is sector size is 512 bytes, otherwise you need to use the option --sector-size together with --partscan.
Commands history as proof:
```
root@292a3a58b216:/armbian# losetup /dev/loop16 /armbian/.tmp/rootfs-852b9b33-c651-4808-95bc-390ae09c4029.raw
root@292a3a58b216:/armbian# lsblk|grep loop16
loop16 7:16 0 1.7G 0 loop
root@292a3a58b216:/armbian# partprobe /dev/loop16
Error: Partition(s) 1, 2 on /dev/loop16 have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use. As a result, the old partition(s) will remain in use. You should reboot now before making further changes.
root@292a3a58b216:/armbian# losetup -d /dev/loop16
root@292a3a58b216:/armbian# losetup --partscan /dev/loop16 /armbian/.tmp/rootfs-852b9b33-c651-4808-95bc-390ae09c4029.raw
root@292a3a58b216:/armbian# lsblk|grep loop16
loop16 7:16 0 1.7G 0 loop
-loop16p1 259:3 0 256M 0 part
`-loop16p2 259:4 0 1.5G 0 part
root@292a3a58b216:/armbian# partprobe /dev/loop16
```
Branch
main (main development branch)
On which host OS are you observing this problem?
Jammy
Relevant log URL
No response
Code of Conduct
[X] I agree to follow this project's Code of Conduct
Raised by: https://github.com/Lebensgefahr
https://github.com/armbian/build/issues/6333