Hey man, so Iāve done some testing and I think this might be the problem.
Here are two builds, each having been run after a successful build. (To test with stray loop devices).
Build-A: (success)
Build-B: (fail)
- sanity_test spots stray loop devices:
+ losetup --all
+ losetup_output='/dev/loop1: [65027]:1230145 (/home/user/derivative-binary/17.4.0.0/Whonix-Gateway-CLI-17.4.0.0.Intel_AMD64.raw)
/dev/loop6: [65027]:1230145 (/home/user/derivative-binary/17.4.0.0/Whonix-Gateway-CLI-17.4.0.0.Intel_AMD64.raw)
/dev/loop4: [65027]:1230145 (/home/user/derivative-binary/17.4.0.0/Whonix-Gateway-CLI-17.4.0.0.Intel_AMD64.raw)
/dev/loop2: [65027]:1230145 (/home/user/derivative-binary/17.4.0.0/Whonix-Gateway-CLI-17.4.0.0.Intel_AMD64.raw)
/dev/loop0: [65027]:1230145 (/home/user/derivative-binary/17.4.0.0/Whonix-Gateway-CLI-17.4.0.0.Intel_AMD64.raw)
/dev/loop7: [65027]:1230145 (/home/user/derivative-binary/17.4.0.0/Whonix-Gateway-CLI-17.4.0.0.Intel_AMD64.raw)
/dev/loop5: [65027]:1230145 (/home/user/derivative-binary/17.4.0.0/Whonix-Gateway-CLI-17.4.0.0.Intel_AMD64.raw)
/dev/loop3: [65027]:1230145 (/home/user/derivative-binary/17.4.0.0/Whonix-Gateway-CLI-17.4.0.0.Intel_AMD64.raw)'
+ true 'INFO: Stray loop devices detected!
Iām guessing youāre still exiting zero in case there is a legitimate user loop device, but if losetup --all | grep -Eq "(Whonix|Kicksecure).*.raw"
then maybe exit 1 during sanity?
- Could it be unmount (
help-steps/unmount-helper
) being skipped? Which is the closest thing to a detachment that happens during the build (as far as I can see)
+ unmount_raw
+ trap exception_handler_unmount-raw ERR INT TERM
+ '[' '' = '' ']'
+ true
+ sync
losetup --all
/dev/loop1: [65027]:1230145 (/home/user/derivative-binary/17.4.0.0/Whonix-Gateway-CLI-17.4.0.0.Intel_AMD64.raw)
/dev/loop2: [65027]:1230145 (/home/user/derivative-binary/17.4.0.0/Whonix-Gateway-CLI-17.4.0.0.Intel_AMD64.raw)
/dev/loop0: [65027]:1230145 (/home/user/derivative-binary/17.4.0.0/Whonix-Gateway-CLI-17.4.0.0.Intel_AMD64.raw)
/dev/loop3: [65027]:1230145 (/home/user/derivative-binary/17.4.0.0/Whonix-Gateway-CLI-17.4.0.0.Intel_AMD64.raw)
+ '[' true = true ']'
+ true 'INFO: kpartx_only=true, skipping unmount /home/user/derivative-binary/Whonix-Gateway-CLI_image'
+ '[' '' = '' ']'
+ local img=/home/user/derivative-binary/17.4.0.0/Whonix-Gateway-CLI-17.4.0.0.Intel_AMD64.raw
+ wait 302268
+ sleep 2
+ sync
This happens when
if [ "$kpartx_only" = "true" ]; then
true "INFO: kpartx_only=$kpartx_only, skipping unmount $CHROOT_FOLDER"
else
"$dist_source_help_steps_folder/unmount-helper" "$CHROOT_FOLDER"
fi
I havenāt yet found what sets kpartx_only
, but this certainly looks interesting.
The way Iām solving the stray devices in whonix_builder is by executing the following function before each new build command. I can confirm that this works for now (also with parallel builds), but obviously not a real solution.
lo_check() { LOOP_DEV=$(sudo losetup -nl | grep -E "(Whonix|Kicksecure).*" | awk '{print $1}'); \
[ -z "${LOOP_DEV}" ] || { LOOP_PART=$(echo "${LOOP_DEV}" | sed -e 's,.*/,,'); \
LOOP_DM=$(sudo dmsetup info -c -o name --noheadings | grep "${LOOP_PART}") || true; \
sudo losetup -d ${LOOP_DEV}; [ -z "${LOOP_DM}" ] || sudo dmsetup remove -f ${LOOP_DM}; }; }
Lastly, a small thing I noticed with your commit in 5200_prepare-release
Before:
dm-prepare-release "$@"
After:
"$dist_source_help_steps_folder/dm-prepare-release" "$@"
This causes a file not found error:
/./build-steps.d/5200_prepare-release: line 22: /home/user/17.4.0.1-developers-only/help-steps/dm-prepare-release: No such file or directory
dist_source_help_steps_folder
if otherwise unset becomes ${source_code_folder_dist}/help-steps"
which is $(dirname -- "$MYDIR")
, which is basically the clone folder.
There is no derivative-maker/help-steps/dm-prepare-release
. (is there supposed to be?)
/usr/bin/dm-prepare-release
is the correct location, which is why dm-prepare-release "$@"
worked because itās in the path.
Iām probably missing something here, so already preparing to be corrected. 