Bug 1317238 - possible ld-linux.so.2 misbehaviour detected
possible ld-linux.so.2 misbehaviour detected
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
22
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Carlos O'Donell
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-03-13 05:20 EDT by Ali Akcaagac
Modified: 2016-03-13 07:41 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-03-13 07:41:30 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ali Akcaagac 2016-03-13 05:20:24 EDT
Let's assume following use case (one that I have):

Hot-Swapping a Linux System

I keep a backup of my Fedora installation in:

/.fedora

The other directories of the root remain as they are

/bin
/boot
/etc
...

I usually Hot-Swap the system every now and then by rebooting Fedora and applying systemd.target=emergency.service to the Kernel line before loading up.

This allows me to operate on the correct Filesystem rather than e.g. the initrd.

After logging in I run "midnight commander" straight away and move all directories of the root in a subdirectory and then move all directories from /.fedora to the root directory. (there are a few exceptions like dev, proc, run, sys)

I exit "midnight commander", run ldconfig, grub2-install /somedev, reboot, done.

Running "midnight commander" will also load all shared libraries that "midnight commander" depend on into memory, therefore no issues with operation as long as you don't quit the program - I know this is slightly risky - until now this has never failed!

Now I wanted to automate this process within a script.

running "mv" to move the same directories into a temp directory and then running "mv" again to move all backup directories back to the root.

The "run again" is an issue because once all root directories are moved to a temp directory the root basicly has no directories anymore. Thus also means lib → usr/lib is missing. This means even ld-linux.so.2 is missing, to load all dynamical libraries a file depend on.

What I tried was this:

LD_LIBRARY_PATH="/.fedora/usr/lib" mv

---- failed because of the dynamic loader.

What should work - at least from the manuals - is this:

/.fedora/usr/lib/ld-linux.so.2 --library-path /.fedora/usr/lib mv

---- sadly this fails with errors in the object files.

No matter what shared file I point at it. They all fail. From what I understand is, that running ld-linux.so.2 (and some command after it) should make the program pointing at it run → at least the small ones like "mv" "rm" ...

Any ideas what's wrong or what I might be missing here ?
Comment 1 Florian Weimer 2016-03-13 06:05:41 EDT
(In reply to Ali Akcaagac from comment #0)
> What should work - at least from the manuals - is this:
> 
> /.fedora/usr/lib/ld-linux.so.2 --library-path /.fedora/usr/lib mv

Please capture the output of:

LD_DEBUG=all /.fedora/usr/lib/ld-linux.so.2 --library-path /.fedora/usr/lib mv

We also need the exact versions (NVRs) of the glibc libraries involved.
Comment 2 Ali Akcaagac 2016-03-13 07:41:30 EDT
(In reply to Florian Weimer from comment #1)
> We also need the exact versions (NVRs) of the glibc libraries involved.

I have to apologize! This was my fault!

During hot-swap there was no PATH set to /.fedora/bin, therefore the ld-linux.so.2 loader wasn't able to load any of the commands, because it couldn't find them.

The glibc and the files involved are all from the glibc-2.21-13.fc22.i686 package.

The solution was to either export or set a PATH or using absolute path within the ld.so call.

My *crude* but valid solution from this morning looks like this:

;--- begin test.sh ---
ROOT1="/"
PATH1="/.cdrom"
PATH2="/.cdrom-"

LDSO1="${PATH1}/usr/lib/ld-linux.so.2 --library-path ${PATH1}/usr/lib"
FILE1="${PATH1}/usr/bin/rm --force --recursive"
FILE2="${PATH1}/usr/bin/mv --force --verbose"
FILE3="${ROOT1}/usr/bin/rm --force --recursive"
FILE4="${ROOT1}/usr/bin/mv --force --verbose"

LIST1="${ROOT1}/bin ${ROOT1}/boot ${ROOT1}/etc ${ROOT1}/home ${ROOT1}/lib
       ${ROOT1}/lost+found ${ROOT1}/media ${ROOT1}/mnt ${ROOT1}/opt ${ROOT1}/root
       ${ROOT1}/sbin ${ROOT1}/srv ${ROOT1}/tmp ${ROOT1}/usr ${ROOT1}/var
       ${ROOT1}/.autorelabel ${ROOT1}/.readahead"

LIST2="${PATH1}/bin ${PATH1}/boot ${PATH1}/etc ${PATH1}/home ${PATH1}/lib
       ${PATH1}/lost+found ${PATH1}/media ${PATH1}/mnt ${PATH1}/opt ${PATH1}/root
       ${PATH1}/sbin ${PATH1}/srv ${PATH1}/tmp ${PATH1}/usr ${PATH1}/var
       ${PATH1}/.autorelabel ${PATH1}/.readahead"

${LDSO1} ${FILE1}          ${LIST1}
${LDSO1} ${FILE2} ${LIST2} ${ROOT1}

${FILE3}          ${PATH1}
${FILE4} ${PATH2} ${PATH1}
;--- end test.sh ---

Note You need to log in before you can comment on or make changes to this bug.