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
Missing libraries in Rescue ISO causing executables to fail #1975
Comments
… to fail When including files in the ISO using COPY_AS_IS functionality and some of these are libraries with same name as standard system libraries, the standard system libraries are not included if an executable included through COPY_AS_IS requires a library. This does not happen for executables specified through PROG. Example: copy /lib64/libglib-2.0.so.0 into /non-standard-dir/lib64/ and include /non-standard-dir/lib64 in the ISO (COPY_AS_IS+=( /non-standard-dir/lib64 )) - /usr/lib/udev/rename_device which is also included as COPY_AS_IS (in /usr/share/rear/rescue/GNU/Linux/250_udev.sh) requires /lib64/libglib-2.0.so.0 but /lib64/libglib-2.0.so.0 is not included, only /non-standard-dir/lib64/libglib-2.0.so.0 will be - /usr/lib/udev/rename_device will not be usable in rescue due to missing library If we now add /usr/lib/udev/rename_device to PROG (PROG+=( /usr/lib/udev/rename_device )), the library /lib64/libglib-2.0.so.0 will be included because of code in /usr/share/rear/build/GNU/Linux/390_copy_binaries_libraries.sh, so there will be no issue in that case. The root cause of the issue is due to the grep line being used: grep -q "$required_library" $copy_as_is_filelist_file && continue Because $required_library is "/lib64/libglib-2.0.so.0" and file $copy_as_is_filelist_file contains "/non-standard-dir/lib64/libglib-2.0.so.0", this will be a match, whereas it should not. The fix consists in modifying the grep line to match a full line instead (file $copy_as_is_filelist_file contains 1 file name per line). Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
… to fail When including files in the ISO using COPY_AS_IS functionality and some of these are libraries with same name as standard system libraries, the standard system libraries are not included if an executable included through COPY_AS_IS requires a library. This does not happen for executables specified through PROG. Example: copy /lib64/libglib-2.0.so.0 into /non-standard-dir/lib64/ and include /non-standard-dir/lib64 in the ISO (COPY_AS_IS+=( /non-standard-dir/lib64 )) - /usr/lib/udev/rename_device which is also included as COPY_AS_IS (in /usr/share/rear/rescue/GNU/Linux/250_udev.sh) requires /lib64/libglib-2.0.so.0 but /lib64/libglib-2.0.so.0 is not included, only /non-standard-dir/lib64/libglib-2.0.so.0 will be - /usr/lib/udev/rename_device will not be usable in rescue due to missing library If we now add /usr/lib/udev/rename_device to PROG (PROG+=( /usr/lib/udev/rename_device )), the library /lib64/libglib-2.0.so.0 will be included because of code in /usr/share/rear/build/GNU/Linux/390_copy_binaries_libraries.sh, so there will be no issue in that case. The root cause of the issue is due to the grep line being used: grep -q "$required_library" $copy_as_is_filelist_file && continue Because $required_library is "/lib64/libglib-2.0.so.0" and file $copy_as_is_filelist_file contains "/non-standard-dir/lib64/libglib-2.0.so.0", this will be a match, whereas it should not. The fix consists in modifying the grep line to match a full line instead (file $copy_as_is_filelist_file contains 1 file name per line). Signed-off-by: Renaud Métrich <rmetrich@redhat.com> M
@rmetrich |
@rmetrich |
That's just an example. In real life, this happens when doing relaxed COPY_AS_IS such as the one done for ... NetBackup ... : |
… to fail When including files in the ISO using COPY_AS_IS functionality and some of these are libraries with same name as standard system libraries, the standard system libraries are not included if an executable included through COPY_AS_IS requires a library. This does not happen for executables specified through PROG. Example: copy /lib64/libglib-2.0.so.0 into /non-standard-dir/lib64/ and include /non-standard-dir/lib64 in the ISO (COPY_AS_IS+=( /non-standard-dir/lib64 )) - /usr/lib/udev/rename_device which is also included as COPY_AS_IS (in /usr/share/rear/rescue/GNU/Linux/250_udev.sh) requires /lib64/libglib-2.0.so.0 but /lib64/libglib-2.0.so.0 is not included, only /non-standard-dir/lib64/libglib-2.0.so.0 will be - /usr/lib/udev/rename_device will not be usable in rescue due to missing library If we now add /usr/lib/udev/rename_device to PROG (PROG+=( /usr/lib/udev/rename_device )), the library /lib64/libglib-2.0.so.0 will be included because of code in /usr/share/rear/build/GNU/Linux/390_copy_binaries_libraries.sh, so there will be no issue in that case. The root cause of the issue is due to the grep line being used: grep -q "$required_library" $copy_as_is_filelist_file && continue Because $required_library is "/lib64/libglib-2.0.so.0" and file $copy_as_is_filelist_file contains "/non-standard-dir/lib64/libglib-2.0.so.0", this will be a match, whereas it should not. The fix consists in modifying the grep line to match a full line instead (file $copy_as_is_filelist_file contains 1 file name per line). Signed-off-by: Renaud Métrich <rmetrich@redhat.com> M
Missing libraries in recovery system caused executables to fail, see #1975 because in build/GNU/Linux/100_copy_as_is.sh libraries were skipped from copying when their library path was a substring of another already copied library, for example /path/to/lib was skipped when /other/path/to/lib was already copied.
I found a simple reproducer that emphasizes I only added to my etc/rear/local.conf COPY_AS_IS=( "${COPY_AS_IS[@]}" /usr/sbin/postfix /doesnotexist/usr/lib/postfix/libpostfix-global.so ) and "rear -D mkrescue" failed with Testing that the recovery system in /tmp/rear.8eGP5wvyks7HAf1/rootfs contains a usable system There are binaries or libraries in the ReaR recovery system that need additional libraries /bin/postfix requires additional libraries (fatal error) libpostfix-global.so => not found ReaR recovery system in '/tmp/rear.8eGP5wvyks7HAf1/rootfs' needs additional libraries, check /root/rear.github.master/var/log/rear/rear-g243.log for details ERROR: ReaR recovery system in '/tmp/rear.8eGP5wvyks7HAf1/rootfs' not usable (required libraries are missing) For me libpostfix-global.so => /usr/lib/postfix/libpostfix-global.so but copying tar: /doesnotexist/usr/lib/postfix/libpostfix-global.so: Cannot stat: No such file or directory cf. the comment in build/GNU/Linux/100_copy_as_is.sh about I.e. even files that failed to copy may have matched before this fix here. |
Good point! |
ReaR version ("/usr/sbin/rear -V"): 2.4 master
OS version ("cat /etc/rear/os.conf" or "lsb_release -a" or "cat /etc/os-release"): RHEL7
ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):
When adding programs into the Rescue ISO using
COPY_AS_IS
(typically done when using NetBackup in real life) and the directories specified contain files with same names as standard libraries (but likely at different version), the corresponding standard libraries are not included, causing some binaries that are added anyway to not be usable.The related code is
/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
.However, if a program is specified using PROG, then the required system libraries will be included anyway, because there is additional code running in
/usr/share/rear/build/GNU/Linux/390_copy_binaries_libraries.sh
.Reproducer
Create a non standard path and copy "libglib" into it:
We can see from there that
libglib-2.0.so.0
was not included, even though it's a must for/usr/lib/udev/rename_device
.I'm currently investigating this.
The text was updated successfully, but these errors were encountered: