Skip to content

Instantly share code, notes, and snippets.

@carueda
Created September 4, 2023 22:45
Show Gist options
  • Save carueda/e4e44aabc5db2bd14a41f771d15faa11 to your computer and use it in GitHub Desktop.
Save carueda/e4e44aabc5db2bd14a41f771d15faa11 to your computer and use it in GitHub Desktop.

Exercising the MB-System dockerized execution (after a long while)

OS: macOS Ventura 12.3.1 – Intel

$ brew install socat

Using the (unchanged) /mbsystem.sh script in the repo, which still has MBSYSTEM_IMAGE=mbari/mbsystem:5.7.6beta37, as way to test things with one of the previous working images:

$ ./mbsystem.sh -L
::: OSTYPE=darwin22
::: Running as user 1022
::: Mounting /Users/carueda/github/mbari-org/MB-System/docker/user as /opt/MBSWorkDir in container
::: Mounting /Users/carueda/.mbsystem.bash_history as /opt/mbsystem.bash_history in container
::: socat PID=47231
10.0.0.246 being added to access control list
::: Starting container 'mbsystem-bash'
::: Running: docker run -it --name mbsystem-bash --user 1022 -v /Users/carueda/github/mbari-org/MB-System/docker/user:/opt/MBSWorkDir -v /Users/carueda/.mbsystem.bash_history:/opt/mbsystem.bash_history -e DISPLAY mbari/mbsystem:5.7.6beta37 bash

Unable to find image 'mbari/mbsystem:5.7.6beta37' locally
5.7.6beta37: Pulling from mbari/mbsystem
ab5ef0e58194: Pull complete
37cd1160c2ff: Pull complete
418bb9b64c52: Pull complete
cee9b14da639: Pull complete
cb70efeb0bb1: Pull complete
ced5f26bd0fc: Pull complete
6306c31894e1: Pull complete
05defd1ec313: Pull complete
8abf9ee4efec: Pull complete
a80aadab0a21: Pull complete
Digest: sha256:05c30ce59ceacd2c9414def3bf456411ea90bf613d294e57d30a5d0a9c020b5d
Status: Downloaded newer image for mbari/mbsystem:5.7.6beta37
bash-4.2$ mb
mb7k2jstar             mbctdlist              mbgrdviz               mbm_bpr                mbm_makedatalist       mbmakeplatform         mbrollbias             mbsvplist
mb7k2ss                mbdatalist             mbgrid                 mbm_copy               mbm_makesvp            mbminirovnav           mbrolltimelag          mbswplspreprocess
mb7kpreprocess         mbdefaults             mbhistogram            mbm_grd2arc            mbm_multicopy          mbmosaic               mbroutetime            mbtime
mbabsorption           mbdumpesf              mbhsdump               mbm_grd2geovrml        mbm_multidatalist      mbnavadjust            mbrphsbias             mbvelocitytool
mbareaclean            mbedit                 mbhysweeppreprocess    mbm_grd3dplot          mbm_multiprocess       mbnavadjustmerge       mbsegygrid             mbvoxelclean
mbauvloglist           mbeditviz              mbinfo                 mbm_grdcut             mbm_plot               mbnavedit              mbsegyinfo
mbauvnavusbl           mbextractsegy          mbinsreprocess         mbm_grdinfo            mbm_route2mission      mbnavlist              mbsegylist
mbbackangle            mbfilter               mbkongsbergpreprocess  mbm_grdplot            mbm_stat               mbneptune2esf          mbsegypsd
mbclean                mbformat               mblevitus              mbm_grdtiff            mbm_utm                mbotps                 mbset
mbconfig               mbgetesf               mblist                 mbm_grid               mbm_xbt                mbpreprocess           mbsslayout
mbcopy                 mbgpstide              mbm_arc2grd            mbm_histplot           mbm_xyplot             mbprocess              mbstripnan
bash-4.2$ mbgrdviz -h

Program MBgrdviz
MB-system Version 5.7.6beta37

MBgrdviz provides simple interactive 2D/3Dvizualization of GMT grids.

Usage: mbgrdviz [-Igrdfile -T -V -H]
bash-4.2$

However, mbgrdviz -I ZTopo.grd is now failing:

$ ./mbsystem.sh -L -f
::: OSTYPE=darwin22
::: Forcing new container mbsystem-bash because of -f
mbsystem-bash
::: Running as user 1022
::: Mounting /Users/carueda/github/mbari-org/MB-System/docker/user as /opt/MBSWorkDir in container
::: Mounting /Users/carueda/.mbsystem.bash_history as /opt/mbsystem.bash_history in container
::: socat PID=5253
10.0.0.246 being added to access control list
::: Starting container 'mbsystem-bash'
::: Running: docker run -it --name mbsystem-bash --user 1022 -v /Users/carueda/github/mbari-org/MB-System/docker/user:/opt/MBSWorkDir -v /Users/carueda/.mbsystem.bash_history:/opt/mbsystem.bash_history -e DISPLAY mbari/mbsystem:5.7.6beta37 bash

bash-4.2$ mbgrdviz -I ZTopo.grd
libGL: OpenDriver: trying /usr/lib64/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/swrast_dri.so
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file //.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file //.drirc: No such file or directory.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  149 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  2572
  Current serial number in output stream:  2573
bash-4.2$

The error looks similar to the one reported in the mailing list.


Let's try a few things:

Updated Quartz (to XQuartz 2.8.2 (xorg-server 1.20.14)), restarted computer, but no luck.


Updated launch script to use latest image, MBSYSTEM_IMAGE=mbari/mbsystem:latest, which at this point is from Jun 7, 2023, and with MB-system reporting version 5.7.9beta53:

bash-4.2$ mbgrdviz -v

Program MBgrdviz
MB-system Version 5.7.9beta53

... still no luck:

bash-4.2$ mbgrdviz -I ZTopo.grd
Geographic grid bounds: -121.948195 -121.934953 36.692562 36.701429   Longitude scaling: 0.00001119 m/deg  Latitude scaling: 0.00000901 m/deg
libGL: OpenDriver: trying /usr/lib64/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/swrast_dri.so
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file //.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file //.drirc: No such file or directory.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  149 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  2572
  Current serial number in output stream:  2573
bash-4.2$

Then I noted there's a new Alpine based Dockerfile: https://github.com/dwcaress/MB-System/blob/83351170371f6714b8c49b104b833b64bc901254/ChangeLog.md?plain=1#L445-L447

I tried it on my macOS (with the image built without issue), but got pretty similar error:

/opt/MBSWorkDir # mbgrdviz -v

Program MBgrdviz
MB-system Version 5.7.9beta58

/opt/MBSWorkDir # mbgrdviz -I ZTopo.grd
Geographic grid bounds: -121.948195 -121.934953 36.692562 36.701429   Longitude scaling: 0.00001119 m/deg  Latitude scaling: 0.00000901 m/deg
libGL: MESA-LOADER: dlopen(/usr/lib/xorg/modules/dri/swrast_dri.so)
libGL: did not find extension DRI_Kopper version 1
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /root/.drirc: No such file or directory.
libGL: did not find extension DRI2_Flush version 1
libGL: Disabling server's aux buffer support
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
function is no-op
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  149 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  1455
  Current serial number in output stream:  1456
/opt/MBSWorkDir #

I retried with things like:

apk add --no-cache mesa-dri-gallium
apk add --no-cache mesa-gl
apk add --no-cache meson

But no luck.

The alpine release note indicates "works on macOS 12 monterey". Maybe changes in macOS Venture and Big Sur (as reported in mailing list) are causing the issues(?).

--

Some findings:

image

I had tried Dave's suggestion from 2020:

defaults write org.macosforge.xquartz.X11 enable_iglx -bool true

But seems like it is now:

defaults write org.xquartz.X11 enable_iglx -bool YES

which seems to have done the trick.

In summary:

  • Updated Quartz to XQuartz 2.8.2 (xorg-server 1.20.14). (previously 2.8.0 on my system)

    defaults write org.xquartz.X11 enable_iglx -bool YES
    
  • Created docker image using Kent's Dockerfile:

    cd docker/alpine
    docker build -t "mbari/mbsystem-alpine:0.0.0"
    
  • Edited mbsystem.sh to indicate:

     MBSYSTEM_IMAGE=mbari/mbsystem-alpine:0.0.0
     RUNNING_USER=root
    
  • I have ZTopo.grd on my local, current directory

  • Launched container:

./mbsystem.sh -L -f sh
:: OSTYPE=darwin22
::: Forcing new container mbsystem-sh because of -f
mbsystem-sh
::: Running as user root
::: Mounting /Users/carueda/github/mbari-org/MB-System/docker/user as /opt/MBSWorkDir in container
::: Mounting /Users/carueda/.mbsystem.bash_history as /opt/mbsystem.bash_history in container
::: socat PID=9849
10.0.0.246 being added to access control list
::: Starting container 'mbsystem-sh'
::: Running: docker run -it --name mbsystem-sh --user root -v /Users/carueda/github/mbari-org/MB-System/docker/user:/opt/MBSWorkDir -v /Users/carueda/.mbsystem.bash_history:/opt/mbsystem.bash_history -e DISPLAY mbari/mbsystem-alpine:0.0.0 sh

(note: the alpine based image does not have a default entry point, and does not have bash.)

  • Executed mbgrdviz -I ZTopo.grd:
/ # cd /opt/MBSWorkDir/
/opt/MBSWorkDir # mbgrdviz -I ZTopo.grd
Geographic grid bounds: -121.948195 -121.934953 36.692562 36.701429   Longitude scaling: 0.00001119 m/deg  Latitude scaling: 0.00000901 m/deg
libGL error: MESA-LOADER: failed to open swrast: Error loading shared library /usr/lib/xorg/modules/dri/swrast_dri.so: No such file or directory (search paths /usr/lib/xorg/modules/dri, suffix _dri)
libGL error: failed to load driver: swrast

Result as shown in screenshot above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment