#1521 PR merged: Simplify and cleanup the binaries and libraries copying code.

Labels: cleanup, fixed / solved / done

jsmeix opened issue at 2017-09-29 13:55:

See
https://github.com/rear/rear/issues/1518#issuecomment-333073549

I like to create this pull request right now before the weekend
so that you could already have a first look if you like
regardless that it cannot be automatically merged
which is something to fix for me for next week.

jsmeix commented at 2017-09-29 14:00:

The merge conflict was easy to solve so that
I did it right now online via the GitHub web UI.

jsmeix commented at 2017-10-04 13:40:

For me all works well now so that I like to merge it soon.

FYI:
I tested it even with an unusual libraries configuration.
I used libparted for that test because libparted is not a core library
where an error could make the whole recovery system useless
but libparted is still a mandatory library for "rear recover".
On the original system I did:

# mkdir /mylibs
# mv /usr/lib64/libparted.so.2.0.0 /mylibs/libparted.so.2.0.0
# cd /mylibs
# ln -s libparted.so.2.0.0 libparted.so.2.0

# mkdir /myliblinks
# cd /myliblinks
# ln -s ../mylibs/libparted.so.2.0 libparted.so.2

# find /mylibs /myliblinks -ls | cut -b47-
   4096 Oct  4 14:02 /mylibs
     18 Oct  4 14:02 /mylibs/libparted.so.2.0 -> libparted.so.2.0.0
 290160 Oct 25  2016 /mylibs/libparted.so.2.0.0
   4096 Oct  4 14:01 /myliblinks
     26 Oct  4 14:01 /myliblinks/libparted.so.2 -> ../mylibs/libparted.so.2.0

# cat /etc/ld.so.conf
/myliblinks
/lib64/noelision
/usr/local/lib64
/usr/local/lib
include /etc/ld.so.conf.d/*.conf

# ldconfig

# ldd /usr/sbin/parted
        linux-vdso.so.1 (0x00007ffea1179000)
        libparted.so.2 => /myliblinks/libparted.so.2 (0x00007feb71a94000)
        libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007feb7186a000)
        libreadline.so.6 => /lib64/libreadline.so.6 (0x00007feb7161e000)
        libc.so.6 => /lib64/libc.so.6 (0x00007feb7127b000)
        libuuid.so.1 => /usr/lib64/libuuid.so.1 (0x00007feb71076000)
        libdevmapper.so.1.02 => /lib64/libdevmapper.so.1.02 (0x00007feb70e2b000)
        libblkid.so.1 => /usr/lib64/libblkid.so.1 (0x00007feb70be9000)
        libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007feb709b5000)
        /lib64/ld-linux-x86-64.so.2 (0x0000564b80505000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007feb7078e000)
        libudev.so.1 => /usr/lib64/libudev.so.1 (0x00007feb7056e000)
        libpthread.so.0 => /lib64/noelision/libpthread.so.0 (0x00007feb70351000)
        libpcre.so.1 => /usr/lib64/libpcre.so.1 (0x00007feb700ea000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007feb6fee6000)
        libcap.so.2 => /lib64/libcap.so.2 (0x00007feb6fce1000)
        librt.so.1 => /lib64/librt.so.1 (0x00007feb6fad8000)
        libm.so.6 => /lib64/libm.so.6 (0x00007feb6f7db000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007feb6f5c4000)

# usr/sbin/rear -d -D mkrescue
Relax-and-Recover 2.2 / Git
Using log file: /root/rear.master.issue1518/var/log/rear/rear-e205.log
Using backup archive '/tmp/rear.gPle6z9us561XsA/outputfs/e205/backup.tar.gz'
Creating disk layout
Using sysconfig bootloader 'grub2'
Creating root filesystem layout
Saving file capabilities (NETFS_RESTORE_CAPABILITIES)
Copying logfile /root/rear.master.issue1518/var/log/rear/rear-e205.log into initramfs as '/tmp/rear-e205-partial-2017-10-04T15:19:58+02:00.log'
Copying files and directories
Copying binaries and libraries
Copying only currently loaded kernel modules (MODULES contains 'loaded_modules')
Omit copying files in /lib*/firmware/ (FIRMWARE_FILES='No')
Creating recovery/rescue system initramfs/initrd initrd.cgz with gzip default compression
Created initrd.cgz with gzip default compression (61662401 bytes) in 9 seconds
Making ISO image
Wrote ISO image: /root/rear.master.issue1518/var/lib/rear/output/rear-e205.iso (67M)
Copying resulting files to nfs location
Saving /root/rear.master.issue1518/var/log/rear/rear-e205.log as rear-e205.log to nfs location
You should also rm -Rf /tmp/rear.gPle6z9us561XsA

# find /tmp/rear.gPle6z9us561XsA/rootfs/ -ls | grep libparted | cut -b47-
     26 Oct  4 15:20 /tmp/rear.gPle6z9us561XsA/rootfs/myliblinks/libparted.so.2 -> /mylibs/libparted.so.2.0.0
 290160 Oct 25  2016 /tmp/rear.gPle6z9us561XsA/rootfs/mylibs/libparted.so.2.0.0

# chroot /tmp/rear.gPle6z9us561XsA/rootfs/ ldd /bin/parted
        linux-vdso.so.1 (0x00007ffc89198000)
        libparted.so.2 => /myliblinks/libparted.so.2 (0x00007f13daffa000)
        libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007f13dadd0000)
        libreadline.so.6 => /lib64/libreadline.so.6 (0x00007f13dab84000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f13da7e1000)
        libuuid.so.1 => /usr/lib64/libuuid.so.1 (0x00007f13da5dc000)
        libdevmapper.so.1.02 => /lib64/libdevmapper.so.1.02 (0x00007f13da391000)
        libblkid.so.1 => /usr/lib64/libblkid.so.1 (0x00007f13da14f000)
        libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f13d9f1b000)
        /lib64/ld-linux-x86-64.so.2 (0x0000556ffb72e000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f13d9cf4000)
        libudev.so.1 => /usr/lib64/libudev.so.1 (0x00007f13d9ad4000)
        libpthread.so.0 => /lib64/noelision/libpthread.so.0 (0x00007f13d98b7000)
        libpcre.so.1 => /usr/lib64/libpcre.so.1 (0x00007f13d9650000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f13d944c000)
        libcap.so.2 => /lib64/libcap.so.2 (0x00007f13d9247000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f13d903e000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f13d8d41000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f13d8b2a000)

Of course also a "rear recover" worked for me with that.

jsmeix commented at 2017-10-04 14:05:

Let's get that merged to be able to move forward and
of course I will fix bugs in this area when they appear.


[Export of Github issue for rear/rear.]