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
Skip btrfs subvolumes when detecting ESP partitions #3176
Conversation
ITYM
Can you please show an example if you have saved it somewhere? |
Thank you, @pcahyna! I've fixed the typo as I meant the |
045a6c9
to
2587b5c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, if there are no further comments from @rear/contributors, I plan to merge it tomorrow.
thank you a lot for the fix and for providing an example of the buggy behavior! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wished there was a comment that explains
what those rather obscure function calls
(confusing $1 $2 $3 stuff in lib/layout-functions.sh instead of named arguments)
is meant to result in the end,
for example like
# Find only the partition of the ESP mount point and
# skip all other transitive 'fs' and ' btrfsmountedsubvol'
# dependencies in LAYOUT_DEPS (var/lib/rear/layout/diskdeps.conf)
# see https://github.com/rear/rear/pull/3176
Only a side question FYI: I am wondering why the ESP kernel device node Do you know if there is a reason why not E.g. on a running system
I don't use the SUSE btrfs structure I assume 'lsblk' cannot be used here because Or why not directly from disklayout.conf? E.g. on my homeoffice workstation (excerpt):
I.e. why indirectly via the ESP mount point |
@jsmeix I'll add the comment explaining why the exclusions are required.
AFAIK, it is necessary to create boot entry for every physical device present in the RAID array which contains the ESP: |
2587b5c
to
5ce172e
Compare
The idea is to find all direct partitions that contain the ESP mount point and to skip all other transitive `fs:` dependencies. The `diskdeps.conf` file contains following entries on default Fedora installations (the list was shortened to only the relevant ones): ``` /dev/vda1 /dev/vda /dev/vda4 /dev/vda /dev/vda5 /dev/vda fs:/boot/efi /dev/vda1 fs:/boot/efi fs:/boot fs:/boot/efi fs:/ fs:/boot/efi btrfsmountedsubvol:/ fs:/boot /dev/vda4 fs:/boot fs:/ fs:/boot btrfsmountedsubvol:/ fs:/ /dev/vda5 btrfsmountedsubvol:/ /dev/vda5 ``` The ESP partition is only on `/dev/vda1`. However, the `find_partition` call was not taking into account the need to skip mounted btrfs subvolumes as well. Therefore, `/dev/vda5` was listed as an ESP partition as well. This change makes sure that only direct ESP partitions are listed and fixes a bug where ReaR would create broken BootXXXX entries which point to completely unrelated partitions. Relevant excerpts from logs: ``` ++ efibootmgr --create --gpt --disk /dev/vda --part 1 --write-signature --label 'RedHatEnterpriseServer 41' --loader '\EFI\fedora\grubx64.efi' ... ++ efibootmgr --create --gpt --disk /dev/vda --part 5 --write-signature --label 'RedHatEnterpriseServer 41' --loader '\EFI\fedora\grubx64.efi' ```
5ce172e
to
c8409e1
Compare
@jsmeix I looked at the places that determine the ESP filesystem / device and it seems like a mess to me (several different methods are used), but I don't have enough motivation to fix this as the code "mostly works" now (I suspect it might have some problems when multipath is used though) so I am going to stop investigating and merge the code as it is. |
@pcahyna |
Pull Request Details:
Type: Bug Fix
Impact: Normal
Reference to related issue (URL): N/A
How was this pull request tested? Recovery of Fedora Rawhide UEFI machine.
Description of the changes in this pull request:
The idea is to find all direct partitions that contain the ESP mount point and to skip all other transitive
fs:
dependencies.The
diskdeps.conf
file contains following entries on default Fedora installations (the list was shortened to only the relevant ones):The ESP partition is only on
/dev/vda1
. However, thefind_partition
callwas not taking into account the need to skip mounted btrfs subvolumes as well.
Therefore,
/dev/vda5
was listed as an ESP partition as well.This change makes sure that only direct ESP partitions are listed and
fixes a bug where ReaR would create broken BootXXXX entries which point to
completely unrelated partitions.
Relevant excerpts from logs: