#3110 PR merged
: Fixed 800_enforce_usb_output.sh¶
Labels: bug
, fixed / solved / done
jsmeix opened issue at 2023-12-18 11:27:¶
-
Type: Bug Fix
-
Impact: Normal
-
Reference to related issue (URL):
https://github.com/rear/rear/pull/3103
and
https://github.com/rear/rear/issues/1571#issuecomment-343461088
and
https://github.com/rear/rear/issues/1571#issuecomment-343516020
- How was this pull request tested?
see https://github.com/rear/rear/pull/3110#issuecomment-1860611433
- Description of the changes in this pull request:
Overhauled build/USB/default/800_enforce_usb_output.sh
Now BugError when OUTPUT=USB got somehow modified
in $ROOTFS_DIR/etc/rear/local.conf
plus explanatory comments.
Triggered by
https://github.com/rear/rear/pull/3103
and replacing it by this new pull request.
jsmeix commented at 2023-12-18 11:33:¶
By the way:
Even this "fixed 800_enforce_usb_output.sh"
is still utterly broken as it was before
because it still just ignores site.conf
but I won't spend any more time to try to
make sense of such useless USB mess code.
jsmeix commented at 2023-12-18 13:20:¶
@schlomo
how can you trigger the script with BACKUP=USB?
schlomo commented at 2023-12-18 13:35:¶
I've seen your comment about that, so it's good as is. Thanks for trying!
jsmeix commented at 2023-12-18 14:13:¶
Now I get with an artificial test to make it fail:
# usr/sbin/rear mkrescue
OUTPUT=USB is used but that is missing in /var/tmp/rear.kNb6tdU4SvtQgQe/rootfs/etc/rear/local.conf
See https://github.com/rear/rear/pull/3110 and follow the links therein
ERROR:
====================
BUG in /root/rear.github.master/usr/share/rear/build/USB/default/800_enforce_usb_output.sh line 5:
'rear mkrescue uses OUTPUT=USB which will not be used for rear recover'
--------------------
Please report it at https://github.com/rear/rear/issues
and include all related parts from /root/rear.github.master/var/log/rear/rear-linux-h9wr.log
preferably the whole debug information via 'rear -D mkrescue'
====================
Some latest log messages since the last called script 800_enforce_usb_output.sh:
2023-12-18 15:01:50.845774537 OUTPUT=USB is used but that is missing in /var/tmp/rear.kNb6tdU4SvtQgQe/rootfs/etc/rear/local.conf
2023-12-18 15:01:50.850470372 See https://github.com/rear/rear/pull/3110 and follow the links therein
Use debug mode '-d' for some debug messages or debugscript mode '-D' for full debug messages with 'set -x' output
Aborting due to an error, check /root/rear.github.master/var/log/rear/rear-linux-h9wr.log for details
Terminated
schlomo commented at 2023-12-18 14:16:¶
Nice! Thank you.
Message ID: ***@***.***>
jsmeix commented at 2023-12-19 08:59:¶
When we run the script build/USB/default/800_enforce_usb_output.sh
it means there is OUTPUT=USB in etc/rear/local.conf
(ortherwise this script is not picked up by the SourceStage function)
cf.
https://github.com/rear/rear/pull/3103#issuecomment-1860001618
and
https://github.com/rear/rear/pull/3103#issuecomment-1860169199
but in $ROOTFS_DIR/etc/rear/local.conf there is not OUTPUT=USB
so somehow OUTPUT got modified in $ROOTFS_DIR/etc/rear/local.conf
after etc/rear/local.conf was copied via
build/GNU/Linux/100_copy_as_is.sh
i.e. between build/GNU/Linux/100_copy_as_is.sh
and build/USB/default/800_enforce_usb_output.sh
but I could not find something in those build stage scripts
which modifies $ROOTFS_DIR/etc/rear/local.conf
With OUTPUT=USB I get
# usr/sbin/rear -s mkrescue
...
build/GNU/Linux/100_copy_as_is.sh
build/GNU/Linux/110_touch_empty_files.sh
build/GNU/Linux/130_create_dotfiles.sh
build/GNU/Linux/150_adjust_permissions.sh
build/GNU/Linux/390_copy_binaries_libraries.sh
build/GNU/Linux/400_copy_modules.sh
build/GNU/Linux/420_copy_firmware_files.sh
build/GNU/Linux/450_symlink_mingetty.sh
build/default/490_fix_broken_links.sh
build/default/500_ssh_setup.sh
build/default/501_check_ssh_keys.sh
build/default/502_include_mdadm_conf.sh
build/default/503_store_tty_root_password.sh
build/GNU/Linux/600_verify_and_adjust_udev.sh
build/SUSE_LINUX/610_link_systemd_lib.sh
build/GNU/Linux/610_verify_and_adjust_udev_systemd.sh
build/GNU/Linux/620_verify_os_release_file.sh
build/GNU/Linux/630_simplify_systemd_reboot_halt_poweroff_shutdown.sh
build/GNU/Linux/630_verify_resolv_conf_file.sh
build/GNU/Linux/640_verify_lvm_conf.sh
build/USB/default/800_enforce_usb_output.sh
...
When I grep for 'local.conf' in those scripts
I get only comments that mention 'local.conf'
in build/GNU/Linux/400_copy_modules.sh
and in build/GNU/Linux/400_copy_modules.sh
When I grep for 'ROOTFS_DIR' in those scripts
I found nothing that modifies $ROOTFS_DIR/etc/rear/local.conf
So if something modifies $ROOTFS_DIR/etc/rear/local.conf
between build/GNU/Linux/100_copy_as_is.sh
and build/USB/default/800_enforce_usb_output.sh
this "something" is rather well hidden, perhaps
via some function where its name does not match
'local.conf' or 'ROOTFS_DIR'?
jsmeix commented at 2023-12-19 09:28:¶
With latest changes
I get with this artificial test
# git diff -U1 usr/share/rear/build/USB/default/800_enforce_usb_output.sh
...
@@ -15,3 +15,4 @@
local_conf_output=$( source $ROOTFS_DIR/etc/rear/local.conf ; echo $OUTPUT )
-test "USB" = "$local_conf_output" && return
+#test "USB" = "$local_conf_output" && return
+test "USB" = "$local_conf_output" && LogPrintError "OUTPUT=USB in $ROOTFS_DIR/etc/rear/local.conf"
to make it fail:
# usr/sbin/rear mkrescue
OUTPUT=USB in /var/tmp/rear.EsoAERyiJzyA2mi/rootfs/etc/rear/local.conf
OUTPUT=USB is used but that is missing in /var/tmp/rear.EsoAERyiJzyA2mi/rootfs/etc/rear/local.conf
See https://github.com/rear/rear/pull/3110 and follow the links therein
ERROR:
====================
BUG in /root/rear.github.master/usr/share/rear/build/USB/default/800_enforce_usb_output.sh line 34:
''rear mkrescue' uses OUTPUT=USB which will not be used for 'rear recover''
--------------------
Please report it at https://github.com/rear/rear/issues
and include all related parts from /root/rear.github.master/var/log/rear/rear-linux-h9wr.log
preferably the whole debug information via 'rear -D mkrescue'
====================
Some latest log messages since the last called script 800_enforce_usb_output.sh:
2023-12-19 10:24:21.625802140 OUTPUT=USB in /var/tmp/rear.EsoAERyiJzyA2mi/rootfs/etc/rear/local.conf
2023-12-19 10:24:21.630362490 OUTPUT=USB is used but that is missing in /var/tmp/rear.EsoAERyiJzyA2mi/rootfs/etc/rear/local.conf
2023-12-19 10:24:21.636491715 See https://github.com/rear/rear/pull/3110 and follow the links therein
Use debug mode '-d' for some debug messages or debugscript mode '-D' for full debug messages with 'set -x' output
Aborting due to an error, check /root/rear.github.master/var/log/rear/rear-linux-h9wr.log for details
Terminated
jsmeix commented at 2023-12-19 09:29:¶
@rear/contributors
provided you do not object
I will merge it tomorrow afternoon.
[Export of Github issue for rear/rear.]