# Gentoo, Helix, NPTL & LinuxThreads

## Crispy Beef

One of my clients runs a few Gentoo web servers in the normal configuration (Apache, MySQL, PHP etc.).  They're pretty upto date with the latest software; specifically running with glibc 2.4.  This is where the problem starts, they recently decided that they wanted to offer movies to customers using the Helix DRM solution which entails installing the Helix DRM License Server.  No problem there apart from it wanting to use the old LinuxThreads and not NPTL.  I've confirmed this with tech support, there is a version in the pipeline that updates it all but not yet.

So, in the meantime I need to get the DRM server running.  The problem is downgrading to glibc 2.3.6 and then the whole system is a major pain and likely to break lots of things.  So, what do I do?

Running a jail I assume wouldn't work as that will still be using the latest libraries etc.  Aside from rigging a stop-gap machine I'm at a bit of a loss, any thoughts or ideas (aside from slapping my client for wanting DRM)?  :Wink: 

----------

## drjimmy42

Have you tried slapping them in the face for wanting to use LinuxThreads?  Its been a while since the world moved on to NPTL.  Is there a good reason they aren't on the band wagon?

----------

## Crispy Beef

 *drjimmy42 wrote:*   

> Have you tried slapping them in the face for wanting to use LinuxThreads?  Its been a while since the world moved on to NPTL.  Is there a good reason they aren't on the band wagon?

 

It's the Helix License server, apparently it's still using LinuxThreads and a new NPTL version is in the pipeline, however that doesn't help me now.  :Sad:   I guess I'll have to rig a temporary box to get this working as I don't want to downgrade from glibc 2.4 to get this working, far too much hassle.

----------

## kashani

heh, welcome to the mess that is Real. 

IIRC the upcoming glibc 2.5, in portage, has linuxthreads again. It might be possible to go backwards by going forward.  :Smile: 

kashani

----------

## Crispy Beef

 *kashani wrote:*   

> heh, welcome to the mess that is Real. 
> 
> IIRC the upcoming glibc 2.5, in portage, has linuxthreads again. It might be possible to go backwards by going forward. 
> 
> kashani

 

Cool, will keep an eye on that.  I assume that's either masked or under ~ at the mo?

----------

## richfish

 *Crispy Beef wrote:*   

> Running a jail I assume wouldn't work as that will still be using the latest libraries etc. 
> 
> 

 

Maybe not a jail, but an LD_LIBRARY_PATH trick might work.

My idea would be to build a binary package of glibc-2.4 version with linuxthreads:

USE="-nptl -nptlonly" emerge --buildpkgonly 'sys-libs/glibc-2.4*'

This should give a binary .tbz2 of the older glibc version.  Now you can create a directory....say /usr/lib-linuxthreads, and extract the necessary libraries to there:

mkdir /usr/lib-linuxthreads

cd /usr/lib-linuxthreads

tar -xjf /usr/portage/packages/All/glibc-2.4*.tbz2 --wildcards './lib/lib*.so'

# some fixup of the directory structure

mv ./lib/* . && rmdir ./lib

So then you could start the server with:

LD_LIBRARY_PATH=/usr/lib-linuxthreads command_to_start_helix

I haven't really tried this, and I've probably missed a library or two in the extraction above, but hopefully this gives you an idea of a possible workaround.

----------

## Crispy Beef

@richfish

That's a cool idea, I'm actually giving glibc-2.5 a go on a test box at the moment and it seems to be compiling ok.  I do like your idea though as it will be at least using what are deemed to be stable libraries.  Might well give that a go later today, thanks.  :Smile: 

----------

## Crispy Beef

 *richfish wrote:*   

> tar -xjf /usr/portage/packages/All/glibc-2.4*.tbz2 --wildcards './lib/lib*.so'

 

I've not really used the --wildcards switch for tar before but from what I can tell from the man page that part of the command should exclude anything with start with 'lib and ending in '.so'.  Why do we need to ditch the .so files are they all just symlinks?

----------

## Crispy Beef

Hmmmm, ok.  I've had the server working ok under glibc2.5 with -nptlonly switch off so at least I know I can get it running.  However I'm not overly keen of have something from ~ on a production server, so I gave the other method a shot.

Here's the output from ldd on the executable:

```
# ldd ./licserver

linux-gate.so.1 =>  (0xffffe000)

libdl.so.2 => /lib/libdl.so.2 (0xb7f6f000)

libc.so.6 => /lib/libc.so.6 (0xb7e57000)

/lib/ld-linux.so.2 (0xb7f79000)
```

Here's the directory listing for my alternative glbic 2.5 package compile with -nptl and -nptlonly, I tried creating symlinks so the correct libraries from the ldd output are picked up but this just results in a segfault.

```
# ls -l

total 2072

-rwxr-xr-x 1 root root    5580 Dec 10 16:28 libBrokenLocale-2.5.so

-rwxr-xr-x 1 root root   13836 Dec 10 16:28 libSegFault.so

-rwxr-xr-x 1 root root   10240 Dec 10 16:28 libanl-2.5.so

-rwxr-xr-x 1 root root 1172580 Dec 10 16:28 libc-2.5.so

-rwxr-xr-x 1 root root  182116 Dec 10 16:28 libcidn-2.5.so

-rwxr-xr-x 1 root root   22196 Dec 10 16:28 libcrypt-2.5.so

-rwxr-xr-x 1 root root   10192 Dec 10 16:28 libdl-2.5.so

-rwxr-xr-x 1 root root  151212 Dec 10 16:28 libm-2.5.so

-rwxr-xr-x 1 root root   13884 Dec 10 16:28 libmemusage.so

-rwxr-xr-x 1 root root   72916 Dec 10 16:28 libnsl-2.5.so

-rwxr-xr-x 1 root root   26588 Dec 10 16:28 libnss_compat-2.5.so

-rwxr-xr-x 1 root root   18096 Dec 10 16:28 libnss_dns-2.5.so

-rwxr-xr-x 1 root root   34856 Dec 10 16:28 libnss_files-2.5.so

-rwxr-xr-x 1 root root   18216 Dec 10 16:28 libnss_hesiod-2.5.so

-rwxr-xr-x 1 root root   34964 Dec 10 16:28 libnss_nis-2.5.so

-rwxr-xr-x 1 root root   43108 Dec 10 16:28 libnss_nisplus-2.5.so

-rwxr-xr-x 1 root root    5588 Dec 10 16:28 libpcprofile.so

-rwxr-xr-x 1 root root   82598 Dec 10 16:27 libpthread-0.10.so

-rwxr-xr-x 1 root root   59932 Dec 10 16:28 libresolv-2.5.so

-rwxr-xr-x 1 root root   36232 Dec 10 16:28 librt-2.5.so

-rwxr-xr-x 1 root root   25649 Dec 10 16:28 libthread_db-1.0.so

-rwxr-xr-x 1 root root   10024 Dec 10 16:28 libutil-2.5.so
```

----------

## richfish

 *Crispy Beef wrote:*   

> Here's the directory listing for my alternative glbic 2.5 package compile with -nptl and -nptlonly, I tried creating symlinks so the correct libraries from the ldd output are picked up but this just results in a segfault.
> 
> 

 

Ok, one other trick to share I guess.  You can see what libraries are actually being loaded with strace.

strace -E LD_LIBRARY_PATH=whatever -e open ./licserver

This should help determine if you missed one or not.  But then again, if it is working with the ~arch glibc, I'd might just go with that....hey, they *asked* for it by wanting DRM, right??  :Wink: 

----------

