site  contact  subhomenews

Fix library paths for ROX-Filer running in container

May 03, 2021 — BarryK

While trying to fix wallpaper corruption when run Racy in a container, I made another discovery about broken locale, fixed and posted about this morning:

https://bkhome.org/news/202105/locale-fixed-in-containers.html

Continuing to track down the wallpaper problem, I see also some icons are not rendering properly. Comparing XenialPup and Racy, the former renders wallpaper and icons perfectly.

Very odd, but then I discovered that in Racy, when right-clicked on an image file and chose to run Viewnior (image viewer), it did not run. Yet, launching "# viewnior <name of image>" in terminal, it did work.

Connecting the dots, I realised that the problem occurs if the distro-in-container has different paths to shared library files than the host distro. Racy is ancient and still has many library files in /usr/X11R7/lib. Rox is not seeing those.

Other applications are seeing them, just not rox. Hmmm...

Not sure why this is happening, however, have implemented a fix. /usr/local/easy_containers/ec-chroot switches into the container at this line:

 DISPLAY=${ecDISPLAY} ${NETNSexe} pflask ${FLDR} ${ENVI} ${NS} ${SND} ${CAPS} --no-userns \
--chroot=${CONTAINER} -- ${ZEUS} /.control/ec-run ${EXE} ${@}

What it does is after chrooting into the container, /.control/ec-run is executed, which is a script that does a bit of setting up, then launches $EXE (which in this case is a script named 'racy' that launches the desktop).

Reading this, you may be thinking that it seems complicated, but it does all hold together logically. It did of course, grow over time. The basic structure of Easy Containers was plotted over a couple of months, but has been refined and expanded over a couple of years. Anyway, following the essential point of this post...

'ec-run' is created by /usr/local/easy_containers/start-container, and the bold text shows 'ec-run' with code that I have now added:

#!/bin/sh
#this script generated by /usr/local/easy_containers/start-container

#20210503 rox has a problem, seems cannot find proper path to shared libraries, if different from host...
if [ -f /etc/ld.so.conf ];then
LD_LIBRARY_PATH="$(busybox cat /etc/ld.so.conf | busybox tr '\n' ':' | busybox sed -e 's%:$%%')"
export LD_LIBRARY_PATH
fi

MOUNTS="$(busybox mount 2>/dev/null)"
if [ "$(echo "$MOUNTS" | grep '/proc ')" == "" ];then
busybox mount -o hidepid=1 -t proc proc /proc #20210407
MOUNTS="$(busybox mount)"
fi
[ "$(echo "$MOUNTS" | grep '/tmp ')" == "" ] && busybox mount -t tmpfs tmpfs /tmp 2>/dev/null
[ "$(echo "$MOUNTS" | grep '/shm ')" == "" ] && busybox mount -t tmpfs shmfs /dev/shm
[ "$(echo "$MOUNTS" | grep '/pts ')" == "" ] && busybox mount -t devpts -o newinstance devpts /dev/pts
[ "$(echo "$MOUNTS" | grep '/sys ')" == "" ] && busybox mount -t sysfs none /sys
EXE="$1"; shift
PATH="/.control:${PATH}" xEXE="$(which $EXE)" #so will fallback to executing $@ if $EXE not exist.
if [ "$EC_CAP_DROP" ];then #180427
capsh --drop=${EC_CAP_DROP} -- -c "${xEXE} ${@}" > /tmp/xerrors-${EXE}.log 2>&1
else
${xEXE} ${@} > /tmp/xerrors-${EXE}.log 2>&1
fi

That has done the trick, Racy desktop now starts, no image corruption and right-click on an image file can open it in viewnior.

Note, in EasyOS, LD_LIBRARY_PATH is not used, and is unset. It still works however, and it can be used to override or add onto the recognised library paths. Which is what I have done.

Note, there is one issue with that script, that will have to be addressed in the future. It is assuming the presence of busybox, which will be the case with the Puppy-derivatives but not necessarily other distributions.
Taking off the "busybox" prefixes should be ok, will consider that for the future.

There is still a problem with Racy -- the SeaMonkey browser is too old. Will consider that next.

EDIT 2021-05-04:
No, corrupted wallpaper and icons not fixed by setting LD_LIBRARY_PATH. It fixes launching an app, such as viewnior, from ROX only. I thought it was fixed, because sometimes start Racy and wallpaper OK, but sometimes not. It is very odd.
 

EDIT 2021-05-04:
There may also be .conf files in folder /etc/ld.so.conf.d, so the above code shown in bold has been changed to read those also.
 

Tags: easy