doomedraven / Tools

Combination of different utilities, have fun!
MIT License
202 stars 96 forks source link

[cape2.sh] - jemalloc error #82

Closed zoomequipd closed 3 years ago

zoomequipd commented 3 years ago

Prerequisites

Please answer the following questions for yourself before submitting an issue.

Expected Behavior

jemalloc should install cleanly without any errors

Current Behavior

the execution of cape2.sh ends with an error regarding jemolloc ln: failed to create symbolic link '/usr/lib/x86_64-linux-gnu/libjemalloc.so': File exists

Failure Information (for bugs)

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. pull down kvm-aemu.sh
  2. run sudo ./kvm-qemu.sh all <username> | tee kvm-qemu.log
  3. reboot
  4. pull down capev2.sh
  5. run sudo ./cape2.sh base cape | tee cape.log
  6. observe error at the very end of the execution of cape2.sh

Context

I believe this is a result of running kvm-qemu.sh which installs jemalloc in a different manner, thus resulting in a conflict.

https://github.com/doomedraven/Tools/blob/41bdab856c6bb9e5a559d77606aea8101a5a94f0/Virtualization/kvm-qemu.sh#L774-L778

I suspect reusing the logic from kvm-qemu.sh is a solution, though I'm not confident if that's the best solution. I am happy to submit a PR with some direction.

As a sidenote, though I don't think it matter here, I also observed that the file installed via the package in kvm-qemu.sh is different than the one attempted to be symlink'ed in cape2.sh

# existing symlink
> ls -lhntra /usr/lib/x86_64-linux-gnu/libjemalloc.so
lrwxrwxrwx 1 0 0 16 Apr  2  2020 /usr/lib/x86_64-linux-gnu/libjemalloc.so -> libjemalloc.so.2

# md5 of existing symlink
> md5sum /usr/lib/x86_64-linux-gnu/libjemalloc.so.2
d13aabd3e907425ee2efd7098085eb10  /usr/lib/x86_64-linux-gnu/libjemalloc.so.2

# md5 of attempted symlink
> md5sum  /usr/local/lib/libjemalloc.so
c0f484e7e927221673bde6c79348d0e7  /usr/local/lib/libjemalloc.so
Question Answer
OS version Ubuntu 20.04

Failure Logs

**********************************************************************

 Done. The new package has been installed and saved to

 /tmp/jemalloc-jemalloc-886e40b/jemalloc-5.2.1_5.2.1-1_amd64.deb

 You can remove it from your system anytime using: 

      dpkg -r jemalloc-5.2.1

**********************************************************************

ln: failed to create symbolic link '/usr/lib/x86_64-linux-gnu/libjemalloc.so': File exists
doomedraven commented 3 years ago

ya i see many people getting this problem with jemalloc, the easier is just add options to apt to overwrite the file and forget, i will add that to both scripts today or tomorrow, thanks

doomedraven commented 3 years ago

ok pushed, i have added this to both scripts

#!/bin/bash
if  [ $(dpkg -l "jemalloc*" | grep -q "ii  jemalloc") ]; then
        aptitude install -f checkinstall curl build-essential jq autoconf libjemalloc-dev -y
else
    echo "installed"
fi
./test.sh
installed

i have removed else condition in script

doomedraven commented 3 years ago

ok that isn't perfect hm

doomedraven commented 3 years ago

ok this oen works better

#!/bin/bash
if  ! $(dpkg -l "libjemalloc*" | grep -q "ii  libjemalloc"); then
        aptitude install -f checkinstall curl build-essential jq autoconf libjemalloc-dev -y
else
    echo "installed"
fi
zoomequipd commented 3 years ago

If you want to maintain the separation of kvm-qeum.sh from cape2.sh you might consider installing aptitude in cape2.sh or use apt-get install (which seems to be the current state of things in cape2.sh)

doomedraven commented 3 years ago

ah true, the aptitude was introduced by one user, as it solves better dependencies, but we don't need that in cape2.sh, it was just bad c&p, thanks for catch that, pushing fix

zoomequipd commented 3 years ago

just tested it from a snapshot taken just after running kvm-qemu - looks good to me!

Thanks a bunch for all the work you put into this -it has saved me so much time!

doomedraven commented 3 years ago

Thank you for testing, glat is was useful, let me know if you see any other bug

El dom., 7 mar. 2021 0:09, zoomequipd notifications@github.com escribió:

just tested it from a snapshot taken just after running kvm-qemu - looks good to me!

Thanks a bunch for all the work you put into this -it has saved me so much time!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/doomedraven/Tools/issues/82#issuecomment-792107785, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOFH3ZQYDD2TPFP5UWTWPLTCKYZZANCNFSM4YW7KFVA .