Re: libc6 Compatibility

From: Sysadmin Lists <sysadmin.lists_at_mailfence.com>
Date: Tue, 14 Jun 2022 19:55:58 UTC
> ----------------------------------------
> From: Dmitry Chagin <dchagin@freebsd.org>
> Sent: Tue Jun 14 09:24:37 CEST 2022
> To: Sysadmin Lists <sysadmin.lists@mailfence.com>
> Cc: Freebsd Emulation <freebsd-emulation@freebsd.org>
> Subject: Re: libc6 Compatibility
> 
> 
> On Tue, Jun 14, 2022 at 03:26:03AM +0200, Sysadmin Lists wrote:
> > Does Linux compat not work with Ubuntu's newest libc6 update?
> > I used to run Brave browser from it, but now I get this error message:
> > 
> > $ /compat/ubuntu/opt/brave.com/brave/brave
> > ELF interpreter /lib64/ld-linux-x86-64.so.2 not found, error 2
> > Abort trap
> > 
> > The shared object is loaded in memory:
> > $ ldd /opt/brave.com/brave/brave  | grep ld-
> > 	/lib64/ld-linux-x86-64.so.2 (0x0000000001021000)
> > 
> > And it exists on the filesystem:
> > $ find /compat/ubuntu/lib**/ -name ld-\* -exec ls -lh '{}' +
> > -rwxr-xr-x  1 root  wheel   187K Dec 16  2020 /compat/ubuntu/lib/x86_64-linux-gnu/ld-2.31.so
> > lrwxr-xr-x  1 root  wheel      10B Dec 16  2020 /compat/ubuntu/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 -> ld-2.31.so
> > lrwxr-xr-x  1 root  root         34B Mar 23  2021 /compat/ubuntu/lib64/ld-linux-x86-64.so.2 -> ../lib/x86_64-linux-gnu/ld-2.31.so
> > 
> > This is the update that broke it:
> > $ apt-get install libc6
> > Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libc6 amd64 2.31-0ubuntu9.9 [2722 kB]
> >
> 
> try ktrace it, aka ktrace -di /compat/ubuntu/opt/brave.com/brave/brave
> then kdump -HAR -m 128 > brave.log
> 
> 

Thanks, Dmitry. That helped me find the problem. Here's the full log:

$ cat brave.log 
  8184 101222 ktrace   0.000000 RET     F64  ktrace 0
  8184 101222 ktrace   0.000014 CALL   F64  execve(0x7fffffffeda3,0x7fffffffeac0,0x7fffffffead0)
  8184 101222 ktrace   0.000003 NAMI  F64  "/compat/ubuntu/opt/brave.com/brave/brave"
  8184 101222 ktrace   0.055726 NAMI  F64  "/compat/ubuntu/lib64/ld-linux-x86-64.so.2"
  8184 101222 ktrace   0.000032 NAMI  F64  "/lib64/ld-linux-x86-64.so.2"

And here's an updated `ls' printout after upgrading libc6:
$ find /compat/ubuntu/lib**/ -name ld-\* -exec ls -lh '{}' +
-rwxr-xr-x  1 root  wheel   187K Apr  6 18:24 /compat/ubuntu/lib/x86_64-linux-gnu/ld-2.31.so
lrwxr-xr-x  1 root  wheel      10B Apr  6 18:24 /compat/ubuntu/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 -> ld-2.31.so
lrwxr-xr-x  1 root  wheel      32B Apr  6 18:24 /compat/ubuntu/lib64/ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-2.31.so

The new .so is missing 'previous directory' dots in the symlink path.
I thought Linux compat was designed to search compat.linux.emul_path
for shared libs first, but apparently it works differently than that.

Fixing the path fixed the problem:
# chroot /compat/ubuntu/ /bin/bash
# cd /lib64/
# cp -va ld-linux-x86-64.so.2 ld-linux-x86-64.so.2.down
'ld-linux-x86-64.so.2' -> 'ld-linux-x86-64.so.2.down'
# ln -fs ../lib/x86_64-linux-gnu/ld-2.31.so ld-linux-x86-64.so.2
# ls -lh
total 1.0K
lrwxr-xr-x 1 root root 34 Jun 14 12:46 ld-linux-x86-64.so.2 -> ../lib/x86_64-linux-gnu/ld-2.31.so
lrwxr-xr-x 1 root root 32 Apr   6 18:24 ld-linux-x86-64.so.2.down -> /lib/x86_64-linux-gnu/ld-2.31.so

Thanks for your help.

-- 
Sent with https://mailfence.com  
Secure and private email