using Podman with Distrobox and Debian stable
Podman is similar to Docker - it is a daemonless engine designed to run containers.
Distrobox is a wrapper (collection of scripts) to tightly integrate Podman containers with your host OS.
tl;dr this basically sets up MATLAB within a Debian inside a container and forwards the GUI windows to the host. Thanks to Distrobox, we also share the home directory, and can thus smoothly work within directory of the host OS.
But why?
This is necessary because MATLAB is not officially supported under Arch and has had plenty of issues recently with rolling-release distros like Arch updating system libraries, breaking MATLAB. This is tedious when you open MATLAB on a random weekday trying to be productive and get thrown on a 3 hour rabbithole track trying to fix stuff unexpectedly...
Keep in mind that a combination of fresh and stale packages on an Arch system can be iffy. Always make sure your system has recently seen updates through pacman -Syu before installing new packages...
sudo pacman -S distrobox podman
this sets up a working Debian and calls the container matlab-env.
distrobox create -i debian:stable -n matlab-env
this launches the container and drops you inside in a shell
distrobox enter matlab-env
take the opportunity to check if everything is current:
sudo apt update && sudo apt upgrade -y
inside the container, first install the required packages to run MATLAB without issues. This list is taken from here (Mathworks' git repository containing the Dockerfiles for their ubuntu releases)
sudo apt update && sudo apt install -y ca-certificates debianutils ibverbs-providers libasound2t64 libatk-bridge2.0-0t64 libatk1.0-0t64 libatomic1 libatspi2.0-0t64 libboost-atomic1.83.0 libboost-chrono1.83.0t64 libboost-date-time1.83.0 libboost-filesystem1.83.0 libboost-log1.83.0 libboost-program-options1.83.0 libboost-regex1.83.0 libboost-system1.83.0 libboost-thread1.83.0 libc6 libcairo-gobject2 libcairo2 libcap2 libcrypt1 libcups2t64 libfontconfig1 libfribidi0 libgbm1 libgdk-pixbuf-2.0-0 libgl1 libglib2.0-0t64 libglx0 libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 libgtk-3-0t64 libhidapi-libusb0 libibverbs1 libice6 libmosquitto1 libmosquittopp1 libnspr4 libnss3 libnuma1 libopengl0 libpam0g libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpixman-1-0 libpsm2-2 librdmacm1t64 libsndfile1 libtirpc3t64 libucx0 libudev1 libuhd4.8.0-dpdk libuuid1 libxcomposite1 libxcursor1 libxdamage1 libxfixes3 libxfont2 libxft2 libxinerama1 libxrandr2 libxt6t64 libxtst6 libxxf86vm1 locales locales-all make net-tools procps sudo unzip x11-xkb-utils zlib1g wget
the following additional packages were suggested in older threads on reddit - feel free to install them (I did).
sudo apt update && sudo apt install -y libdbus-1-3 libfreetype6 libgcc-s1 libglx-mesa0 libglu1-mesa libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxext6 libxi6 libxrender1 chromium
there are multiple ways to install MATLAB under Linux. The most comfortable one is through their GUI installer, so we will stick to that:
Matlab can be downloaded from here. Unpack the Installer in a folder you can access from within the container and launch the installer:
sudo -H ./install
You can use distrobox-export (from inside the container) to give your host OS an executable through which to launch matlab inside the distrobox container:
distrobox-export --bin /usr/local/bin/matlab --export-path ~/.local/bin
If you did not create the matlab symlink during installation, use
distrobox-export --bin /usr/local/MATLAB/R2026a/bin/matlab --export-path ~/.local/bin
from within the container, copy the matlab icon into your host os icon folder, which is reachable through /run/host/:
sudo cp /usr/local/MATLAB/R2026a/bin/glnxa64/cef_resources/matlab_icon.png /run/host/usr/share/icons/
on your host os, create an empty file at ~/.local/share/applications/matlab.desktop
and fill it with
[Desktop Entry]
Categories=Development;Math;Science
Comment=Scientific computing environment
Exec=~/.local/bin/matlab -desktop -useStartupFolderPref
Icon=/usr/share/icons/matlab_icon.png
MimeType=text/x-matlab
Name=MATLAB R2026a
NoDisplay=false
Path=
PrefersNonDefaultGPU=false
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
I want to express my gratitude, I have spent way too much time trying to get matlab to work on arch. Your guide worked flawlessly. Many many thanks.
Some side notes:
The downloaded matlab zip has to be extracted with the flags below. When unzipping with e.g KDEs Ark GUI the installer will not start.
sudo cp /usr/local/MATLAB/R2026a/bin/glnxa64/cef_resources/matlab_icon.png /run/host/usr/share/icons/did not work for me (Permission denied). I am new to distrobox, no idea if there is something i did wrong there. My workaround was to simply copy the file to the hosts download folder and from the host copy it over to/usr/share/iconsAgain, many thanks for posting this guide. This has saved me many hours.
Got any tips for maintenance of this setup so that it keeps working?