xdeb-org / xdeb

XDEB - Convert deb (Debian) packages to xbps (Void Linux)
MIT License
305 stars 16 forks source link

[BUG] mongodb-org-server installation destroys /lib #6

Closed r4rdsn closed 3 years ago

r4rdsn commented 3 years ago

Information

Package

Script output

[+] Synced shlibs
[+] Extracted files
[-] Unable to find dependency for libcrypto.so.1.1
[-] Unable to find dependency for libssl.so.1.1
[+] Resolved dependencies ( glibc>=2.29_1 libcurl>=7.19_1 libgcc>=4.4.0_1 liblzma>=5.0.0_1 )
[+] 'Parsed' control file
index: added `mongodb-org-server-4.4.1_1' (x86_64).
index: 1 packages registered.
[+] Done. Install using `xbps-install -R binpkgs mongodb-org-server-4.4.1_1`

Describe the issue

After installing the package, /lib/, which is a soft link to /usr/lib/ on a normal Void Linux installation, gets replaced with /lib/systemd/system/mongod.service. That breaks the system as binaries can no longer use any of the library files.

[anon@void-live ~]$ ls -l /lib
lrwxrwxrwx 1 root root 7 Nov  9  2019 /lib -> usr/lib
[anon@void-live xdeb]$ sudo xbps-install -R binpkgs mongodb-org-server-4.4.1_1
1 package will be installed:
  mongodb-org-server-4.4.1_1

Size required on disk:          78MB
Space available on disk:      1668MB

Do you want to continue? [Y/n]

[*] Verifying package integrity
mongodb-org-server-4.4.1_1: verifying SHA256 hash...

[*] Collecting package files
mongodb-org-server-4.4.1_1: collecting files...

[*] Unpacking packages
mongodb-org-server-4.4.1_1: unpacking ...

[*] Configuring unpacked packages
mongodb-org-server-4.4.1_1: configuring ...
mongodb-org-server-4.4.1_1: installed successfully.

0 downloaded, 1 installed, 0 updated, 1 configured, 0 removed.
[anon@void-live xdeb]$ sudo
bash: /bin/sudo: No such file or directory
[anon@void-live xdeb]$ ls /bin
bash: /bin/ls: No such file or directory
[anon@void-live xdeb]$ # Have to use bash's autocompletion here
[anon@void-live xdeb]$ ls /bin/
Display all 1314 possibilities? (y or n)
[anon@void-live xdeb]$ ls /lib/systemd/system/mongod.service
toluschr commented 3 years ago

I had this problem in the past and thought I fixed it by detecting file conflicts. Turns out, I completely fucked the conditionals. The || and && operators in shell gives me a hard time, because they are so different compared to other programming languages.

toluschr commented 3 years ago

To fix this relink /usr/lib to /lib.

It should be working fine now.

$ ./xdeb -Sed ~/Downloads/mongodb-org-server_4.4.1_amd64.deb
[+] Synced shlibs
[+] Extracted files
[-] Unable to find dependency for libcrypto.so.1.1
[-] Unable to find dependency for libssl.so.1.1
[+] Resolved dependencies ( glibc>=2.29_1 libcurl>=7.19_1 libgcc>=4.4.0_1 liblzma>=5.0.0_1 )
[!] Conflict: destdir/lib
[-] Unless updating, consider removing conflicting files and rebuild with "-rb"
index: skipping `mongodb-org-server-4.4.1_1' (x86_64), already registered.
index: 4 packages registered.
[+] Done. Install using `xbps-install -R binpkgs mongodb-org-server-4.4.1_1`

I'm thinking about making xdeb automatically move those files, or refusing to build. What do you think about that?

r4rdsn commented 3 years ago

I'm thinking about making xdeb automatically move those files, or refusing to build. What do you think about that?

@toluschr Yeah I don't think xdeb should build packages that mess up conflicting system files by default. Refusing to build is better but I don't think it should do that either, since at least in this case the lack of /lib isn't a problem, so xdeb can safely ignore it. I imagine it would also make updates more difficult. Maybe it should build but put file conflicts in a different directory than destdir by default, so that if you want to force it you can mv them into destdir and rebuild.

AngryPhantom commented 3 years ago

I'll bump this (if you don't mind) since I've got a totally unusable system recently after converting a package (actually a XanMod kernel for Debian). So yes, in fact, ~/lib, which is a soft link to /usr/lib on a normal Void Linux installation, gets replaced with a plain /lib directory. I couldn't neither boot my PC nor chroot into the system.

P.S. What are the options to actually build a package without installing it? (so I can inspect its contents prior to installation)

Thanks.

toluschr commented 3 years ago

xdeb just builds the package. Leave out the xbps-install step. I don't think converting custom kernel packages is a good idea. Also:

[!] Conflict: 'destdir/lib'
[!] Unless updating, consider removing conflicting files and rebuild with "-rb"
toluschr commented 3 years ago

@r4rdsn I went with the first idea. The script now moves symlinks in / by default. Just moving known conflicts isn't a good solution, but atleast the script won't break the system when ignoring the logs anymore.