Previous Thread
Next Thread
Print Thread
Moving libash .so.1 symlinks to A-Shell bin directory #37510 23 Aug 24 02:00 PM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
We are working on a multi-tenant server setup. This will have each tenant under separate /vm directories structures with completely separate Linux user's and group's, so they have no access to any other tenant data.

One issue we have run into in designing this setup is the need for the A-shell symlinks to be under /usr/lib/. This prevents the tenants from using different versions of the libraries and posses possible permissions issues.

Jack suggested that moving them under the A-Shell bin directory might work without any changes, but I tested that last night and it did not work. I receive the unable to load library error for MySQL.


A-shell version: Debian 12 7.0.1760.0

Code
find  /var/data/kkvet/ashell/vm/miame/bin/ -iname '*.so.1' -ls
   307193      0 lrwxrwxrwx   1 ashusr_kkvet ashell_kkvet       57 Aug 22 20:50 /var/data/kkvet/ashell/vm/miame/bin/libxl.so.1 -> /var/data/kkvet/ashell/vm/miame/bin/libxl.so.4.2.0-x86_64
  3582624      4 lrwxrwxrwx   1 ashusr_kkvet ashell_kkvet       68 Aug 22 16:57 /var/data/kkvet/ashell/vm/miame/bin/libashnet.so.1 -> /var/data/kkvet/ashell/vm/miame/bin/libashnet.so.1.14.196-d12-x86_64
  3582628      4 lrwxrwxrwx   1 ashusr_kkvet ashell_kkvet       70 Aug 22 16:57 /var/data/kkvet/ashell/vm/miame/bin/libashmysql.so.1 -> /var/data/kkvet/ashell/vm/miame/bin/libashmysql8.so.1.6.149-d12-x86_64
  3582625      4 lrwxrwxrwx   1 ashusr_kkvet ashell_kkvet       67 Aug 22 16:57 /var/data/kkvet/ashell/vm/miame/bin/libashtls.so.1 -> /var/data/kkvet/ashell/vm/miame/bin/libashtls.so.1.3.217-d12-x86_64


The symlinks do work when in /usr/lib/.

Thanks.


Stephen Funkhouser
Diversified Data Solutions
Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37512 23 Aug 24 05:17 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
In theory, it should just be a matter of adding your /var/data/kkvet/ashell/vm/miame/bin directory to the /etc/ld.so.cache. The steps i went through:

1. Created a file /etc/ld.so.conf.d/ashell.conf to add your directory to the ld cache ...
Code
$ sudo ls -l /etc/ld.so.conf.d
-rw-r--r-- 1 root root  72 Aug 23 08:47 ashell.conf
-rw-r--r-- 1 root root  38 Mar 18  2023 fakeroot-x86_64-linux-gnu.conf
-rw-r--r-- 1 root root  44 Sep 22  2022 libc.conf
-rw-r--r-- 1 root root 100 Jan 23  2024 x86_64-linux-gnu.conf

$ sudo cat /etc/ld.so.conf.d/ashell.conf
/vm/miame/bin64


Note: I was using /vm/miame/bin64; you'd have to replace that with your /var/data/kkvet/ashell/vm/miame/bin directory. (And are you sure you want to use /bin instead of /bin64 ?)

2. Update the /etc/ld.so.cache file...
Code
$ sudo /usr/sbin/ldconfig 


3. Check if your directory is now in the cache ...
Code
$ sudo /usr/sbin/ldconfig -p | grep miame
        libxl.so (libc6,x86-64) => /vm/miame/bin64/libxl.so
        libashtls.so.1 (libc6,x86-64) => /vm/miame/bin64/libashtls.so.1
        libashodbc.so.1 (libc6,x86-64) => /vm/miame/bin64/libashodbc.so.1
        libashnet.so.1 (libc6,x86-64) => /vm/miame/bin64/libashnet.so.1
        libashmysql8.so.1 (libc6,x86-64) => /vm/miame/bin64/libashmysql8.so.1


4. Check that you don't have other links to those libraries.
Code
$ updatedb
$ locate libashnet.so
/vm/miame/bin64/libashnet.so.1
/vm/miame/bin64/libashnet.so.1.14.196-d12-x86_64


5. Test within A-Shell.

I had pretty quick success with the above procedure on libashnet and libxl. However, despite an hour of futzing around, I'm still unable to get libashmysql to load. (There seems to be some confusion and behind-the-scenes interaction between libashmysql and libashmysql8 that I haven't quite sorted out.)

Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37516 24 Aug 24 11:59 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
I decided to upgrade the dynamic library loading logic so that it first looks in the directory where the ashell executable was loaded from. That seems like the simplest solution, not only for your particular requirement, but probably for everyone (since it eliminates confusion over which library directories are in the path).

If that seems like a good solution to you, let me know and I'll post the updated version (probably 7.0.1762.0). In the meantime, I'll continue testing, and possibly addressing other outstanding issues.

Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37520 26 Aug 24 02:19 PM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
That sounds like the right solution.

Thank you!

Last edited by Stephen Funkhouser; 26 Aug 24 02:19 PM.

Stephen Funkhouser
Diversified Data Solutions
Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37523 26 Aug 24 04:02 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
I just posted a Debian 12 update that contains this logic if you want to test it...

ash-7.0.1762.0-d12-x86_64-upd.tz
ash70notes.txt

Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37525 26 Aug 24 05:43 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
Warning: I just ran into a segmentation fault in during some collection-related testing. So I suspect there is going to be another update of this soon.

Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37526 26 Aug 24 07:09 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
Ok, 7.0.1762.0 has been recalled and replaced by 1762.1 ...

ash-7.0.1762.1-d12-x86_64-upd.tz
ash70notes.txt

Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37530 27 Aug 24 07:27 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
I just noticed that the version resource in 7.0.1762.1 executable posted yesterday was still set to 1761.1. It doesn't affect any code operations, but does cause confusion (showing the wrong version in ashlog, in systat/v, etc.), so I recommend re-downloading it (from the same links shown above).

Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37532 27 Aug 24 08:58 PM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
This works under EL7 but not for Debian 12. I'm seeing the following on launch. This does not happen under 7.0.1760.0 i.e. it runs fine except for MySQL not loading from the bin directory.

Code
Linux dds-ashell 6.1.0-23-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.99-1 (2024-07
15) x86_64

This system is built by the Bento project by Chef Software
More information can be found at https://github.com/chef/bento

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Aug 27 15:49:42 2024 from 192.168.17.1
/var/data/kkvet/ashell/vm/miame/bin/ashell: error while loading shared librarie
: libpcre.so.3: cannot open shared object file: No such file or directory


Here are the symlinks in the bin directory.
Code
root@dds-ashell:/ansible# find  /var/data/kkvet/ashell/vm/miame/bin/ -type l -ls
   334291      0 lrwxrwxrwx   1 ashusr_kkvet ashell_kkvet       57 Aug 27 15:51 /var/data/kkvet/ashell/vm/miame/bin/libxl.so.1 -> /var/data/kkvet/ashell/vm/miame/bin/libxl.so.4.2.0-x86_64
   334289      4 lrwxrwxrwx   1 ashusr_kkvet ashell_kkvet       68 Aug 27 15:51 /var/data/kkvet/ashell/vm/miame/bin/libashnet.so.1 -> /var/data/kkvet/ashell/vm/miame/bin/libashnet.so.1.14.196-d12-x86_64
   334288      4 lrwxrwxrwx   1 ashusr_kkvet ashell_kkvet       70 Aug 27 15:51 /var/data/kkvet/ashell/vm/miame/bin/libashmysql.so.1 -> /var/data/kkvet/ashell/vm/miame/bin/libashmysql8.so.1.6.149-d12-x86_64
   334290      4 lrwxrwxrwx   1 ashusr_kkvet ashell_kkvet       67 Aug 27 15:51 /var/data/kkvet/ashell/vm/miame/bin/libashtls.so.1 -> /var/data/kkvet/ashell/vm/miame/bin/libashtls.so.1.3.217-d12-x86_64


Last edited by Stephen Funkhouser; 27 Aug 24 09:34 PM.

Stephen Funkhouser
Diversified Data Solutions
Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37533 27 Aug 24 11:45 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
Hmmm....

I suspect we have something else interfering with the proper load of the library. Did you try ldd libashmysql.so.1 to make sure all its dependencies are present?

Also, although I don't think it is related, I see you are missing the libpcre.so.3 library.

Reviewing my setup...

Code
$ cd /vm/repo/70/70core/bin64
ls -l libashmysql.so.1
lrwxrwxrwx 1 root root       59 Aug 24 16:55 libashmysql.so.1 -> /vm/repo/70/70core/bin64/libashmysql8.so.1.6.149-d12-x86_64

$ sudo updatedb
$ locate libashmysql.so.1
/vm/repo/70/70core/bin64/libashmysql.so.1

So there's only one libashmysql.so.1 file on the system, pointing to the actual library. And that directory is definitely not in the /etc/ld.so.cache.
And if I run the SQLTEST1 program, it reports success:
Code
SQLTEST1 - Verify existence of A-Shell/SQL connector and database client library

Warning: Minimum connector version for this A-Shell version is 1.3
(Earlier connectors may be too incompatible to even report their version)

Select database connector (1=MySQL,2=ODBC) [1] 1

Using connector MySQL (native)
Loading connector and client library...
 [Setting SQLCONF_TRACE]
 [OK]
Initializing connection handle...       [OK]
Client database library version:        8.4.0

A-Shell/SQL connector and DBMS client library successfully loaded

Connector ID (lib name)                 LIBASHMYSQL
Connector Version                       1601490 (1.6.149.0)
Connector Description:                  MySQL 8.0 (native)

Have you tried accessing the libashnet or libxl libraries?

I'm not sure I'm following your statement about it working fine under 7.0.1760.0 except for not loading the library. Isn't that the issue we're trying to solve?

Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37534 27 Aug 24 11:58 PM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
Ashell is dying immediately upon launch. When I downgrade to 7.0.1760.0 ashell runs. The only problem with 7.0.1760.0 is that it doesn't load the MySQL library, where 7.0.1762.1 ashell just dies. There's no difference in config other than the ashell executable.

ldd for the symlinks is good.

Sorry I thought you would know that ashell was dying, my bad for assuming you're a mind reader


Stephen Funkhouser
Diversified Data Solutions
Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37536 28 Aug 24 12:07 AM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
I guess I did see the error message about the missing libpcre...
Code
/var/data/kkvet/ashell/vm/miame/bin/ashell: error while loading shared librarie
: libpcre.so.3: cannot open shared object file: No such file or directory

That presumably is why it's crashing, but that doesn't explain why the earlier version works. The interesting thing is that A-Shell is not explicitly loading libpcre on-demand (like it does with the libash... libraries). So it wasn't affected by the latest change to the on-demand library loading search logic.

Perhaps running ldd on both versions might help clarify something? Mine both (1760.0 and 1762.1) look identical:
Code
jack@debian12:/vm/repo/70/70core/bin64$ ldd ashell
        linux-vdso.so.1 (0x00007ffe35af2000)
        libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f14d9936000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f14d98be000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f14d9200000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f14d9521000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f14d989e000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f14d901f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f14d997e000)

It seems that somehow you've broken your libpcre.so.3 link?

Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37537 28 Aug 24 01:11 AM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
Here you go 7.0.1762.1
Code
root@dds-ashell:/ansible# ldd /var/data/kkvet/ashell/vm/miame/bin/ashell
        linux-vdso.so.1 (0x00007ffe79541000)
        libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007fe5bd3bd000)
        libpcre.so.3 => not found
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fe5bcc00000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe5bd2de000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fe5bd2be000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe5bce1f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe5bd3f9000)


Here is 7.0.1760.0 with no reference to libpcre3
Code
root@dds-ashell:/ansible# ldd /var/data/kkvet/ashell/vm/miame/bin/ashell
        linux-vdso.so.1 (0x00007ffc2a7b0000)
        libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f4789dcd000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f4789a00000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4789cee000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f478a080000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f478981f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f478a0a9000)



After installing libpcre3 it runs. Will have to test MySQL tomorrow.

Last edited by Stephen Funkhouser; 28 Aug 24 01:13 AM.

Stephen Funkhouser
Diversified Data Solutions
Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37538 28 Aug 24 04:56 AM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
Something very mysterious about your 7.0.1760.0 version (with no libpcre reference). Mine looks just like the 7.0.1762.1 version. Although I can compile it without pcre (regex) support, I virtually never do because regular expressions have become nearly ubiquitous.

Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37539 28 Aug 24 02:50 PM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
MySQL works with the symlink in the bin directory.

That is odd. I have no idea how much of our code would work without regex.

I'm glad to get to the bottom of this one.


Stephen Funkhouser
Diversified Data Solutions
Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37540 28 Aug 24 03:38 PM
Joined: Jun 2001
Posts: 11,794
J
Jack McGregor Offline
Member
Offline
Member
J
Joined: Jun 2001
Posts: 11,794
I think I've solved the mystery. I noticed that the ash-7.0.1760.0-d12-x86_64-upd.tz posted on our download site was larger than the one I had saved in my Debian 12 VM. When I downloaded it and ran ldd on it, sure enough, it looks like your version (with no mention of libpcre). Yet regex expressions clearly work.

Then I renamed the /usr/lib/x86_64-linux-gnu/libpcre.so.3 symlink to the dynamic library and relinked the latest ashell executable, producing a 1762.1 version like your 1760.0 without an apparent dependency on libpcre. Yet regex expressions seem to work just fine.

Running nm ashell | grep pcre | more confirms that there is an entire set of pcre_xxx functions static linked into the ashell executable now (explaining why it all works).

So apparently when I first linked the 1760.0 version, I didn't have the libpcre.so.3 dynamic library installed yet and didn't realize it. Later I must have installed it (possibly indirectly as part of another package) and then rebuilt my 1760.0 version without realizing that it was now different than the one posted online. My mistake!

Since static-linking the library doesn't add that much to the executable size (less than 50K out of 2.5M, about 2%), I may just decide to stick with static linking as it eliminates another installation obstacle. (And it's hard to imagine a fully functioning A-Shell environment not using regex expressions in at least some way, however indirectly it may be.) But now that you've got the dynamic library installed, I'm not sure there's any advantage to you to switch back now, unless you expect to be repeating this exercise on multiple VMs.

Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37541 28 Aug 24 06:21 PM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
We perform these exercises all the time, but they're completely scripted. So, not too much benefit for us.

Glad you got to the bottom of how it wasn't dynamically linked.

Last edited by Stephen Funkhouser; 28 Aug 24 06:22 PM.

Stephen Funkhouser
Diversified Data Solutions
Re: Moving libash .so.1 symlinks to A-Shell bin directory [Re: Stephen Funkhouser] #37655 14 Nov 24 01:14 PM
Joined: Nov 2006
Posts: 2,223
S
Stephen Funkhouser Offline OP
Member
OP Offline
Member
S
Joined: Nov 2006
Posts: 2,223
There was an issue where A-Shell was not checking for libashtls.so in the directory where the ashell executable was loaded from. This is resolve with 7.0.1765.1.


Stephen Funkhouser
Diversified Data Solutions

Moderated by  Jack McGregor, Ty Griffin 

Powered by UBB.threads™ PHP Forum Software 7.7.3