Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete usr/share/rear/build/USB/default/800_enforce_usb_output.sh #3103

Closed
wants to merge 1 commit into from

Conversation

jsmeix
Copy link
Member

@jsmeix jsmeix commented Dec 11, 2023

Remove
build/USB/default/800_enforce_usb_output.sh
see
#1571 (comment)
and
#1571 (comment)

Furthermore this script reads

# Added by udev workflow

but it does its stuff in any case for USB
regardless of the workflow
so this script looks utterly broken.

According to

git log --follow -p usr/share/rear/build/USB/default/800_enforce_usb_output.sh

this script originated (as 80_enforce_usb_output.sh) in
4ec9ed4
which only tells

Make sure OUTPUT=USB is enforced in udev workflow during recover

but it neither explains WHY that is needed
nor does it implement what it tells
because the script is run in any case for OUTPUT=USB
regardless whether or not the udev workflow is used.

So as far as I understand it:
This script is run in any case for OUTPUT=USB
and then (i.e. when there is OUTPUT=USB in local.conf)
it "enforces" OUTPUT=USB in ROOTFS_DIR/.../local.conf
but how could OUTPUT in ROOTFS_DIR/.../local.conf
differ from OUTPUT in local.conf?

Remove
build/USB/default/800_enforce_usb_output.sh
see
#1571 (comment)
and
#1571 (comment)
Furthermore this script reads
"# Added by udev workflow"
but it does its stuff in any case for USB
regardless of the workflow
so this script looks utterly broken.
@jsmeix jsmeix added this to the ReaR v2.8 milestone Dec 11, 2023
@jsmeix jsmeix requested a review from a team December 11, 2023 08:29
@jsmeix jsmeix self-assigned this Dec 11, 2023
@pcahyna
Copy link
Member

pcahyna commented Dec 12, 2023

@jsmeix this is to be used by the udev workflow, triggered from etc/udev/rules.d/62-rear-usb.rules . Shouldn't the whole udev workflow be removed, if we can't test it?

@pcahyna
Copy link
Member

pcahyna commented Dec 12, 2023

the udev rules in rpm spec have been disabled in 24d57b8

@jsmeix
Copy link
Member Author

jsmeix commented Dec 12, 2023

FYI
regarding the udev workflow have a look at
(what I "just found" right now by searching
some of my older archived mails)
for example things like

#840
"udev workflow cannot work as it is currently implemented"

#838
"USB gets suspended"

#2180
"during boot 'rear udev' is called, causing delay during boot"

From my personal point of view
the udev workflow and all what belongs to it
should be removed the sooner the better, cf.
#2180 (comment)

@pcahyna
Copy link
Member

pcahyna commented Dec 12, 2023

RHEL has never been using the udev workflow (the udev rules have not been shipped in our RPM).

@jsmeix
Copy link
Member Author

jsmeix commented Dec 13, 2023

Also SUSE has never supported the udev workflow.

In particular there is no '62-rear-usb.rules' file shipped

  • neither in a SUSE "rear..." RPM package for SLE-HA, cf.
    "... rear116 / rear1172a / rear118a / rear23a / rear27a"
    in https://en.opensuse.org/SDB:Disaster_Recovery
  • nor in an "official" openSUSE "rear" RPM package
    (i.e. what osc search rear | grep '^openSUSE:' lists)

@jsmeix jsmeix requested a review from a team December 14, 2023 07:41
@jsmeix
Copy link
Member Author

jsmeix commented Dec 14, 2023

@rear/contributors in particular @schlomo @gdha
please also have a look here (as time permits).

If you do not object I would like to merge it
next Monday (18 Dec. 2023) afternoon.

Copy link
Member

@schlomo schlomo left a comment

Choose a reason for hiding this comment

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

In general I share your feelings about this code, it looks horribly broken and doesn't cover a lot of what ReaR can do nowadays (e.g. multiple additional configs).

At first I was surprised why it is run whatsoever, but then I understood that we run $BACKUP and $OUTPUT and even $OUTPUT/$BACKUP files in every stage.

So looking at USB I find these scripts:
image

Removing one of them seems a bit risky, I'd rather prefer to add an Error here that calls back to this issue and makes people talk to us.

Yes, this is also a breaking change, but it comes with a clear call to action whereas just removing this file could be a breaking change that will leave users confused. If nobody ever comes back then we can remove it with a very clear conscience 😄

What do you think about this approach?

As a thought for the future I won't be surprised if the udev workflow will also benefit from the ability to specify multiple $OUTPUT methods. Or maybe we have to adjust the udev workflow to add a custom ReaR config that sets OUTPUT=USB.

@jsmeix
Copy link
Member Author

jsmeix commented Dec 15, 2023

@schlomo
thank you for having a look here!

I agree that it would be better to first inform the user.

But here I don't see how I could properly inform the user.
I mean if I "just called" Error() in that script
it would error out in any case because that script
runs unconditioned.

I also don't know under which conditions that script
should be run because I do not understand for what reason
it is there at all.
I mean that I do not yet understand what it is that made you
"understood that we run $BACKUP and $OUTPUT and
even $OUTPUT/$BACKUP files in every stage".

It is neither about that $BACKUP and $OUTPUT and
even $OUTPUT/$BACKUP scripts are run in every stage
nor about "multiple $OUTPUT methods".

It is about WHY build/USB/default/800_enforce_usb_output.sh
exists at all because - as I explained above - I don't see
any reason why it needs to do what it does because
I don't see how OUTPUT in ROOTFS_DIR/.../local.conf
could differ from OUTPUT in local.conf ?
I.e. as far as I see OUTPUT is same in both.

@schlomo
Copy link
Member

schlomo commented Dec 18, 2023

@jsmeix I was referring to SourceStage():

local scripts=( $( cd $SHARE_DIR/$stage
ls -d {default,"$ARCH","$OS","$OS_MASTER_VENDOR","$OS_MASTER_VENDOR_ARCH","$OS_MASTER_VENDOR_VERSION","$OS_VENDOR","$OS_VENDOR_ARCH","$OS_VENDOR_VERSION"}/*.sh \
"$BACKUP"/{default,"$ARCH","$OS","$OS_MASTER_VENDOR","$OS_MASTER_VENDOR_ARCH","$OS_MASTER_VENDOR_VERSION","$OS_VENDOR","$OS_VENDOR_ARCH","$OS_VENDOR_VERSION"}/*.sh \
"$OUTPUT"/{default,"$ARCH","$OS","$OS_MASTER_VENDOR","$OS_MASTER_VENDOR_ARCH","$OS_MASTER_VENDOR_VERSION","$OS_VENDOR","$OS_VENDOR_ARCH","$OS_VENDOR_VERSION"}/*.sh \
"$OUTPUT"/"$BACKUP"/{default,"$ARCH","$OS","$OS_MASTER_VENDOR","$OS_MASTER_VENDOR_ARCH","$OS_MASTER_VENDOR_VERSION","$OS_VENDOR","$OS_VENDOR_ARCH","$OS_VENDOR_VERSION"}/*.sh \

Fun fact, this script build/USB/default/800_enforce_usb_output.sh would be included for both BACKUP=USB and for OUTPUT=USB.

I did some more thinking about this issue and I would like to propose a different approach:

Insert an Error at line 8 or so of the script to error out with a deprecation warning and a link to this issue and a request to provide more context for the use case.

It would hit only if this script would do something.

I know, breaking stuff is bad but it seems to me that this is the only way how we can force feedback from users of this code.


If, OTOH, everybody else wants to just remove it, then please go ahead. Worst case, somebody will come and complain why we broke ReaR and why it took them 3 days to figure out why.

@jsmeix
Copy link
Member Author

jsmeix commented Dec 18, 2023

BACKUP=USB is not supported and
not listed in "man rear" or in default.conf
and for a test with BACKUP=USB I get

# usr/sbin/rear -D mkbackup
...
ERROR: The BACKUP method 'USB' is not supported (no /root/rear.github.master/usr/share/rear/restore/USB directory)
Some latest log messages since the last called script 035_valid_backup_methods.sh:

so in practice build/USB/default/800_enforce_usb_output.sh
will not be run for BACKUP=USB
so it should be only run for OUTPUT=USB

jsmeix added a commit that referenced this pull request Dec 18, 2023
Overhauled build/USB/default/800_enforce_usb_output.sh
Now BugError when OUTPUT=USB got somehow modified $ROOTFS_DIR/etc/rear/local.conf
plus explanatory comments.
Triggered by #3103
and replacing this by a new pull request.
@jsmeix
Copy link
Member Author

jsmeix commented Dec 18, 2023

This one is superseded by
#3110

@jsmeix jsmeix closed this Dec 18, 2023
@jsmeix jsmeix deleted the jsmeix-remove-800_enforce_usb_output branch December 18, 2023 11:28
jsmeix added a commit that referenced this pull request Dec 20, 2023
Overhauled build/USB/default/800_enforce_usb_output.sh
Now LogPrintError infos and BugError when OUTPUT=USB
got somehow modified in $ROOTFS_DIR/etc/rear/local.conf
plus explanatory comments in the code.
Triggered by #3103
and replacing this by a new pull request.
@pcahyna
Copy link
Member

pcahyna commented Mar 1, 2024

@jsmeix regarding the udev output, I found this: https://github.com/rear/rear/blob/master/doc/user-guide/04-scenarios.adoc#using-relax-and-recover-with-usb-storage-devices

We have implemented a specific workflow: inserting a REAR-000 labeled USB stick will invoke rear udev and adds a rescue environment to the USB stick (updating the bootloader if needed)

but no further explanation. I suppose this whole point should be deleted.

jsmeix added a commit that referenced this pull request Mar 4, 2024
In doc/user-guide/04-scenarios.adoc
removed parts that mention 'udev'
from the section about USB devices, cf.
#3103 (comment)
and also removed some other parts there
which are outdated, could be misleading,
or are questionable or discursive
to make the text simpler and more to the point
@jsmeix
Copy link
Member Author

jsmeix commented Mar 4, 2024

Via
eadcc68
in doc/user-guide/04-scenarios.adoc
I removed parts that mention 'udev'
from the section about USB devices
and by the way
I also removed some other parts there
which are outdated, could be misleading,
or are questionable or discursive
to make the text simpler and more to the point.

lzaoral pushed a commit to lzaoral/rear that referenced this pull request Mar 4, 2024
In doc/user-guide/04-scenarios.adoc
removed parts that mention 'udev'
from the section about USB devices, cf.
rear#3103 (comment)
and also removed some other parts there
which are outdated, could be misleading,
or are questionable or discursive
to make the text simpler and more to the point
lzaoral pushed a commit to lzaoral/rear that referenced this pull request Mar 5, 2024
In doc/user-guide/04-scenarios.adoc
removed parts that mention 'udev'
from the section about USB devices, cf.
rear#3103 (comment)
and also removed some other parts there
which are outdated, could be misleading,
or are questionable or discursive
to make the text simpler and more to the point
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants