Hi, people, if you follow my posts you'll know that I was struggling to get meshmixer working in my Ubuntu 15.10 and even tried to 'hack' into the package to change its dependencies.
I just found out a method that allows me to use it in my computer in whichever version of Ubuntu I am, and I would like to share.
The way to accomplish that is by using the lightweight virtualization solution "LXC", based in containers. So you just need lxc installed on your distro and then you need to install a container with Ubuntu 14.04 64-bits in it, set up necessary conditions for display and then install Ubuntu.
I borrowed from two guides from Stéphane Graber, this one
and this one
. I skipped the pulseaudio part, since meshmixer does not use sound.
After I installed LXC, I just created a trusty tahr (Ubuntu LTS 14.04) container from the templates:
sudo lxc-create -n ubuntu1404 -t ubuntu -- --release trusty
After LXC took its time to download and install Ubuntu and set up the 'ubuntu' user, I changed its configuration, from outside the container, to allow for GUI redirection (note: the container by default in Ubuntu resides under /var/lib/lxc/your_container_name
(in my case, /var/lib/lxc/ubuntu1404
). You better ensure there is enough space since it can take a couple gigabytes (took 3 in my installation).
Note: wherever a ubuntu1404
appears, change for your container name.
Then I proceeded to edit its configuration (I use vi, you might change for your favorite text editor here):
sudo vi /var/lib/lxc/ubuntu1404/config
And added the following, at the end of the file:
lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
lxc.mount.entry = /tmp/.X11-unix tmp/.X11-unix none bind,optional,create=dir
lxc.mount.entry = /dev/video0 dev/video0 none bind,optional,create=file
lxc.cgroup.devices.allow = c 195:* rwm
I started the container. It gives you a prompt, and that is the way we will get to it to run meshmixer when it's ready:
sudo lxc-start -n ubuntu1404 -F
Enter login ubuntu / password ubuntu at the prompt.
You will have to uninstall lightdm / gdm / kdm because its startup script removes the all-important file /tmp/.X11-unix/X0 which is an unix socket for communicating with the graphics subsystem. You will also have to prevent the initialization cleaning of /tmp because it also removes this file.
And, as a bonus, you might want to add the i386 architecture, since it comes unconfigured by default.
You will need to add some stuff to ~/.bashrc and also add yourself to the 'video' group.
sudo apt-get --purge remove gdm kdm lightdm
sudo dpkg --add-architecture i386
sudo apt-get update
sudo sed -i '/^#TMPTIME.*/TMPTIME=60/' /etc/default/rcS
echo -e '\n# For X11 to work\nexport DISPLAY=:0.0\nexport QT_X11_NO_MITSHM=1\nexport GNOME_DESKTOP_SESSION_ID=this_is_deprecated' >> ~/.bashrc
sudo adduser ubuntu video
Now, install some opengl software just so that it has the necessary libraries to render everything correctly. You also need to install the very same libraries that make GPU acceleration work in your system. In my case, I installed nvidia-libopencl1-340 and nvidia-340. Let's also download gdebi
, to download and install meshmixer.
sudo apt-get install nvidia-libopencl1-340 nvidia-340 glmark2 mesa-utils wget gdebi xterm
sudo apt-get clean
You might want to stop your lxc after that and reboot the host, since from its first invocation it erased your /tmp/.X11-unix/X0. From a terminal outside lxc:
sudo lxc-stop -n ubuntu1404
After rebooting and starting your lxc again, having logged in, proceed to install meshmixer with its dependencies:
sudo gdebi meshmixer_2.9_amd64.deb
unzip meshmixer.zip && rm meshmizer.zip
It's done. You can start meshmixer through the terminal now but you might want to test the graphical subsystem and acceleration before. The programs xterm
will help you with that. Try them in sequence:
This recipe can easily be generalized for whatever software you need to run in a specific version of Ubuntu.
Please let me know if you have any problems! I hope to have told you all the steps I have taken, although I skipped the "banging the head on the wall" part.