LXD and Maya: Adventures in Containerization

I’m sure there are quite a few people out there who are in the same boat I am — You need to run Maya on Linux, but Autodesk only supports RHEL and Centos. For those of us who are running those distros, this is not an issue. For the rest of us, it’s a big pain in the butt.

Now there are several ways to address this problem. You can install RHEL/Centos on a dedicated machine. You can dual boot. You can setup a virtual machine. Or you can try jury-rigging your OS and Maya to work together. For brevity’s sake, I’ll just say that none of those options were appealing to me. No, I instead took the road less traveled.

Maya can run quite well in a LXD container. The only limitation I have yet to overcome is enabling GPU acceleration for Nvidia cards. I haven’t tried setting up audio. The one error I’ve encountered is “Failed to apply color management settings on file open: Failed to finalize the color transform.”

Setup

First off you need LXD and Xpra[1] installed on the host system. If you are running a variant of the latest Ubuntu LTS then all you have to do is apt install lxd xpra.

Now that LXD is installed we need to create our container:

lxc init image:centos/7 maya

Now we map the uid and gid in the container to the host:

printf "lxd:$(id -u):1\nroot:$(id -u):1\n" | sudo tee -a /etc/subuid
printf "lxd:$(id -g):1\nroot:$(id -g):1\n" | sudo tee -a /etc/subgid
sudo systemctl restart lxd
printf "uid $(id -u) 1000\ngid $(id -g) 1000" | lxc config set maya raw.idmap -

So we can mount directories inside the container:

lxc config device add maya user disk source=/home/user path=/mnt/user # Replace 'user' with the home directory you want to share

And that’s it setup. Now we install Maya.

Installation

First we need to start our container:

lxc start maya

Second we need to open a shell:

lxc exec maya bash

Now that we’re inside our container we can start the installation. First let’s get the latest version of Xpra:

rpm --import https://xpra.org/gpg.asc
cd /etc/yum.repos.d/
curl -O https://xpra.org/repos/CentOS/xpra.repo

And then we run:

yum update

And now we can install all of our dependencies:

yum install openssh-server tcsh xterm xpra mesa-libGLw mesa-libGLU libXp libXpm \
libXmu libXt libXi libXext libX11 libXinerama libXau libxcb libXcomposite gamin \
audiofile audiofile-devel e2fsprogs-libs glibc zlib libSM libICE openssl098e \
tcsh pulseaudio-libs libxslt alsa-lib xorg-x11-fonts-ISO8859-1-100dpi \
xorg-x11-fonts-ISO8859-1-75dpi liberation-mono-fonts liberation-fonts-common \
liberation-sans-fonts liberation-serif-fonts libpng12 libtiff

Now we symlink libtiff from the current version to one Maya expects:

cd /usr/lib64
ln -s libtiff.so.5 libtiff.so.3

Before we leave the shell, we need to start ssh and set a password for root (don’t worry, it’s only temporary):

systemctl start sshd
password root # It will prompt you for a password

Now let’s exit:

exit

Now that your back in your host’s shell let’s start xterm to install Maya.

First we need to get your containers IP address:

lxc list

Using that IP, let’s start xterm:

xpra start ssh:[email protected]10.78.68.79:100 --start-child=xterm --exit-with-children --exit-with-client=yes

Xpra will complain about running as root, but you can ignore it for now.

Inside of xterm navigate to the location of your Maya tarball:

cd /mnt/user/path # Replace path with your location

Let’s extract it to tmp:

tar -xvf Autodesk_Maya_2017_EN_JP_ZH_Linux_64bit.tgz -C /tmp/

Now we can run setup:

cd /tmp # Setup will fail if not started from /tmp
./setup

Now that you’re done installing Maya, let’s cleanup:

passwd root -d

And create a user for Maya to use:

useradd user # Replace with your user
passwd user

Finally you can close xterm.

From your host shell you can add an ssh key for password-less login:

ssh-copy-id user@10.78.68.79

Now you can connect to Maya:

xpra start ssh:[email protected]10.78.68.79:100 --start-child=maya --exit-with-children --exit-with-client=yes

There you go! Maya inside an LXD container. I’ll update this post as I figure out more.


References:

[1]: I chose to use Xpra instead of plain X-forwarding because it simplifies host side configuration and improves container isolation

Leave a Reply

Your email address will not be published. Required fields are marked *