Home > OS >  'cannot open shared object file' with OpenOnload
'cannot open shared object file' with OpenOnload

Time:03-05

I have built and installed https://github.com/Xilinx-CNS/onload shared lib.

Then I am trying: onload ping 8.8.8.8

Got this error:


    ERROR: ld.so: object 'libonload.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. 
    PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=110 time=29.2 ms

But it works with sudo onl oad ping 8.8.8.8:

    oo:ping[724989]: netif_tcp_helper_alloc_u: ENODEV. This error can occur if:
     - no Solarflare network interfaces are active/UP, or they are running    packed stream firmware or are disabled, and
     - there are no AF_XDP interfaces registered with sfc_resource Please check your configuration.
     PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=110 time=50.4 ms

Can someone help me, how I can achieve this command working without sudo? For example, onload nc -l $PORT works without sudo, but ping do not.

Some debug information:

sudo find / -name libonload.so:

/usr/lib/x86_64-linux-gnu/libonload.so

cat /etc/ld.so.conf

include /etc/ld.so.conf.d/*.conf

cat /etc/ld.so.conf.d/*.conf

/usr/lib/x86_64-linux-gnu/libfakeroot 
/usr/local/lib 
/usr/local/lib/x86_64-linux-gnu 
/lib/x86_64-linux-gnu  
/usr/lib/x86_64-linux-gnu 
/lib32  
/usr/lib32

sudo ldconfig -v:

... 
/usr/lib/x86_64-linux-gnu/libfakeroot:  
    libfakeroot-0.so -> libfakeroot-tcp.so 
/usr/local/lib: 
/lib/x86_64-linux-gnu:
    ...
    libonload_ext.so.2 -> libonload_ext.so.2.0.0 
    libonload.so -> libonload.so
    ...
...

ls -l /usr/lib/x86_64-linux-gnu | grep onl oad

-rwxr-xr-x  1 root root   9528312 Mar  3 01:17 libonload.so
-rw-r--r--  1 root root    106222 Mar  3 01:17 libonload_ext.a 
lrwxrwxrwx  1 root root        18 Mar  3 01:17 libonload_ext.so -> libonload_ext.so.2 
lrwxrwxrwx  1 root root        22 Mar  3 01:17 libonload_ext.so.2 -> libonload_ext.so.2.0.0
-rwxr-xr-x  1 root root     31344 Mar  3 01:17 libonload_ext.so.2.0.0

ls -l /lib/x86_64-linux-gnu | grep onl oad

-rwxr-xr-x  1 root root   9528312 Mar  3 01:17 libonload.so
-rw-r--r--  1 root root    106222 Mar  3 01:17 libonload_ext.a 
lrwxrwxrwx  1 root root        18 Mar  3 01:17 libonload_ext.so -> libonload_ext.so.2
lrwxrwxrwx  1 root root        22 Mar  3 01:17 libonload_ext.so.2 -> libonload_ext.so.2.0.0
-rwxr-xr-x  1 root root     31344 Mar  3 01:17 libonload_ext.so.2.0.0

/lib$ ls -l | grep x86_64-linux-gnu

drwxr-xr-x 35 root root  36864 Mar  3 01:17 x86_64-linux-gnu

/usr/lib$ ls -l | grep x86_64-linux-gnu

drwxr-xr-x 35 root root  36864 Mar  3 01:17 x86_64-linux-gnu

CodePudding user response:

The most likely reason is the ping application uses setuid but the onl oad library isn't installed with that. Running ping will effectively promote the application to root user to allow the creation of a raw socket but the library will be loaded as the regular user and so it can't be used. Running as the root user avoids this since the library is loaded as the root user to start with.

I don't think GitHub version of onl oad supports loading with setuid for the onl oad library but you can set this yourself using chmod s <libpath>. It's worth pointing out that ping isn't accelerated by onl oad since the library will only accelerate UDP and TCP socket and pipes so you wouldn't see any benefit from this.

  • Related